aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/number/frac.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/data/number/frac.lux40
1 files changed, 28 insertions, 12 deletions
diff --git a/stdlib/source/test/lux/data/number/frac.lux b/stdlib/source/test/lux/data/number/frac.lux
index 193b4a960..08fcef498 100644
--- a/stdlib/source/test/lux/data/number/frac.lux
+++ b/stdlib/source/test/lux/data/number/frac.lux
@@ -183,11 +183,19 @@
(/.mod left right))))))
))
(with-expansions [<jvm> ($_ _.and
- (do random.monad
- [expected random.frac]
- (_.cover [/.to-bits]
- (n.= (.nat (java/lang/Double::doubleToRawLongBits expected))
- (/.to-bits expected))))
+ (let [test (: (-> Frac Bit)
+ (function (_ value)
+ (n.= (.nat (java/lang/Double::doubleToRawLongBits value))
+ (/.to-bits value))))]
+ (do random.monad
+ [sample random.frac]
+ (_.cover [/.to-bits]
+ (and (test sample)
+ (test /.biggest)
+ (test /.smallest)
+ (test /.not-a-number)
+ (test /.positive-infinity)
+ (test /.negative-infinity)))))
(do random.monad
[sample random.i64]
(_.cover [/.from-bits]
@@ -199,13 +207,21 @@
)]
(for {@.old <jvm>
@.jvm <jvm>}
- (do random.monad
- [expected random.frac]
- (_.cover [/.to-bits /.from-bits]
- (let [actual (|> expected /.to-bits /.from-bits)]
- (or (/.= expected actual)
- (and (/.not-a-number? expected)
- (/.not-a-number? actual))))))))
+ (let [test (: (-> Frac Bit)
+ (function (_ expected)
+ (let [actual (|> expected /.to-bits /.from-bits)]
+ (or (/.= expected actual)
+ (and (/.not-a-number? expected)
+ (/.not-a-number? actual))))))]
+ (do random.monad
+ [sample random.frac]
+ (_.cover [/.to-bits /.from-bits]
+ (and (test sample)
+ (test /.biggest)
+ (test /.smallest)
+ (test /.not-a-number)
+ (test /.positive-infinity)
+ (test /.negative-infinity)))))))
(do random.monad
[expected random.safe-frac]
(_.cover [/.negate]