aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/number/nat.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/data/number/nat.lux')
-rw-r--r--stdlib/source/test/lux/data/number/nat.lux55
1 files changed, 55 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/data/number/nat.lux b/stdlib/source/test/lux/data/number/nat.lux
new file mode 100644
index 000000000..e570de094
--- /dev/null
+++ b/stdlib/source/test/lux/data/number/nat.lux
@@ -0,0 +1,55 @@
+(.module:
+ [lux #*
+ data/text/format
+ ["_" test (#+ Test)]
+ [control
+ [monad (#+ do)]
+ {[0 #test]
+ [/
+ ["$." equivalence]
+ ["$." order]
+ ["$." number]
+ ["$." enum]
+ ["$." interval]
+ ["$." monoid]
+ ["$." codec]]}]
+ [math
+ ["r" random]]]
+ {1
+ ["." /
+ //]})
+
+(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))
+
+ (_.test "Alternate notations."
+ (and (n/= (bin "11001001")
+ (bin "11,00,10,01"))
+ (n/= (oct "615243")
+ (oct "615,243"))
+ (n/= (hex "deadBEEF")
+ (hex "dead,BEEF"))))
+ )))