diff options
Diffstat (limited to 'stdlib/source/test/lux/data/number/nat.lux')
-rw-r--r-- | stdlib/source/test/lux/data/number/nat.lux | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/stdlib/source/test/lux/data/number/nat.lux b/stdlib/source/test/lux/data/number/nat.lux index e570de094..17ee0503b 100644 --- a/stdlib/source/test/lux/data/number/nat.lux +++ b/stdlib/source/test/lux/data/number/nat.lux @@ -21,35 +21,31 @@ (def: #export test Test - (<| (_.context (%name (name-of .Nat))) - ($_ _.and - ($equivalence.spec /.equivalence r.nat) - ($order.spec /.order r.nat) - ($number.spec /.order /.number r.nat) - ($enum.spec /.enum r.nat) - ($interval.spec /.interval r.nat) - (<| (_.context "Addition.") - ($monoid.spec /.equivalence /.addition r.nat)) - (<| (_.context "Multiplication.") - ($monoid.spec /.equivalence /.multiplication r.nat)) - (<| (_.context "Minimum.") - ($monoid.spec /.equivalence /.minimum r.nat)) - (<| (_.context "Maximum.") - ($monoid.spec /.equivalence /.multiplication r.nat)) - (<| (_.context "Binary.") - ($codec.spec /.equivalence /.binary r.nat)) - (<| (_.context "Octal.") - ($codec.spec /.equivalence /.octal r.nat)) - (<| (_.context "Decimal.") - ($codec.spec /.equivalence /.decimal r.nat)) - (<| (_.context "Hexadecimal.") - ($codec.spec /.equivalence /.hex r.nat)) + (<| (_.context (%name (name-of /._))) + (`` ($_ _.and + ($equivalence.spec /.equivalence r.nat) + ($order.spec /.order r.nat) + ($number.spec /.order /.number (:: r.monad map (n/% 1,000,000) r.nat)) + ($enum.spec /.enum r.nat) + ($interval.spec /.interval r.nat) + (~~ (do-template [<monoid>] + [(<| (_.context (%name (name-of <monoid>))) + ($monoid.spec /.equivalence <monoid> r.nat))] - (_.test "Alternate notations." - (and (n/= (bin "11001001") - (bin "11,00,10,01")) - (n/= (oct "615243") - (oct "615,243")) - (n/= (hex "deadBEEF") - (hex "dead,BEEF")))) - ))) + [/.addition] [/.multiplication] [/.minimum] [/.maximum] + )) + (~~ (do-template [<codec>] + [(<| (_.context (%name (name-of /.binary))) + ($codec.spec /.equivalence <codec> r.nat))] + + [/.binary] [/.octal] [/.decimal] [/.hex] + )) + + (_.test "Alternate notations." + (and (n/= (bin "11001001") + (bin "11,00,10,01")) + (n/= (oct "615243") + (oct "615,243")) + (n/= (hex "deadBEEF") + (hex "dead,BEEF")))) + )))) |