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, 24 insertions, 16 deletions
diff --git a/stdlib/source/test/lux/data/number/frac.lux b/stdlib/source/test/lux/data/number/frac.lux
index ca3d4d21c..b9669756d 100644
--- a/stdlib/source/test/lux/data/number/frac.lux
+++ b/stdlib/source/test/lux/data/number/frac.lux
@@ -10,7 +10,9 @@
["$." monoid]
["$." codec]]}]
[data
- ["." bit ("#\." equivalence)]]
+ ["." bit ("#\." equivalence)]
+ [text
+ ["%" format (#+ format)]]]
[math
["." random (#+ Random)]]]
{1
@@ -32,14 +34,15 @@
($equivalence.spec /.equivalence random.safe-frac))
(_.with-cover [/.order /.<]
($order.spec /.order random.safe-frac))
- (~~ (template [<monoid> <compose>]
+ (~~ (template [<compose> <monoid>]
[(_.with-cover [<monoid> <compose>]
($monoid.spec /.equivalence <monoid> ..random))]
- [/.addition /.+]
- [/.multiplication /.*]
- [/.minimum /.min]
- [/.maximum /.max]
+ [/.+ /.addition]
+ [/.* /.multiplication]
+
+ [/.min /.minimum]
+ [/.max /.maximum]
))
(~~ (template [<codec>]
[(_.with-cover [<codec>]
@@ -161,16 +164,21 @@
(/.* (/.signum sample) sample)))))
(do random.monad
[expected random.frac]
- ($_ _.and
- (_.cover [/.to-bits /.from-bits]
- (let [actual (|> expected /.to-bits /.from-bits)]
- (or (/.= expected actual)
- (and (/.not-a-number? expected)
- (/.not-a-number? actual)))))
- (_.cover [/.negate]
- (and (/.= +0.0 (/.+ (/.negate expected) expected))
- (|> expected /.negate /.negate (/.= expected))))
- ))
+ (_.cover [/.to-bits /.from-bits]
+ (let [actual (|> expected /.to-bits /.from-bits)]
+ (or (/.= expected actual)
+ (and (/.not-a-number? expected)
+ (/.not-a-number? actual))))))
+ (do random.monad
+ [expected random.safe-frac]
+ (_.cover [/.negate]
+ (let [subtraction!
+ (/.= +0.0 (/.+ (/.negate expected) expected))
+
+ inverse!
+ (|> expected /.negate /.negate (/.= expected))]
+ (and subtraction!
+ inverse!))))
..signature
..constant