comparison run/mini/sextzext.d @ 1628:c6ef09dfba4d

add mini test set from ldc project
author Moritz Warning <moritzwarning@web.de>
date Mon, 10 Jan 2011 19:47:18 +0100
parents
children
comparison
equal deleted inserted replaced
1627:e1b954780837 1628:c6ef09dfba4d
1 module mini.sextzext;
2
3 void main()
4 {
5 byte sb = sextreturn1();
6 short ss = sextreturn2();
7 assert(ss == -2);
8 assert(sb == -2);
9 assert(sextparam1(-42) == -42);
10 assert(sextparam2(-42) == -42);
11
12 ubyte ub = zextreturn1();
13 ushort us = zextreturn2();
14 assert(ub == 2);
15 assert(us == 2);
16 assert(zextparam1(42) == 42);
17 assert(zextparam2(42) == 42);
18
19 assert(getchar() == 'a');
20 assert(passchar('z') == 'z');
21
22 }
23
24 byte sextreturn1()
25 {
26 return -2;
27 }
28 short sextreturn2()
29 {
30 return -2;
31 }
32
33 ubyte zextreturn1()
34 {
35 return 2;
36 }
37 ushort zextreturn2()
38 {
39 return 2;
40 }
41
42 byte sextparam1(byte b)
43 {
44 return b;
45 }
46 short sextparam2(short s)
47 {
48 return s;
49 }
50
51 ubyte zextparam1(ubyte b)
52 {
53 return b;
54 }
55 ushort zextparam2(ushort s)
56 {
57 return s;
58 }
59
60 char getchar()
61 {
62 return 'a';
63 }
64
65 char passchar(char ch)
66 {
67 return ch;
68 }