Mercurial > projects > ldc
annotate tests/mini/floatcmp.d @ 715:30b42a283c8e
Removed TypeOpaque from DMD.
Changed runtime functions taking opaque[] to void[].
Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[].
Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86.
Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing.
Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way...
Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8.
Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 14:55:33 +0200 |
parents | 1bb99290e03a |
children |
rev | line source |
---|---|
1 | 1 module floatcmp; |
270
d9d5d59873d8
[svn r291] Fixed a bunch of the old Phobos tests to work with Tango.
lindquist
parents:
1
diff
changeset
|
2 extern(C) int printf(char*, ...); |
1 | 3 |
4 void eq() | |
5 { | |
6 float _3 = 3; | |
7 assert(!(_3 == 4)); | |
8 assert(!(_3 == 2)); | |
9 assert(_3 == 3); | |
10 assert(!(_3 == float.nan)); | |
11 } | |
12 | |
13 void neq() | |
14 { | |
15 float _3 = 3; | |
16 assert(_3 != 4); | |
17 assert(_3 != 2); | |
18 assert(!(_3 != 3)); | |
19 assert(_3 != float.nan); | |
20 } | |
21 | |
22 void gt() | |
23 { | |
24 float _3 = 3; | |
25 assert(_3 > 2); | |
26 assert(!(_3 > 4)); | |
27 assert(!(_3 > 3)); | |
28 assert(!(_3 > float.nan)); | |
29 } | |
30 | |
31 void ge() | |
32 { | |
33 float _3 = 3; | |
34 assert(_3 >= 2); | |
35 assert(!(_3 >= 4)); | |
36 assert(_3 >= 3); | |
37 assert(!(_3 >= float.nan)); | |
38 } | |
39 | |
40 void lt() | |
41 { | |
42 float _3 = 3; | |
43 assert(_3 < 4); | |
44 assert(!(_3 < 2)); | |
45 assert(!(_3 < 3)); | |
46 assert(!(_3 < float.nan)); | |
47 } | |
48 | |
49 void le() | |
50 { | |
51 float _3 = 3; | |
52 assert(_3 <= 4); | |
53 assert(!(_3 <= 2)); | |
54 assert(_3 <= 3); | |
55 assert(!(_3 <= float.nan)); | |
56 } | |
57 | |
58 void uno() | |
59 { | |
60 float _3 = 3; | |
61 assert(!(_3 !<>= 2)); | |
62 assert(!(_3 !<>= 3)); | |
63 assert(!(_3 !<>= 4)); | |
64 assert(_3 !<>= float.nan); | |
65 } | |
66 | |
67 void lg() | |
68 { | |
69 float _3 = 3; | |
70 assert(_3 <> 4); | |
71 assert(_3 <> 2); | |
72 assert(!(_3 <> 3)); | |
73 assert(!(_3 <> float.nan)); | |
74 } | |
75 | |
76 void lge() | |
77 { | |
78 float _3 = 3; | |
79 assert(_3 <>= 4); | |
80 assert(_3 <>= 2); | |
81 assert(_3 <>= 3); | |
82 assert(!(_3 <>= float.nan)); | |
83 } | |
84 | |
85 void ugt() | |
86 { | |
87 float _3 = 3; | |
88 assert(_3 !<= 2); | |
89 assert(!(_3 !<= 4)); | |
90 assert(!(_3 !<= 3)); | |
91 assert(_3 !<= float.nan); | |
92 } | |
93 | |
94 void uge() | |
95 { | |
96 float _3 = 3; | |
97 assert(_3 !< 2); | |
98 assert(!(_3 !< 4)); | |
99 assert(_3 !< 3); | |
100 assert(_3 !< float.nan); | |
101 } | |
102 | |
103 void ult() | |
104 { | |
105 float _3 = 3; | |
106 assert(_3 !>= 4); | |
107 assert(!(_3 !>= 2)); | |
108 assert(!(_3 !>= 3)); | |
109 assert(_3 !>= float.nan); | |
110 } | |
111 | |
112 void ule() | |
113 { | |
114 float _3 = 3; | |
115 assert(_3 !> 4); | |
116 assert(!(_3 !> 2)); | |
117 assert(_3 !> 3); | |
118 assert(_3 !> float.nan); | |
119 } | |
120 | |
121 void ueq() | |
122 { | |
123 float _3 = 3; | |
124 assert(!(_3 !<> 2)); | |
125 assert(!(_3 !<> 4)); | |
126 assert(_3 !<> 3); | |
127 assert(_3 !<> float.nan); | |
128 } | |
129 | |
130 void main() | |
131 { | |
132 printf("floating point comparison test\n"); | |
133 | |
134 eq(); | |
135 neq(); | |
136 gt(); | |
137 ge(); | |
138 lt(); | |
139 le(); | |
140 uno(); | |
141 lg(); | |
142 lge(); | |
143 ugt(); | |
144 uge(); | |
145 ult(); | |
146 ule(); | |
147 ueq(); | |
148 | |
149 printf(" SUCCESS\n"); | |
150 } | |
151 | |
152 /+ | |
153 void gt() | |
154 { | |
155 float _3 = 3; | |
156 assert(); | |
157 assert(); | |
158 assert(); | |
159 assert(); | |
160 } | |
161 +/ |