aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux.lux53
1 files changed, 27 insertions, 26 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 580c02d2e..e99cdb85a 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -20,6 +20,7 @@
["." name]
[number
["." i64]
+ ["n" nat]
["i" int]
["r" rev]
["f" frac]]]
@@ -157,11 +158,11 @@
[value random.i64]
($_ _.and
(_.test "'inc' and 'dec' are opposites."
- (and (|> value inc dec (n/= value))
- (|> value dec inc (n/= value))))
+ (and (|> value inc dec (n.= value))
+ (|> value dec inc (n.= value))))
(_.test "'inc' and 'dec' shift the number by 1."
- (and (|> (inc value) (n/- value) (n/= 1))
- (|> value (n/- (dec value)) (n/= 1)))))))
+ (and (|> (inc value) (n.- value) (n.= 1))
+ (|> value (n.- (dec value)) (n.= 1)))))))
(def: (check-neighbors has-property? value)
(All [a] (-> (Predicate (I64 a)) (I64 a) Bit))
@@ -230,15 +231,15 @@
Test
($_ _.and
(do random.monad
- [factor (random@map (|>> (n/% 10) (n/max 1)) random.nat)
- iterations (random@map (n/% 100) random.nat)
- #let [expected (n/* factor iterations)]]
+ [factor (random@map (|>> (n.% 10) (n.max 1)) random.nat)
+ iterations (random@map (n.% 100) random.nat)
+ #let [expected (n.* factor iterations)]]
(_.test "Can write loops."
- (n/= expected
+ (n.= expected
(loop [counter 0
value 0]
- (if (n/< iterations counter)
- (recur (inc counter) (n/+ factor value))
+ (if (n.< iterations counter)
+ (recur (inc counter) (n.+ factor value))
value)))))
(do random.monad
@@ -248,32 +249,32 @@
(_.test "Can create lists easily through macros."
(and (case (list first second third)
(#.Cons first' (#.Cons second' (#.Cons third' #.Nil)))
- (and (n/= first first')
- (n/= second second')
- (n/= third third'))
+ (and (n.= first first')
+ (n.= second second')
+ (n.= third third'))
_
false)
(case (list& first (list second third))
(#.Cons first' (#.Cons second' (#.Cons third' #.Nil)))
- (and (n/= first first')
- (n/= second second')
- (n/= third third'))
+ (and (n.= first first')
+ (n.= second second')
+ (n.= third third'))
_
false)
(case (list& first second (list third))
(#.Cons first' (#.Cons second' (#.Cons third' #.Nil)))
- (and (n/= first first')
- (n/= second second')
- (n/= third third'))
+ (and (n.= first first')
+ (n.= second second')
+ (n.= third third'))
_
false))))
))
(template: (quadrance cat0 cat1)
- (n/+ (n/* cat0 cat0) (n/* cat1 cat1)))
+ (n.+ (n.* cat0 cat0) (n.* cat1 cat1)))
(def: templates
Test
@@ -281,7 +282,7 @@
[cat0 random.nat
cat1 random.nat]
(_.test "Template application is a stand-in for the templated code."
- (n/= (n/+ (n/* cat0 cat0) (n/* cat1 cat1))
+ (n.= (n.+ (n.* cat0 cat0) (n.* cat1 cat1))
(quadrance cat0 cat1)))))
(def: cross-platform-support
@@ -292,11 +293,11 @@
on-valid-host random.nat]
($_ _.and
(_.test "Can provide default in case there is no particular host/platform support."
- (n/= on-default
+ (n.= on-default
(for {"" on-fake-host}
on-default)))
(_.test "Can pick code depending on the host/platform being targeted."
- (n/= on-valid-host
+ (n.= on-valid-host
(`` (for {(~~ (static @.old)) on-valid-host
(~~ (static @.jvm)) on-valid-host
(~~ (static @.js)) on-valid-host}
@@ -312,7 +313,7 @@
(<| (_.context "Even or odd.")
($_ _.and
(<| (_.context "Natural numbers.")
- (..even-or-odd random.nat n/even? n/odd?))
+ (..even-or-odd random.nat n.even? n.odd?))
(<| (_.context "Integers.")
(..even-or-odd random.int i.even? i.odd?))))
(<| (_.context "Minimum and maximum.")
@@ -322,7 +323,7 @@
(..minimum-and-maximum <gen> <=> [<lt> <min>] [<gt> <max>]))]
[i.= i.< i.min i.> i.max random.int "Integers."]
- [n/= n/< n/min n/> n/max random.nat "Natural numbers."]
+ [n.= n.< n.min n.> n.max random.nat "Natural numbers."]
[r.= r.< r.min r.> r.max random.rev "Revolutions."]
[f.= f.< f.min f.> f.max random.safe-frac "Fractions."]
)))))
@@ -334,7 +335,7 @@
(..conversion <gen> <forward> <backward> <=>))]
[i.= .nat .int (random@map (i.% +1,000,000) random.int)]
- [n/= .int .nat (random@map (n/% 1,000,000) random.nat)]
+ [n.= .int .nat (random@map (n.% 1,000,000) random.nat)]
[i.= i.frac f.int (random@map (i.% +1,000,000) random.int)]
[f.= f.int i.frac (random@map (|>> (i.% +1,000,000) i.frac) random.int)]
[r.= r.frac f.rev frac-rev]