e93bb086186b420f4755f363026a59a400c11701
[ghc.git] / testsuite / tests / primops / should_run / T6135.hs
1 -- Tests created by Jan Stolarek <jan.stolarek@p.lodz.pl>
2
3 {-# LANGUAGE BangPatterns, MagicHash #-}
4 module Main where
5
6 import GHC.Exts
7
8 main :: IO ()
9 main = do
10 -- PrimOps for comparing Char#
11 putStrLn "=== testing gtCharI# ==="
12 test "gtCharI#" (a# `gtCharI#` a# ) -- False
13 test "gtCharI#" (b# `gtCharI#` a# ) -- True
14 test "gtCharI#" (a# `gtCharI#` b# ) -- False
15 test "gtCharI#" (minC# `gtCharI#` minC#) -- False
16 test "gtCharI#" (maxC# `gtCharI#` maxC#) -- False
17 test "gtCharI#" (minC# `gtCharI#` maxC#) -- False
18 test "gtCharI#" (maxC# `gtCharI#` minC#) -- True
19
20 putStrLn "=== testing geCharI# ==="
21 test "geCharI#" (a# `geCharI#` a# ) -- True
22 test "geCharI#" (b# `geCharI#` a# ) -- True
23 test "geCharI#" (a# `geCharI#` b# ) -- False
24 test "geCharI#" (minC# `geCharI#` minC#) -- True
25 test "geCharI#" (maxC# `geCharI#` maxC#) -- True
26 test "geCharI#" (minC# `geCharI#` maxC#) -- False
27 test "geCharI#" (maxC# `geCharI#` minC#) -- True
28
29 putStrLn "=== testing ltCharI# ==="
30 test "ltCharI#" (a# `ltCharI#` a# ) -- False
31 test "ltCharI#" (b# `ltCharI#` a# ) -- False
32 test "ltCharI#" (a# `ltCharI#` b# ) -- True
33 test "ltCharI#" (minC# `ltCharI#` minC#) -- False
34 test "ltCharI#" (maxC# `ltCharI#` maxC#) -- False
35 test "ltCharI#" (minC# `ltCharI#` maxC#) -- True
36 test "ltCharI#" (maxC# `ltCharI#` minC#) -- False
37
38 putStrLn "=== testing leCharI# ==="
39 test "leCharI#" (a# `leCharI#` a# ) -- True
40 test "leCharI#" (b# `leCharI#` a# ) -- False
41 test "leCharI#" (a# `leCharI#` b# ) -- True
42 test "leCharI#" (minC# `leCharI#` minC#) -- True
43 test "leCharI#" (maxC# `leCharI#` maxC#) -- True
44 test "leCharI#" (minC# `leCharI#` maxC#) -- True
45 test "leCharI#" (maxC# `leCharI#` minC#) -- False
46
47 putStrLn "=== testing eqCharI# ==="
48 test "eqCharI#" (a# `eqCharI#` a# ) -- True
49 test "eqCharI#" (b# `eqCharI#` a# ) -- False
50 test "eqCharI#" (a# `eqCharI#` b# ) -- False
51 test "eqCharI#" (minC# `eqCharI#` minC#) -- True
52 test "eqCharI#" (maxC# `eqCharI#` maxC#) -- True
53 test "eqCharI#" (minC# `eqCharI#` maxC#) -- False
54 test "eqCharI#" (maxC# `eqCharI#` minC#) -- False
55
56 putStrLn "=== testing neCharI# ==="
57 test "neCharI#" (a# `neCharI#` a# ) -- False
58 test "neCharI#" (b# `neCharI#` a# ) -- True
59 test "neCharI#" (a# `neCharI#` b# ) -- True
60 test "neCharI#" (minC# `neCharI#` minC#) -- False
61 test "neCharI#" (maxC# `neCharI#` maxC#) -- False
62 test "neCharI#" (minC# `neCharI#` maxC#) -- True
63 test "neCharI#" (maxC# `neCharI#` minC#) -- True
64
65 -- PrimOps for comparing Int#
66 putStrLn "=== testing >$# ==="
67 test ">$#" (0# >$# 0# ) -- False
68 test ">$#" (1# >$# 0# ) -- True
69 test ">$#" (0# >$# 1# ) -- False
70 test ">$#" (minI# >$# minI# ) -- False
71 test ">$#" (maxI# >$# maxI# ) -- False
72 test ">$#" (minI# +# 1# >$# minI# ) -- True
73 test ">$#" (minI# >$# minI# -# 1#) -- False (overflow)
74 test ">$#" (maxI# +# 1# >$# maxI# ) -- False (overflow)
75 test ">$#" (maxI# >$# maxI# -# 1#) -- True
76
77 putStrLn "=== testing <$# ==="
78 test "<$#" (0# <$# 0# ) -- False
79 test "<$#" (1# <$# 0# ) -- False
80 test "<$#" (0# <$# 1# ) -- True
81 test "<$#" (minI# <$# minI# ) -- False
82 test "<$#" (maxI# <$# maxI# ) -- False
83 test "<$#" (minI# <$# minI# +# 1#) -- True
84 test "<$#" (minI# -# 1# <$# minI# ) -- False (overflow)
85 test "<$#" (maxI# <$# maxI# +# 1#) -- False (overflow)
86 test "<$#" (maxI# -# 1# <$# maxI# ) -- True
87
88 putStrLn "=== testing >=$# ==="
89 test ">=$#" (0# >=$# 0# ) -- True
90 test ">=$#" (1# >=$# 0# ) -- True
91 test ">=$#" (0# >=$# 1# ) -- False
92 test ">=$#" (minI# >=$# minI# ) -- True
93 test ">=$#" (maxI# >=$# maxI# ) -- True
94 test ">=$#" (minI# +# 1# >=$# minI# ) -- True
95 test ">=$#" (minI# >=$# minI# -# 1#) -- False (overflow)
96 test ">=$#" (maxI# +# 1# >=$# maxI# ) -- False (overflow)
97 test ">=$#" (maxI# >=$# maxI# -# 1#) -- True
98
99 putStrLn "=== testing <=$# ==="
100 test "<=$#" (0# <=$# 0# ) -- True
101 test "<=$#" (1# <=$# 0# ) -- False
102 test "<=$#" (0# <=$# 1# ) -- True
103 test "<=$#" (minI# <=$# minI# ) -- True
104 test "<=$#" (maxI# <=$# maxI# ) -- True
105 test "<=$#" (minI# <=$# minI# +# 1#) -- True
106 test "<=$#" (minI# -# 1# <=$# minI# ) -- False (overflow)
107 test "<=$#" (maxI# <=$# maxI# +# 1#) -- False (overflow)
108 test "<=$#" (maxI# -# 1# <=$# maxI# ) -- True
109
110 putStrLn "=== testing ==$# ==="
111 test "==$#" (0# ==$# 0# ) -- True
112 test "==$#" (1# ==$# 0# ) -- False
113 test "==$#" (0# ==$# 1# ) -- False
114 test "==$#" (maxI# ==$# maxI# ) -- True
115 test "==$#" (maxI# -# 1# ==$# maxI# ) -- False
116 test "==$#" (minI# ==$# minI# ) -- True
117 test "==$#" (minI# ==$# minI# +# 1#) -- False
118 test "==$#" (minI# ==$# maxI# +# 1#) -- True (overflow)
119 test "==$#" (maxI# +# 1# ==$# minI# ) -- True (overflow)
120 test "==$#" (maxI# ==$# minI# -# 1#) -- True (overflow)
121 test "==$#" (minI# -# 1# ==$# maxI# ) -- True (overflow)
122
123 putStrLn "=== testing /=$# ==="
124 test "/=$#" (0# /=$# 0# ) -- False
125 test "/=$#" (1# /=$# 0# ) -- True
126 test "/=$#" (0# /=$# 1# ) -- True
127 test "/=$#" (maxI# /=$# maxI# ) -- False
128 test "/=$#" (maxI# -# 1# /=$# maxI# ) -- True
129 test "/=$#" (minI# /=$# minI# ) -- False
130 test "/=$#" (minI# /=$# minI# +# 1#) -- True
131 test "/=$#" (minI# /=$# maxI# +# 1#) -- False (overflow)
132 test "/=$#" (maxI# +# 1# /=$# minI# ) -- False (overflow)
133 test "/=$#" (maxI# /=$# minI# -# 1#) -- False (overflow)
134 test "/=$#" (minI# -# 1# /=$# maxI# ) -- False (overflow)
135
136 -- PrimOps for comparing Word#
137 putStrLn "=== testing gtWordI# ==="
138 test "gtWordI#" (zeroW# `gtWordI#` zeroW# ) -- False
139 test "gtWordI#" (oneW# `gtWordI#` zeroW# ) -- True
140 test "gtWordI#" (zeroW# `gtWordI#` oneW# ) -- False
141 test "gtWordI#" (minW# `gtWordI#` minW# ) -- False
142 test "gtWordI#" (maxW# `gtWordI#` maxW# ) -- False
143 test "gtWordI#" ((minW# `plusWord#` oneW#) `gtWordI#` minW# ) -- True
144 test "gtWordI#" (minW# `gtWordI#` (minW# `minusWord#` oneW#)) -- False (overflow)
145 test "gtWordI#" ((maxW# `plusWord#` oneW#) `gtWordI#` maxW# ) -- False (overflow)
146 test "gtWordI#" (maxW# `gtWordI#` (maxW# `minusWord#` oneW#)) -- True
147
148 putStrLn "=== testing ltWordI# ==="
149 test "ltWordI#" (zeroW# `ltWordI#` zeroW# ) -- False
150 test "ltWordI#" (oneW# `ltWordI#` zeroW# ) -- False
151 test "ltWordI#" (zeroW# `ltWordI#` oneW# ) -- True
152 test "ltWordI#" (minW# `ltWordI#` minW# ) -- False
153 test "ltWordI#" (maxW# `ltWordI#` maxW# ) -- False
154 test "ltWordI#" (minW# `ltWordI#` (minW# `plusWord#` oneW#)) -- True
155 test "ltWordI#" ((minW# `minusWord#` oneW#) `ltWordI#` minW# ) -- False (overflow)
156 test "ltWordI#" (maxW# `ltWordI#` (maxW# `plusWord#` oneW#)) -- False (overflow)
157 test "ltWordI#" ((maxW# `minusWord#` oneW#) `ltWordI#` maxW# ) -- True
158
159 putStrLn "=== testing geWordI# ==="
160 test "geWordI#" (zeroW# `geWordI#` zeroW# ) -- True
161 test "geWordI#" (oneW# `geWordI#` zeroW# ) -- True
162 test "geWordI#" (zeroW# `geWordI#` oneW# ) -- False
163 test "geWordI#" (minW# `geWordI#` minW# ) -- True
164 test "geWordI#" (maxW# `geWordI#` maxW# ) -- True
165 test "geWordI#" ((minW# `plusWord#` oneW#) `geWordI#` minW# ) -- True
166 test "geWordI#" (minW# `geWordI#` (minW# `minusWord#` oneW#)) -- False (overflow)
167 test "geWordI#" ((maxW# `plusWord#` oneW#) `geWordI#` maxW# ) -- False (overflow)
168 test "geWordI#" (maxW# `geWordI#` (maxW# `minusWord#` oneW#)) -- True
169
170 putStrLn "=== testing leWordI# ==="
171 test "leWordI#" (zeroW# `leWordI#` zeroW# ) -- True
172 test "leWordI#" (oneW# `leWordI#` zeroW# ) -- False
173 test "leWordI#" (zeroW# `leWordI#` oneW# ) -- True
174 test "leWordI#" (minW# `leWordI#` minW# ) -- True
175 test "leWordI#" (maxW# `leWordI#` maxW# ) -- True
176 test "leWordI#" (minW# `leWordI#` (minW# `plusWord#` oneW#)) -- True
177 test "leWordI#" ((minW# `minusWord#` oneW#) `leWordI#` minW# ) -- False (overflow)
178 test "leWordI#" (maxW# `leWordI#` (maxW# `plusWord#` oneW#)) -- False (overflow)
179 test "leWordI#" ((maxW# `minusWord#` oneW#) `leWordI#` maxW# ) -- True
180
181 putStrLn "=== testing eqWordI# ==="
182 test "eqWordI#" (zeroW# `eqWordI#` zeroW# ) -- True
183 test "eqWordI#" (oneW# `eqWordI#` zeroW# ) -- False
184 test "eqWordI#" (zeroW# `eqWordI#` oneW# ) -- False
185 test "eqWordI#" (maxW# `eqWordI#` maxW# ) -- True
186 test "eqWordI#" ((maxW# `minusWord#` oneW#) `eqWordI#` maxW# ) -- False
187 test "eqWordI#" (minW# `eqWordI#` minW# ) -- True
188 test "eqWordI#" (minW# `eqWordI#` (minW# `plusWord#` oneW#) ) -- False
189 test "eqWordI#" (minW# `eqWordI#` (maxW# `plusWord#` oneW#) ) -- True (overflow)
190 test "eqWordI#" ((maxW# `plusWord#` oneW#) `eqWordI#` minW# ) -- True (overflow)
191 test "eqWordI#" (maxW# `eqWordI#` (minW# `minusWord#` oneW#)) -- True (overflow)
192 test "eqWordI#" ((minW# `minusWord#` oneW#) `eqWordI#` maxW# ) -- True (overflow)
193
194 putStrLn "=== testing neWordI# ==="
195 test "neWordI#" (zeroW# `neWordI#` zeroW# ) -- False
196 test "neWordI#" (oneW# `neWordI#` zeroW# ) -- True
197 test "neWordI#" (zeroW# `neWordI#` oneW# ) -- True
198 test "neWordI#" (maxW# `neWordI#` maxW# ) -- False
199 test "neWordI#" ((maxW# `minusWord#` oneW#) `neWordI#` maxW# ) -- True
200 test "neWordI#" (minW# `neWordI#` minW# ) -- False
201 test "neWordI#" (minW# `neWordI#` (minW# `plusWord#` oneW#) ) -- True
202 test "neWordI#" (minW# `neWordI#` (maxW# `plusWord#` oneW#) ) -- False (overflow)
203 test "neWordI#" ((maxW# `plusWord#` oneW#) `neWordI#` minW# ) -- False (overflow)
204 test "neWordI#" (maxW# `neWordI#` (minW# `minusWord#` oneW#)) -- False (overflow)
205 test "neWordI#" ((minW# `minusWord#` oneW#) `neWordI#` maxW# ) -- False (overflow)
206
207 -- PrimOps for comparing Double#
208 putStrLn "=== testing >$## ==="
209 test ">$##" (0.0## >$## 0.0## ) -- False
210 test ">$##" (1.0## >$## 0.0## ) -- True
211 test ">$##" (0.0## >$## 1.0## ) -- False
212 test ">$##" (0.0## >$## nan## ) -- False
213 test ">$##" (nan## >$## 0.0## ) -- False
214 test ">$##" (nan## >$## nan## ) -- False
215 test ">$##" (infp## >$## infp##) -- False
216 test ">$##" (infn## >$## infn##) -- False
217 test ">$##" (infp## >$## infn##) -- True
218 test ">$##" (infn## >$## infp##) -- False
219 test ">$##" (infp## >$## nan## ) -- False
220 test ">$##" (infn## >$## nan## ) -- False
221 test ">$##" (nan## >$## infp##) -- False
222 test ">$##" (nan## >$## infn##) -- False
223
224 putStrLn "=== testing <$## ==="
225 test "<$##" (0.0## <$## 0.0## ) -- False
226 test "<$##" (1.0## <$## 0.0## ) -- False
227 test "<$##" (0.0## <$## 1.0## ) -- True
228 test "<$##" (0.0## <$## nan## ) -- False
229 test "<$##" (nan## <$## 0.0## ) -- False
230 test "<$##" (nan## <$## nan## ) -- False
231 test "<$##" (infp## <$## infp##) -- False
232 test "<$##" (infn## <$## infn##) -- False
233 test "<$##" (infp## <$## infn##) -- False
234 test "<$##" (infn## <$## infp##) -- True
235 test "<$##" (infp## <$## nan## ) -- False
236 test "<$##" (infn## <$## nan## ) -- False
237 test "<$##" (nan## <$## infp##) -- False
238 test "<$##" (nan## <$## infn##) -- False
239
240 putStrLn "=== testing >=$## ==="
241 test ">=$##" (0.0## >=$## 0.0## ) -- True
242 test ">=$##" (1.0## >=$## 0.0## ) -- True
243 test ">=$##" (0.0## >=$## 1.0## ) -- False
244 test ">=$##" (0.0## >=$## nan## ) -- False
245 test ">=$##" (nan## >=$## 0.0## ) -- False
246 test ">=$##" (nan## >=$## nan## ) -- False
247 test ">=$##" (infp## >=$## infp##) -- True
248 test ">=$##" (infn## >=$## infn##) -- True
249 test ">=$##" (infp## >=$## infn##) -- True
250 test ">=$##" (infn## >=$## infp##) -- False
251 test ">=$##" (infp## >=$## nan## ) -- False
252 test ">=$##" (infn## >=$## nan## ) -- False
253 test ">=$##" (nan## >=$## infp##) -- False
254 test ">=$##" (nan## >=$## infn##) -- False
255
256 putStrLn "=== testing <=$## ==="
257 test "<=$##" (0.0## <=$## 0.0## ) -- True
258 test "<=$##" (1.0## <=$## 0.0## ) -- False
259 test "<=$##" (0.0## <=$## 1.0## ) -- True
260 test "<=$##" (0.0## <=$## nan## ) -- False
261 test "<=$##" (nan## <=$## 0.0## ) -- False
262 test "<=$##" (nan## <=$## nan## ) -- False
263 test "<=$##" (infp## <=$## infp##) -- True
264 test "<=$##" (infn## <=$## infn##) -- True
265 test "<=$##" (infp## <=$## infn##) -- False
266 test "<=$##" (infn## <=$## infp##) -- True
267 test "<=$##" (infp## <=$## nan## ) -- False
268 test "<=$##" (infn## <=$## nan## ) -- False
269 test "<=$##" (nan## <=$## infp##) -- False
270 test "<=$##" (nan## <=$## infn##) -- False
271
272 putStrLn "=== testing ==$## ==="
273 test "==$##" (0.0## ==$## 0.0## ) -- True
274 test "==$##" (1.0## ==$## 0.0## ) -- False
275 test "==$##" (0.0## ==$## 1.0## ) -- False
276 test "==$##" (0.0## ==$## nan## ) -- False
277 test "==$##" (nan## ==$## 0.0## ) -- False
278 test "==$##" (nan## ==$## nan## ) -- False
279 test "==$##" (infp## ==$## infp##) -- True
280 test "==$##" (infn## ==$## infn##) -- True
281 test "==$##" (infp## ==$## infn##) -- False
282 test "==$##" (infn## ==$## infp##) -- False
283 test "==$##" (infp## ==$## nan## ) -- False
284 test "==$##" (infn## ==$## nan## ) -- False
285 test "==$##" (nan## ==$## infp##) -- False
286 test "==$##" (nan## ==$## infn##) -- False
287
288 putStrLn "=== testing /=$## ==="
289 test "/=$##" (0.0## /=$## 0.0## ) -- False
290 test "/=$##" (1.0## /=$## 0.0## ) -- True
291 test "/=$##" (0.0## /=$## 1.0## ) -- True
292 test "/=$##" (0.0## /=$## nan## ) -- True
293 test "/=$##" (nan## /=$## 0.0## ) -- True
294 test "/=$##" (nan## /=$## nan## ) -- True
295 test "/=$##" (infp## /=$## infp##) -- False
296 test "/=$##" (infn## /=$## infn##) -- False
297 test "/=$##" (infp## /=$## infn##) -- True
298 test "/=$##" (infn## /=$## infp##) -- True
299 test "/=$##" (infp## /=$## nan## ) -- True
300 test "/=$##" (infn## /=$## nan## ) -- True
301 test "/=$##" (nan## /=$## infp##) -- True
302 test "/=$##" (nan## /=$## infn##) -- True
303
304 -- PrimOps for comparing Float#
305 putStrLn "=== testing gtFloatI# ==="
306 test "gtFloatI#" (zeroF# `gtFloatI#` zeroF#) -- False
307 test "gtFloatI#" (oneF# `gtFloatI#` zeroF#) -- True
308 test "gtFloatI#" (zeroF# `gtFloatI#` oneF# ) -- False
309 test "gtFloatI#" (zeroF# `gtFloatI#` nanF# ) -- False
310 test "gtFloatI#" (nanF# `gtFloatI#` zeroF#) -- False
311 test "gtFloatI#" (nanF# `gtFloatI#` nanF# ) -- False
312 test "gtFloatI#" (infpF# `gtFloatI#` infpF#) -- False
313 test "gtFloatI#" (infnF# `gtFloatI#` infnF#) -- False
314 test "gtFloatI#" (infpF# `gtFloatI#` infnF#) -- True
315 test "gtFloatI#" (infnF# `gtFloatI#` infpF#) -- False
316 test "gtFloatI#" (infpF# `gtFloatI#` nanF# ) -- False
317 test "gtFloatI#" (infnF# `gtFloatI#` nanF# ) -- False
318 test "gtFloatI#" (nanF# `gtFloatI#` infpF#) -- False
319 test "gtFloatI#" (nanF# `gtFloatI#` infnF#) -- False
320
321 putStrLn "=== testing ltFloatI# ==="
322 test "ltFloatI#" (zeroF# `ltFloatI#` zeroF#) -- False
323 test "ltFloatI#" (oneF# `ltFloatI#` zeroF#) -- False
324 test "ltFloatI#" (zeroF# `ltFloatI#` oneF# ) -- True
325 test "ltFloatI#" (zeroF# `ltFloatI#` nanF# ) -- False
326 test "ltFloatI#" (nanF# `ltFloatI#` zeroF#) -- False
327 test "ltFloatI#" (nanF# `ltFloatI#` nanF# ) -- False
328 test "ltFloatI#" (infpF# `ltFloatI#` infpF#) -- False
329 test "ltFloatI#" (infnF# `ltFloatI#` infnF#) -- False
330 test "ltFloatI#" (infpF# `ltFloatI#` infnF#) -- False
331 test "ltFloatI#" (infnF# `ltFloatI#` infpF#) -- True
332 test "ltFloatI#" (infpF# `ltFloatI#` nanF# ) -- False
333 test "ltFloatI#" (infnF# `ltFloatI#` nanF# ) -- False
334 test "ltFloatI#" (nanF# `ltFloatI#` infpF#) -- False
335 test "ltFloatI#" (nanF# `ltFloatI#` infnF#) -- False
336
337 putStrLn "=== testing geFloatI# ==="
338 test "geFloatI#" (zeroF# `geFloatI#` zeroF#) -- True
339 test "geFloatI#" (oneF# `geFloatI#` zeroF#) -- True
340 test "geFloatI#" (zeroF# `geFloatI#` oneF# ) -- False
341 test "geFloatI#" (zeroF# `geFloatI#` nanF# ) -- False
342 test "geFloatI#" (nanF# `geFloatI#` zeroF#) -- False
343 test "geFloatI#" (nanF# `geFloatI#` nanF# ) -- False
344 test "geFloatI#" (infpF# `geFloatI#` infpF#) -- True
345 test "geFloatI#" (infnF# `geFloatI#` infnF#) -- True
346 test "geFloatI#" (infpF# `geFloatI#` infnF#) -- True
347 test "geFloatI#" (infnF# `geFloatI#` infpF#) -- False
348 test "geFloatI#" (infpF# `geFloatI#` nanF# ) -- False
349 test "geFloatI#" (infnF# `geFloatI#` nanF# ) -- False
350 test "geFloatI#" (nanF# `geFloatI#` infpF#) -- False
351 test "geFloatI#" (nanF# `geFloatI#` infnF#) -- False
352
353 putStrLn "=== testing leFloatI# ==="
354 test "leFloatI#" (zeroF# `leFloatI#` zeroF#) -- True
355 test "leFloatI#" (oneF# `leFloatI#` zeroF#) -- False
356 test "leFloatI#" (zeroF# `leFloatI#` oneF# ) -- True
357 test "leFloatI#" (zeroF# `leFloatI#` nanF# ) -- False
358 test "leFloatI#" (nanF# `leFloatI#` zeroF#) -- False
359 test "leFloatI#" (nanF# `leFloatI#` nanF# ) -- False
360 test "leFloatI#" (infpF# `leFloatI#` infpF#) -- True
361 test "leFloatI#" (infnF# `leFloatI#` infnF#) -- True
362 test "leFloatI#" (infpF# `leFloatI#` infnF#) -- False
363 test "leFloatI#" (infnF# `leFloatI#` infpF#) -- True
364 test "leFloatI#" (infpF# `leFloatI#` nanF# ) -- False
365 test "leFloatI#" (infnF# `leFloatI#` nanF# ) -- False
366 test "leFloatI#" (nanF# `leFloatI#` infpF#) -- False
367 test "leFloatI#" (nanF# `leFloatI#` infnF#) -- False
368
369 putStrLn "=== testing eqFloatI# ==="
370 test "eqFloatI#" (zeroF# `eqFloatI#` zeroF#) -- True
371 test "eqFloatI#" (oneF# `eqFloatI#` zeroF#) -- False
372 test "eqFloatI#" (zeroF# `eqFloatI#` oneF# ) -- False
373 test "eqFloatI#" (zeroF# `eqFloatI#` nanF# ) -- False
374 test "eqFloatI#" (nanF# `eqFloatI#` zeroF#) -- False
375 test "eqFloatI#" (nanF# `eqFloatI#` nanF# ) -- False
376 test "eqFloatI#" (infpF# `eqFloatI#` infpF#) -- True
377 test "eqFloatI#" (infnF# `eqFloatI#` infnF#) -- True
378 test "eqFloatI#" (infpF# `eqFloatI#` infnF#) -- False
379 test "eqFloatI#" (infnF# `eqFloatI#` infpF#) -- False
380 test "eqFloatI#" (infpF# `eqFloatI#` nanF# ) -- False
381 test "eqFloatI#" (infnF# `eqFloatI#` nanF# ) -- False
382 test "eqFloatI#" (nanF# `eqFloatI#` infpF#) -- False
383 test "eqFloatI#" (nanF# `eqFloatI#` infnF#) -- False
384
385 putStrLn "=== testing neFloatI# ==="
386 test "neFloatI#" (zeroF# `neFloatI#` zeroF#) -- False
387 test "neFloatI#" (oneF# `neFloatI#` zeroF#) -- True
388 test "neFloatI#" (zeroF# `neFloatI#` oneF# ) -- True
389 test "neFloatI#" (zeroF# `neFloatI#` nanF# ) -- True
390 test "neFloatI#" (nanF# `neFloatI#` zeroF#) -- True
391 test "neFloatI#" (nanF# `neFloatI#` nanF# ) -- True
392 test "neFloatI#" (infpF# `neFloatI#` infpF#) -- False
393 test "neFloatI#" (infnF# `neFloatI#` infnF#) -- False
394 test "neFloatI#" (infpF# `neFloatI#` infnF#) -- True
395 test "neFloatI#" (infnF# `neFloatI#` infpF#) -- True
396 test "neFloatI#" (infpF# `neFloatI#` nanF# ) -- True
397 test "neFloatI#" (infnF# `neFloatI#` nanF# ) -- True
398 test "neFloatI#" (nanF# `neFloatI#` infpF#) -- True
399 test "neFloatI#" (nanF# `neFloatI#` infnF#) -- True
400
401 --- Now all the above tests are repeated for primop wrappers
402 putStrLn "=== TESTING WRAPPERS ==="
403 -- Wrappers for comparing Char
404 putStrLn "=== testing Char > ==="
405 testw "Char >" ((\(C# a#) (C# b#) -> a# `gtChar#` b#) a a ) -- False
406 testw "Char >" ((\(C# a#) (C# b#) -> a# `gtChar#` b#) b a ) -- True
407 testw "Char >" ((\(C# a#) (C# b#) -> a# `gtChar#` b#) a b ) -- False
408 testw "Char >" ((\(C# a#) (C# b#) -> a# `gtChar#` b#) minC minC) -- False
409 testw "Char >" ((\(C# a#) (C# b#) -> a# `gtChar#` b#) maxC maxC) -- False
410 testw "Char >" ((\(C# a#) (C# b#) -> a# `gtChar#` b#) minC maxC) -- False
411 testw "Char >" ((\(C# a#) (C# b#) -> a# `gtChar#` b#) maxC minC) -- True
412
413 putStrLn "=== testing Char >= ==="
414 testw "Char >=" ((\(C# a#) (C# b#) -> a# `geChar#` b#) a a ) -- True
415 testw "Char >=" ((\(C# a#) (C# b#) -> a# `geChar#` b#) b a ) -- True
416 testw "Char >=" ((\(C# a#) (C# b#) -> a# `geChar#` b#) a b ) -- False
417 testw "Char >=" ((\(C# a#) (C# b#) -> a# `geChar#` b#) minC minC) -- True
418 testw "Char >=" ((\(C# a#) (C# b#) -> a# `geChar#` b#) maxC maxC) -- True
419 testw "Char >=" ((\(C# a#) (C# b#) -> a# `geChar#` b#) minC maxC) -- False
420 testw "Char >=" ((\(C# a#) (C# b#) -> a# `geChar#` b#) maxC minC) -- True
421
422 putStrLn "=== testing Char < ==="
423 testw "Char <" ((\(C# a#) (C# b#) -> a# `ltChar#` b#) a a ) -- False
424 testw "Char <" ((\(C# a#) (C# b#) -> a# `ltChar#` b#) b a ) -- False
425 testw "Char <" ((\(C# a#) (C# b#) -> a# `ltChar#` b#) a b ) -- True
426 testw "Char <" ((\(C# a#) (C# b#) -> a# `ltChar#` b#) minC minC) -- False
427 testw "Char <" ((\(C# a#) (C# b#) -> a# `ltChar#` b#) maxC maxC) -- False
428 testw "Char <" ((\(C# a#) (C# b#) -> a# `ltChar#` b#) minC maxC) -- True
429 testw "Char <" ((\(C# a#) (C# b#) -> a# `ltChar#` b#) maxC minC) -- False
430
431 putStrLn "=== testing Char <= ==="
432 testw "Char <=" ((\(C# a#) (C# b#) -> a# `leChar#` b#) a a ) -- True
433 testw "Char <=" ((\(C# a#) (C# b#) -> a# `leChar#` b#) b a ) -- False
434 testw "Char <=" ((\(C# a#) (C# b#) -> a# `leChar#` b#) a b ) -- True
435 testw "Char <=" ((\(C# a#) (C# b#) -> a# `leChar#` b#) minC minC) -- True
436 testw "Char <=" ((\(C# a#) (C# b#) -> a# `leChar#` b#) maxC maxC) -- True
437 testw "Char <=" ((\(C# a#) (C# b#) -> a# `leChar#` b#) minC maxC) -- True
438 testw "Char <=" ((\(C# a#) (C# b#) -> a# `leChar#` b#) maxC minC) -- False
439
440 putStrLn "=== testing Char == ==="
441 testw "Char ==" ((\(C# a#) (C# b#) -> a# `eqChar#` b#) a a ) -- True
442 testw "Char ==" ((\(C# a#) (C# b#) -> a# `eqChar#` b#) b a ) -- False
443 testw "Char ==" ((\(C# a#) (C# b#) -> a# `eqChar#` b#) a b ) -- False
444 testw "Char ==" ((\(C# a#) (C# b#) -> a# `eqChar#` b#) minC minC) -- True
445 testw "Char ==" ((\(C# a#) (C# b#) -> a# `eqChar#` b#) maxC maxC) -- True
446 testw "Char ==" ((\(C# a#) (C# b#) -> a# `eqChar#` b#) minC maxC) -- False
447 testw "Char ==" ((\(C# a#) (C# b#) -> a# `eqChar#` b#) maxC minC) -- False
448
449 putStrLn "=== testing Char /= ==="
450 testw "Char /=" ((\(C# a#) (C# b#) -> a# `neChar#` b#) a a ) -- False
451 testw "Char /=" ((\(C# a#) (C# b#) -> a# `neChar#` b#) b a ) -- True
452 testw "Char /=" ((\(C# a#) (C# b#) -> a# `neChar#` b#) a b ) -- True
453 testw "Char /=" ((\(C# a#) (C# b#) -> a# `neChar#` b#) minC minC) -- False
454 testw "Char /=" ((\(C# a#) (C# b#) -> a# `neChar#` b#) maxC maxC) -- False
455 testw "Char /=" ((\(C# a#) (C# b#) -> a# `neChar#` b#) minC maxC) -- True
456 testw "Char /=" ((\(C# a#) (C# b#) -> a# `neChar#` b#) maxC minC) -- True
457
458 -- Wrappers for comparing Int
459 putStrLn "=== testing Int > ==="
460 testw "Int >" ((\(I# a#) (I# b#) -> a# ># b#) 0 0 ) -- False
461 testw "Int >" ((\(I# a#) (I# b#) -> a# ># b#) 1 0 ) -- True
462 testw "Int >" ((\(I# a#) (I# b#) -> a# ># b#) 0 1 ) -- False
463 testw "Int >" ((\(I# a#) (I# b#) -> a# ># b#) minI minI ) -- False
464 testw "Int >" ((\(I# a#) (I# b#) -> a# ># b#) maxI maxI ) -- False
465 testw "Int >" ((\(I# a#) (I# b#) -> a# ># b#) (minI+1) minI ) -- True
466 testw "Int >" ((\(I# a#) (I# b#) -> a# ># b#) minI (minI-1)) -- False (overflow)
467 testw "Int >" ((\(I# a#) (I# b#) -> a# ># b#) (maxI+1) maxI ) -- False (overflow)
468 testw "Int >" ((\(I# a#) (I# b#) -> a# ># b#) maxI (maxI-1)) -- True
469
470 putStrLn "=== testing Int < ==="
471 testw "Int <" ((\(I# a#) (I# b#) -> a# <# b#) 0 0 ) -- False
472 testw "Int <" ((\(I# a#) (I# b#) -> a# <# b#) 1 0 ) -- False
473 testw "Int <" ((\(I# a#) (I# b#) -> a# <# b#) 0 1 ) -- True
474 testw "Int <" ((\(I# a#) (I# b#) -> a# <# b#) minI minI ) -- False
475 testw "Int <" ((\(I# a#) (I# b#) -> a# <# b#) maxI maxI ) -- False
476 testw "Int <" ((\(I# a#) (I# b#) -> a# <# b#) minI (minI+1)) -- True
477 testw "Int <" ((\(I# a#) (I# b#) -> a# <# b#) (minI-1) minI ) -- False (overflow)
478 testw "Int <" ((\(I# a#) (I# b#) -> a# <# b#) maxI (maxI+1)) -- False (overflow)
479 testw "Int <" ((\(I# a#) (I# b#) -> a# <# b#) (maxI-1) maxI ) -- True
480
481 putStrLn "=== testing Int >= ==="
482 testw "Int >=" ((\(I# a#) (I# b#) -> a# >=# b#) 0 0 ) -- True
483 testw "Int >=" ((\(I# a#) (I# b#) -> a# >=# b#) 1 0 ) -- True
484 testw "Int >=" ((\(I# a#) (I# b#) -> a# >=# b#) 0 1 ) -- False
485 testw "Int >=" ((\(I# a#) (I# b#) -> a# >=# b#) minI minI ) -- True
486 testw "Int >=" ((\(I# a#) (I# b#) -> a# >=# b#) maxI maxI ) -- True
487 testw "Int >=" ((\(I# a#) (I# b#) -> a# >=# b#) (minI+1) minI ) -- True
488 testw "Int >=" ((\(I# a#) (I# b#) -> a# >=# b#) minI (minI-1)) -- False (overflow)
489 testw "Int >=" ((\(I# a#) (I# b#) -> a# >=# b#) (maxI+1) maxI ) -- False (overflow)
490 testw "Int >=" ((\(I# a#) (I# b#) -> a# >=# b#) maxI (maxI-1)) -- True
491
492 putStrLn "=== testing Int <= ==="
493 testw "Int <=" ((\(I# a#) (I# b#) -> a# <=# b#) 0 0 ) -- True
494 testw "Int <=" ((\(I# a#) (I# b#) -> a# <=# b#) 1 0 ) -- False
495 testw "Int <=" ((\(I# a#) (I# b#) -> a# <=# b#) 0 1 ) -- True
496 testw "Int <=" ((\(I# a#) (I# b#) -> a# <=# b#) minI minI ) -- True
497 testw "Int <=" ((\(I# a#) (I# b#) -> a# <=# b#) maxI maxI ) -- True
498 testw "Int <=" ((\(I# a#) (I# b#) -> a# <=# b#) minI (minI+1)) -- True
499 testw "Int <=" ((\(I# a#) (I# b#) -> a# <=# b#) (minI-1) minI ) -- False (overflow)
500 testw "Int <=" ((\(I# a#) (I# b#) -> a# <=# b#) maxI (maxI+1)) -- False (overflow)
501 testw "Int <=" ((\(I# a#) (I# b#) -> a# <=# b#) (maxI-1) maxI ) -- True
502
503 putStrLn "=== testing Int == ==="
504 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) 0 0 ) -- True
505 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) 1 0 ) -- False
506 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) 0 1 ) -- False
507 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) maxI maxI ) -- True
508 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) (maxI-1) maxI ) -- False
509 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) minI minI ) -- True
510 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) minI (minI+1)) -- False
511 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) minI (maxI+1)) -- True (overflow)
512 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) (maxI+1) minI ) -- True (overflow)
513 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) maxI (minI-1)) -- True (overflow)
514 testw "Int ==" ((\(I# a#) (I# b#) -> a# ==# b#) (minI-1) maxI ) -- True (overflow)
515
516 putStrLn "=== testing Int /= ==="
517 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) 0 0 ) -- False
518 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) 1 0 ) -- True
519 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) 0 1 ) -- True
520 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) maxI maxI ) -- False
521 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) (maxI-1) maxI ) -- True
522 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) minI minI ) -- False
523 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) minI (minI+1)) -- True
524 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) minI (maxI+1)) -- False (overflow)
525 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) (maxI+1) minI ) -- False (overflow)
526 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) maxI (minI-1)) -- False (overflow)
527 testw "Int /=" ((\(I# a#) (I# b#) -> a# /=# b#) (minI-1) maxI ) -- False (overflow)
528
529 -- Wrappers for comparing Word
530 putStrLn "=== testing Word > ==="
531 testw "Word >" ((\(W# a#) (W# b#) -> a# `gtWord#` b#) zeroW zeroW ) -- False
532 testw "Word >" ((\(W# a#) (W# b#) -> a# `gtWord#` b#) oneW zeroW ) -- True
533 testw "Word >" ((\(W# a#) (W# b#) -> a# `gtWord#` b#) zeroW oneW ) -- False
534 testw "Word >" ((\(W# a#) (W# b#) -> a# `gtWord#` b#) minW minW ) -- False
535 testw "Word >" ((\(W# a#) (W# b#) -> a# `gtWord#` b#) maxW maxW ) -- False
536 testw "Word >" ((\(W# a#) (W# b#) -> a# `gtWord#` b#) (minW+oneW) minW ) -- True
537 testw "Word >" ((\(W# a#) (W# b#) -> a# `gtWord#` b#) minW (minW-oneW)) -- False (overflow)
538 testw "Word >" ((\(W# a#) (W# b#) -> a# `gtWord#` b#) (maxW+oneW) maxW ) -- False (overflow)
539 testw "Word >" ((\(W# a#) (W# b#) -> a# `gtWord#` b#) maxW (maxW-oneW)) -- True
540
541 putStrLn "=== testing Word < ==="
542 testw "Word <" ((\(W# a#) (W# b#) -> a# `ltWord#` b#) zeroW zeroW ) -- False
543 testw "Word <" ((\(W# a#) (W# b#) -> a# `ltWord#` b#) oneW zeroW ) -- False
544 testw "Word <" ((\(W# a#) (W# b#) -> a# `ltWord#` b#) zeroW oneW ) -- True
545 testw "Word <" ((\(W# a#) (W# b#) -> a# `ltWord#` b#) minW minW ) -- False
546 testw "Word <" ((\(W# a#) (W# b#) -> a# `ltWord#` b#) maxW maxW ) -- False
547 testw "Word <" ((\(W# a#) (W# b#) -> a# `ltWord#` b#) minW (minW+oneW)) -- True
548 testw "Word <" ((\(W# a#) (W# b#) -> a# `ltWord#` b#) (minW-oneW) minW ) -- False (overflow)
549 testw "Word <" ((\(W# a#) (W# b#) -> a# `ltWord#` b#) maxW (maxW+oneW)) -- False (overflow)
550 testw "Word <" ((\(W# a#) (W# b#) -> a# `ltWord#` b#) (maxW-oneW) maxW ) -- True
551
552 putStrLn "=== testing Word >= ==="
553 testw "Word >=" ((\(W# a#) (W# b#) -> a# `geWord#` b#) zeroW zeroW ) -- True
554 testw "Word >=" ((\(W# a#) (W# b#) -> a# `geWord#` b#) oneW zeroW ) -- True
555 testw "Word >=" ((\(W# a#) (W# b#) -> a# `geWord#` b#) zeroW oneW ) -- False
556 testw "Word >=" ((\(W# a#) (W# b#) -> a# `geWord#` b#) minW minW ) -- True
557 testw "Word >=" ((\(W# a#) (W# b#) -> a# `geWord#` b#) maxW maxW ) -- True
558 testw "Word >=" ((\(W# a#) (W# b#) -> a# `geWord#` b#) (minW+oneW) minW ) -- True
559 testw "Word >=" ((\(W# a#) (W# b#) -> a# `geWord#` b#) minW (minW-oneW)) -- False (overflow)
560 testw "Word >=" ((\(W# a#) (W# b#) -> a# `geWord#` b#) (maxW+oneW) maxW ) -- False (overflow)
561 testw "Word >=" ((\(W# a#) (W# b#) -> a# `geWord#` b#) maxW (maxW-oneW)) -- True
562
563 putStrLn "=== testing Word <= ==="
564 testw "Word <=" ((\(W# a#) (W# b#) -> a# `leWord#` b#) zeroW zeroW ) -- True
565 testw "Word <=" ((\(W# a#) (W# b#) -> a# `leWord#` b#) oneW zeroW ) -- False
566 testw "Word <=" ((\(W# a#) (W# b#) -> a# `leWord#` b#) zeroW oneW ) -- True
567 testw "Word <=" ((\(W# a#) (W# b#) -> a# `leWord#` b#) minW minW ) -- True
568 testw "Word <=" ((\(W# a#) (W# b#) -> a# `leWord#` b#) maxW maxW ) -- True
569 testw "Word <=" ((\(W# a#) (W# b#) -> a# `leWord#` b#) minW (minW+oneW)) -- True
570 testw "Word <=" ((\(W# a#) (W# b#) -> a# `leWord#` b#) (minW-oneW) minW ) -- False (overflow)
571 testw "Word <=" ((\(W# a#) (W# b#) -> a# `leWord#` b#) maxW (maxW+oneW)) -- False (overflow)
572 testw "Word <=" ((\(W# a#) (W# b#) -> a# `leWord#` b#) (maxW-oneW) maxW ) -- True
573
574 putStrLn "=== testing Word == ==="
575 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) zeroW zeroW ) -- True
576 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) oneW zeroW ) -- False
577 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) zeroW oneW ) -- False
578 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) maxW maxW ) -- True
579 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) (maxW-oneW) maxW ) -- False
580 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) minW minW ) -- True
581 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) minW (minW+oneW)) -- False
582 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) minW (maxW+oneW)) -- True (overflow)
583 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) (maxW+oneW) minW ) -- True (overflow)
584 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) maxW (minW-oneW)) -- True (overflow)
585 testw "Word ==" ((\(W# a#) (W# b#) -> a# `eqWord#` b#) (minW-oneW) maxW ) -- True (overflow)
586
587 putStrLn "=== testing Word /= ==="
588 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) zeroW zeroW ) -- False
589 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) oneW zeroW ) -- True
590 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) zeroW oneW ) -- True
591 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) maxW maxW ) -- False
592 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) (maxW-oneW) maxW ) -- True
593 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) minW minW ) -- False
594 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) minW (minW+oneW)) -- True
595 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) minW (maxW+oneW)) -- False (overflow)
596 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) (maxW+oneW) minW ) -- False (overflow)
597 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) maxW (minW-oneW)) -- False (overflow)
598 testw "Word /=" ((\(W# a#) (W# b#) -> a# `neWord#` b#) (minW-oneW) maxW ) -- False (overflow)
599
600 -- Wrappers for comparing Double
601 putStrLn "=== testing Double > ==="
602 testw "Double >" ((\(D# a) (D# b) -> a >## b) 0.0 0.0 ) -- False
603 testw "Double >" ((\(D# a) (D# b) -> a >## b) 1.0 0.0 ) -- True
604 testw "Double >" ((\(D# a) (D# b) -> a >## b) 0.0 1.0 ) -- False
605 testw "Double >" ((\(D# a) (D# b) -> a >## b) 0.0 nan ) -- False
606 testw "Double >" ((\(D# a) (D# b) -> a >## b) nan 0.0 ) -- False
607 testw "Double >" ((\(D# a) (D# b) -> a >## b) nan nan ) -- False
608 testw "Double >" ((\(D# a) (D# b) -> a >## b) infp infp) -- False
609 testw "Double >" ((\(D# a) (D# b) -> a >## b) infn infn) -- False
610 testw "Double >" ((\(D# a) (D# b) -> a >## b) infp infn) -- True
611 testw "Double >" ((\(D# a) (D# b) -> a >## b) infn infp) -- False
612 testw "Double >" ((\(D# a) (D# b) -> a >## b) infp nan ) -- False
613 testw "Double >" ((\(D# a) (D# b) -> a >## b) infn nan ) -- False
614 testw "Double >" ((\(D# a) (D# b) -> a >## b) nan infp) -- False
615 testw "Double >" ((\(D# a) (D# b) -> a >## b) nan infn) -- False
616
617 putStrLn "=== testing Double < ==="
618 testw "Double <" ((\(D# a) (D# b) -> a <## b) 0.0 0.0 ) -- False
619 testw "Double <" ((\(D# a) (D# b) -> a <## b) 1.0 0.0 ) -- False
620 testw "Double <" ((\(D# a) (D# b) -> a <## b) 0.0 1.0 ) -- True
621 testw "Double <" ((\(D# a) (D# b) -> a <## b) 0.0 nan ) -- False
622 testw "Double <" ((\(D# a) (D# b) -> a <## b) nan 0.0 ) -- False
623 testw "Double <" ((\(D# a) (D# b) -> a <## b) nan nan ) -- False
624 testw "Double <" ((\(D# a) (D# b) -> a <## b) infp infp) -- False
625 testw "Double <" ((\(D# a) (D# b) -> a <## b) infn infn) -- False
626 testw "Double <" ((\(D# a) (D# b) -> a <## b) infp infn) -- False
627 testw "Double <" ((\(D# a) (D# b) -> a <## b) infn infp) -- True
628 testw "Double <" ((\(D# a) (D# b) -> a <## b) infp nan ) -- False
629 testw "Double <" ((\(D# a) (D# b) -> a <## b) infn nan ) -- False
630 testw "Double <" ((\(D# a) (D# b) -> a <## b) nan infp) -- False
631 testw "Double <" ((\(D# a) (D# b) -> a <## b) nan infn) -- False
632
633 putStrLn "=== testing Double >= ==="
634 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) 0.0 0.0 ) -- True
635 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) 1.0 0.0 ) -- True
636 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) 0.0 1.0 ) -- False
637 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) 0.0 nan ) -- False
638 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) nan 0.0 ) -- False
639 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) nan nan ) -- False
640 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) infp infp) -- True
641 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) infn infn) -- True
642 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) infp infn) -- True
643 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) infn infp) -- False
644 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) infp nan ) -- False
645 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) infn nan ) -- False
646 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) nan infp) -- False
647 testw "Double >=" ((\(D# a) (D# b) -> a >=## b) nan infn) -- False
648
649 putStrLn "=== testing Double <= ==="
650 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) 0.0 0.0 ) -- True
651 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) 1.0 0.0 ) -- False
652 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) 0.0 1.0 ) -- True
653 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) 0.0 nan ) -- False
654 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) nan 0.0 ) -- False
655 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) nan nan ) -- False
656 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) infp infp) -- True
657 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) infn infn) -- True
658 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) infp infn) -- False
659 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) infn infp) -- True
660 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) infp nan ) -- False
661 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) infn nan ) -- False
662 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) nan infp) -- False
663 testw "Double <=" ((\(D# a) (D# b) -> a <=## b) nan infn) -- False
664
665 putStrLn "=== testing Double == ==="
666 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) 0.0 0.0 ) -- True
667 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) 1.0 0.0 ) -- False
668 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) 0.0 1.0 ) -- False
669 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) 0.0 nan ) -- False
670 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) nan 0.0 ) -- False
671 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) nan nan ) -- False
672 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) infp infp) -- True
673 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) infn infn) -- True
674 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) infp infn) -- False
675 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) infn infp) -- False
676 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) infp nan ) -- False
677 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) infn nan ) -- False
678 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) nan infp) -- False
679 testw "Double ==" ((\(D# a) (D# b) -> a ==## b) nan infn) -- False
680
681 putStrLn "=== testing Double /= ==="
682 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) 0.0 0.0 ) -- False
683 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) 1.0 0.0 ) -- True
684 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) 0.0 1.0 ) -- True
685 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) 0.0 nan ) -- True
686 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) nan 0.0 ) -- True
687 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) nan nan ) -- True
688 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) infp infp) -- False
689 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) infn infn) -- False
690 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) infp infn) -- True
691 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) infn infp) -- True
692 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) infp nan ) -- True
693 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) infn nan ) -- True
694 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) nan infp) -- True
695 testw "Double /=" ((\(D# a) (D# b) -> a /=## b) nan infn) -- True
696
697 -- Wrappers for comparing Float
698 putStrLn "=== testing Float > ==="
699 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) zeroF zeroF) -- False
700 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) oneF zeroF) -- True
701 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) zeroF oneF ) -- False
702 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) zeroF nanF ) -- False
703 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) nanF zeroF) -- False
704 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) nanF nanF ) -- False
705 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) infpF infpF) -- False
706 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) infnF infnF) -- False
707 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) infpF infnF) -- True
708 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) infnF infpF) -- False
709 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) infpF nanF ) -- False
710 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) infnF nanF ) -- False
711 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) nanF infpF) -- False
712 testw "Float >" ((\(F# a) (F# b) -> a `gtFloat#` b) nanF infnF) -- False
713
714 putStrLn "=== testing Float < ==="
715 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) zeroF zeroF) -- False
716 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) oneF zeroF) -- False
717 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) zeroF oneF ) -- True
718 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) zeroF nanF ) -- False
719 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) nanF zeroF) -- False
720 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) nanF nanF ) -- False
721 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) infpF infpF) -- False
722 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) infnF infnF) -- False
723 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) infpF infnF) -- False
724 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) infnF infpF) -- True
725 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) infpF nanF ) -- False
726 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) infnF nanF ) -- False
727 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) nanF infpF) -- False
728 testw "Float <" ((\(F# a) (F# b) -> a `ltFloat#` b) nanF infnF) -- False
729
730 putStrLn "=== testing Float >= ==="
731 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) zeroF zeroF) -- True
732 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) oneF zeroF) -- True
733 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) zeroF oneF ) -- False
734 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) zeroF nanF ) -- False
735 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) nanF zeroF) -- False
736 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) nanF nanF ) -- False
737 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) infpF infpF) -- True
738 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) infnF infnF) -- True
739 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) infpF infnF) -- True
740 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) infnF infpF) -- False
741 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) infpF nanF ) -- False
742 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) infnF nanF ) -- False
743 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) nanF infpF) -- False
744 testw "Float >=" ((\(F# a) (F# b) -> a `geFloat#` b) nanF infnF) -- False
745
746 putStrLn "=== testing Float <= ==="
747 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) zeroF zeroF) -- True
748 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) oneF zeroF) -- False
749 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) zeroF oneF ) -- True
750 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) zeroF nanF ) -- False
751 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) nanF zeroF) -- False
752 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) nanF nanF ) -- False
753 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) infpF infpF) -- True
754 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) infnF infnF) -- True
755 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) infpF infnF) -- False
756 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) infnF infpF) -- True
757 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) infpF nanF ) -- False
758 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) infnF nanF ) -- False
759 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) nanF infpF) -- False
760 testw "Float <=" ((\(F# a) (F# b) -> a `leFloat#` b) nanF infnF) -- False
761
762 putStrLn "=== testing Float == ==="
763 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) zeroF zeroF) -- True
764 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) oneF zeroF) -- False
765 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) zeroF oneF ) -- False
766 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) zeroF nanF ) -- False
767 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) nanF zeroF) -- False
768 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) nanF nanF ) -- False
769 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) infpF infpF) -- True
770 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) infnF infnF) -- True
771 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) infpF infnF) -- False
772 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) infnF infpF) -- False
773 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) infpF nanF ) -- False
774 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) infnF nanF ) -- False
775 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) nanF infpF) -- False
776 testw "Float ==" ((\(F# a) (F# b) -> a `eqFloat#` b) nanF infnF) -- False
777
778 putStrLn "=== testing Float /= ==="
779 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) zeroF zeroF) -- False
780 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) oneF zeroF) -- True
781 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) zeroF oneF ) -- True
782 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) zeroF nanF ) -- True
783 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) nanF zeroF) -- True
784 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) nanF nanF ) -- True
785 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) infpF infpF) -- False
786 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) infnF infnF) -- False
787 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) infpF infnF) -- True
788 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) infnF infpF) -- True
789 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) infpF nanF ) -- True
790 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) infnF nanF ) -- True
791 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) nanF infpF) -- True
792 testw "Float /=" ((\(F# a) (F# b) -> a `neFloat#` b) nanF infnF) -- True
793 where
794 -- every integer is compared to 1 representing True. This
795 -- results in printing "True" when the primop should return True
796 -- and printing "False" when it should return False
797 test :: String -> Int# -> IO ()
798 test str x = putStrLn $ str ++ " " ++ (show (I# x == 1))
799 testw :: String -> Bool -> IO ()
800 testw str x = putStrLn $ str ++ " " ++ (show x)
801 a = 'a'
802 b = 'b'
803 !(C# a#) = a
804 !(C# b#) = b
805 zeroW = 0 :: Word
806 oneW = 1 :: Word
807 !(W# zeroW#) = zeroW
808 !(W# oneW#) = oneW
809 nan = 0.0 / 0.0 :: Double
810 infp = 1.0 / 0.0 :: Double
811 infn = -1.0 / 0.0 :: Double
812 !(D# nan##) = 0.0 / 0.0
813 !(D# infp##) = 1.0 / 0.0
814 !(D# infn##) = -1.0 / 0.0
815 zeroF = 0.0 :: Float
816 oneF = 1.0 :: Float
817 nanF = 0.0 / 0.0 :: Float
818 infpF = 1.0 / 0.0 :: Float
819 infnF = -1.0 / 0.0 :: Float
820 !(F# zeroF#) = 0.0
821 !(F# oneF#) = 1.0
822 !(F# nanF#) = 0.0 / 0.0
823 !(F# infpF#) = 1.0 / 0.0
824 !(F# infnF#) = -1.0 / 0.0
825 minC = minBound :: Char
826 maxC = maxBound :: Char
827 !(C# minC#) = minC
828 !(C# maxC#) = maxC
829 minI = minBound :: Int
830 maxI = maxBound :: Int
831 !(I# minI#) = minI
832 !(I# maxI#) = maxI
833 minW = minBound :: Word
834 maxW = maxBound :: Word
835 !(W# minW#) = minW
836 !(W# maxW#) = maxW