297
297
@test FD {Int8, 2} (0 ) != typemax (Int16)
298
298
@test FD {Int8, 0} (0 ) != typemin (Int16)
299
299
@test FD {Int8, 2} (0 ) != typemin (Int16)
300
+
301
+ # less precision allows smaller and bigger numbers
302
+ @test typemin (FD{Int8, 1 }) != typemin (FD{Int8,2 })
303
+ @test typemax (FD{Int8, 1 }) != typemax (FD{Int8,2 })
300
304
end
301
305
@testset " inequality between types" begin
302
306
@test FD {Int8, 0} (1 ) <= FD {Int8, 2} (1 )
@@ -312,41 +316,93 @@ end
312
316
@test FD {Int8, 0} (4 ) >= FD {Int16, 4} (1 ) # FD{Int16,4}(4) doesn't fit
313
317
@test FD {Int16, 4} (1 ) < FD {Int8, 0} (4 ) # FD{Int16,4}(4) doesn't fit
314
318
315
- # Integer == FD
316
- @test 1 <= FD {Int8, 2} (1 ) <= 1
317
- @test 1 >= FD {Int8, 2} (1 ) >= 1
318
- @test 2 > FD {Int8, 2} (1 )
319
- @test FD {Int8, 2} (1 ) < 2
320
- @test 2 >= FD {Int8, 2} (1 )
321
- @test FD {Int8, 2} (1 ) <= 2
322
- @test 1 <= FD {Int8, 0} (1 ) < 2
323
-
324
- @test typemax (Int16) > FD {Int8, 0} (1 ) > typemin (Int16)
325
- @test typemax (Int16) > FD {Int8, 2} (1 ) > typemin (Int16)
326
- @test typemin (Int16) < FD {Int8, 0} (1 ) < typemax (Int16)
327
- @test typemin (Int16) < FD {Int8, 2} (1 ) < typemax (Int16)
328
- @test ! (typemax (Int16) < FD {Int8, 0} (1 ) < typemin (Int16))
329
- @test ! (typemax (Int16) < FD {Int8, 2} (1 ) < typemin (Int16))
330
- @test ! (typemin (Int16) > FD {Int8, 0} (1 ) > typemax (Int16))
331
- @test ! (typemin (Int16) > FD {Int8, 2} (1 ) > typemax (Int16))
332
-
333
- @test typemax (Int16) > FD {Int8, 0} (- 1 ) > typemin (Int16)
334
- @test typemax (Int16) > FD {Int8, 2} (- 1 ) > typemin (Int16)
335
- @test typemin (Int16) < FD {Int8, 0} (- 1 ) < typemax (Int16)
336
- @test typemin (Int16) < FD {Int8, 2} (- 1 ) < typemax (Int16)
337
- @test ! (typemax (Int16) < FD {Int8, 0} (- 1 ) < typemin (Int16))
338
- @test ! (typemax (Int16) < FD {Int8, 2} (- 1 ) < typemin (Int16))
339
- @test ! (typemin (Int16) > FD {Int8, 0} (- 1 ) > typemax (Int16))
340
- @test ! (typemin (Int16) > FD {Int8, 2} (- 1 ) > typemax (Int16))
341
-
342
- @test typemax (Int16) >= FD {Int8, 0} (0 ) >= typemin (Int16)
343
- @test typemax (Int16) >= FD {Int8, 2} (0 ) >= typemin (Int16)
344
- @test typemin (Int16) <= FD {Int8, 0} (0 ) <= typemax (Int16)
345
- @test typemin (Int16) <= FD {Int8, 2} (0 ) <= typemax (Int16)
346
- @test ! (typemax (Int16) <= FD {Int8, 0} (- 1 ) <= typemin (Int16))
347
- @test ! (typemax (Int16) <= FD {Int8, 2} (- 1 ) <= typemin (Int16))
348
- @test ! (typemin (Int16) >= FD {Int8, 0} (- 1 ) >= typemax (Int16))
349
- @test ! (typemin (Int16) >= FD {Int8, 2} (- 1 ) >= typemax (Int16))
319
+ # less precision allows smaller numbers
320
+ @test typemin (FD{Int8, 1 }) < typemin (FD{Int8,2 })
321
+ @test typemin (FD{Int8, 1 }) <= typemin (FD{Int8,2 })
322
+ @test typemin (FD{Int8, 2 }) > typemin (FD{Int8,1 })
323
+ @test typemin (FD{Int8, 2 }) >= typemin (FD{Int8,1 })
324
+ # less precision allows bigger numbers
325
+ @test typemax (FD{Int8, 1 }) > typemax (FD{Int8,2 })
326
+ @test typemax (FD{Int8, 1 }) >= typemax (FD{Int8,2 })
327
+ @test typemax (FD{Int8, 2 }) < typemax (FD{Int8,1 })
328
+ @test typemax (FD{Int8, 2 }) <= typemax (FD{Int8,1 })
329
+
330
+ @test ! (typemin (FD{Int8, 2 }) <= typemin (FD{Int8,1 }))
331
+ @test ! (typemin (FD{Int8, 1 }) >= typemin (FD{Int8,2 }))
332
+ @test ! (typemin (FD{Int8, 1 }) > typemin (FD{Int8,2 }))
333
+ @test ! (typemin (FD{Int8, 1 }) >= typemin (FD{Int8,2 }))
334
+ @test ! (typemin (FD{Int8, 2 }) < typemin (FD{Int8,1 }))
335
+ @test ! (typemin (FD{Int8, 2 }) <= typemin (FD{Int8,1 }))
336
+ @test ! (typemax (FD{Int8, 1 }) < typemax (FD{Int8,2 }))
337
+ @test ! (typemax (FD{Int8, 1 }) <= typemax (FD{Int8,2 }))
338
+ @test ! (typemax (FD{Int8, 2 }) > typemax (FD{Int8,1 }))
339
+ @test ! (typemax (FD{Int8, 2 }) >= typemax (FD{Int8,1 }))
340
+
341
+ @testset " Integer and FD" begin
342
+ @test 1 <= FD {Int8, 2} (1 ) <= 1
343
+ @test 1 >= FD {Int8, 2} (1 ) >= 1
344
+ @test 2 > FD {Int8, 2} (1 )
345
+ @test FD {Int8, 2} (1 ) < 2
346
+ @test 2 >= FD {Int8, 2} (1 )
347
+ @test FD {Int8, 2} (1 ) <= 2
348
+ @test 1 <= FD {Int8, 0} (1 ) < 2
349
+
350
+ # negatives
351
+ @test - 1 <= FD {Int8, 2} (- 1 ) <= - 1
352
+ @test - 1 >= FD {Int8, 2} (- 1 ) >= - 1
353
+ @test - 2 < FD {Int8, 2} (- 1 )
354
+ @test FD {Int8, 2} (- 1 ) > - 2
355
+ @test - 2 <= FD {Int8, 2} (- 1 )
356
+ @test FD {Int8, 2} (- 1 ) >= - 2
357
+ @test - 1 <= FD {Int8, 0} (- 1 ) < 2
358
+
359
+ # Same types
360
+ @test typemax (Int8) > FD {Int8, 0} (1 ) > typemin (Int8)
361
+ @test typemax (Int8) > FD {Int8, 2} (1 ) > typemin (Int8)
362
+ @test typemin (Int8) < FD {Int8, 0} (1 ) < typemax (Int8)
363
+ @test typemin (Int8) < FD {Int8, 2} (1 ) < typemax (Int8)
364
+ @test ! (typemax (Int8) < FD {Int8, 0} (1 ) < typemin (Int8))
365
+ @test ! (typemax (Int8) < FD {Int8, 2} (1 ) < typemin (Int8))
366
+ @test ! (typemin (Int8) > FD {Int8, 0} (1 ) > typemax (Int8))
367
+ @test ! (typemin (Int8) > FD {Int8, 2} (1 ) > typemax (Int8))
368
+
369
+ @test typemax (Int8) > FD {Int8, 0} (- 1 ) > typemin (Int8)
370
+ @test typemax (Int8) > FD {Int8, 2} (- 1 ) > typemin (Int8)
371
+ @test typemin (Int8) < FD {Int8, 0} (- 1 ) < typemax (Int8)
372
+ @test typemin (Int8) < FD {Int8, 2} (- 1 ) < typemax (Int8)
373
+ @test ! (typemax (Int8) < FD {Int8, 0} (- 1 ) < typemin (Int8))
374
+ @test ! (typemax (Int8) < FD {Int8, 2} (- 1 ) < typemin (Int8))
375
+ @test ! (typemin (Int8) > FD {Int8, 0} (- 1 ) > typemax (Int8))
376
+ @test ! (typemin (Int8) > FD {Int8, 2} (- 1 ) > typemax (Int8))
377
+
378
+ # Different types
379
+ @test typemax (Int16) > FD {Int8, 0} (1 ) > typemin (Int16)
380
+ @test typemax (Int16) > FD {Int8, 2} (1 ) > typemin (Int16)
381
+ @test typemin (Int16) < FD {Int8, 0} (1 ) < typemax (Int16)
382
+ @test typemin (Int16) < FD {Int8, 2} (1 ) < typemax (Int16)
383
+ @test ! (typemax (Int16) < FD {Int8, 0} (1 ) < typemin (Int16))
384
+ @test ! (typemax (Int16) < FD {Int8, 2} (1 ) < typemin (Int16))
385
+ @test ! (typemin (Int16) > FD {Int8, 0} (1 ) > typemax (Int16))
386
+ @test ! (typemin (Int16) > FD {Int8, 2} (1 ) > typemax (Int16))
387
+
388
+ @test typemax (Int16) > FD {Int8, 0} (- 1 ) > typemin (Int16)
389
+ @test typemax (Int16) > FD {Int8, 2} (- 1 ) > typemin (Int16)
390
+ @test typemin (Int16) < FD {Int8, 0} (- 1 ) < typemax (Int16)
391
+ @test typemin (Int16) < FD {Int8, 2} (- 1 ) < typemax (Int16)
392
+ @test ! (typemax (Int16) < FD {Int8, 0} (- 1 ) < typemin (Int16))
393
+ @test ! (typemax (Int16) < FD {Int8, 2} (- 1 ) < typemin (Int16))
394
+ @test ! (typemin (Int16) > FD {Int8, 0} (- 1 ) > typemax (Int16))
395
+ @test ! (typemin (Int16) > FD {Int8, 2} (- 1 ) > typemax (Int16))
396
+
397
+ @test typemax (Int16) >= FD {Int8, 0} (0 ) >= typemin (Int16)
398
+ @test typemax (Int16) >= FD {Int8, 2} (0 ) >= typemin (Int16)
399
+ @test typemin (Int16) <= FD {Int8, 0} (0 ) <= typemax (Int16)
400
+ @test typemin (Int16) <= FD {Int8, 2} (0 ) <= typemax (Int16)
401
+ @test ! (typemax (Int16) <= FD {Int8, 0} (- 1 ) <= typemin (Int16))
402
+ @test ! (typemax (Int16) <= FD {Int8, 2} (- 1 ) <= typemin (Int16))
403
+ @test ! (typemin (Int16) >= FD {Int8, 0} (- 1 ) >= typemax (Int16))
404
+ @test ! (typemin (Int16) >= FD {Int8, 2} (- 1 ) >= typemax (Int16))
405
+ end
350
406
end
351
407
352
408
@testset " 128-bit conversion correctness" begin
0 commit comments