diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux.lux | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index cfc562686..8bd3a1ee5 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -1,4 +1,4 @@ -(;module: +(.module: lux lux/test (lux (control ["M" monad #+ do Monad]) @@ -14,9 +14,9 @@ (context: "Value identity." (<| (times +100) (do @ - [size (|> r;nat (:: @ map (|>> (n/% +100) (n/max +10)))) - x (r;text size) - y (r;text size)] + [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10)))) + x (r.text size) + y (r.text size)] ($_ seq (test "Every value is identical to itself, and the 'id' function doesn't change values in any way." (and (is x x) @@ -52,8 +52,8 @@ (and (|> value inc even?) (|> value dec even?)))))))] - ["Nat" r;nat n/inc n/dec n/even? n/odd? n/= n/< n/>] - ["Int" r;int i/inc i/dec i/even? i/odd? i/= i/< i/>] + ["Nat" r.nat n/inc n/dec n/even? n/odd? n/= n/< n/>] + ["Int" r.int i/inc i/dec i/even? i/odd? i/= i/< i/>] ) (do-template [category rand-gen = < > <= >= min max] @@ -80,10 +80,10 @@ (>= y (max x y))) )))))] - ["Int" r;int i/= i/< i/> i/<= i/>= i/min i/max] - ["Nat" r;nat n/= n/< n/> n/<= n/>= n/min n/max] - ["Frac" r;frac f/= f/< f/> f/<= f/>= f/min f/max] - ["Deg" r;deg d/= d/< d/> d/<= d/>= d/min d/max] + ["Int" r.int i/= i/< i/> i/<= i/>= i/min i/max] + ["Nat" r.nat n/= n/< n/> n/<= n/>= n/min n/max] + ["Frac" r.frac f/= f/< f/> f/<= f/>= f/min f/max] + ["Deg" r.deg d/= d/< d/> d/<= d/>= d/min d/max] ) (do-template [category rand-gen = + - * / <%> > <0> <1> <factor> %x <cap> <prep>] @@ -124,7 +124,7 @@ [x (:: @ map <cap> rand-gen) y (|> rand-gen (:: @ map <cap>) - (r;filter (|>> (= <0>) not))) + (r.filter (|>> (= <0>) not))) #let [r (<%> y x) x' (- r x)]] (test "" @@ -136,10 +136,10 @@ (|> x' (/ y) (* y) (= x')))) ))))] - ["Nat" r;nat n/= n/+ n/- n/* n// n/% n/> +0 +1 +1000000 %n (n/% +1000) id] - ["Int" r;int i/= i/+ i/- i/* i// i/% i/> 0 1 1000000 %i (i/% 1000) id] - ["Frac" r;frac f/= f/+ f/- f/* f// f/% f/> 0.0 1.0 1000000.0 %r id math;floor] - ["Deg" r;deg d/= d/+ d/- d/* d// d/% d/> .0 ("lux deg max") ("lux deg max") %f id id] + ["Nat" r.nat n/= n/+ n/- n/* n// n/% n/> +0 +1 +1000000 %n (n/% +1000) id] + ["Int" r.int i/= i/+ i/- i/* i// i/% i/> 0 1 1000000 %i (i/% 1000) id] + ["Frac" r.frac f/= f/+ f/- f/* f// f/% f/> 0.0 1.0 1000000.0 %r id math.floor] + ["Deg" r.deg d/= d/+ d/- d/* d// d/% d/> .0 ("lux deg max") ("lux deg max") %f id id] ) (do-template [category rand-gen -> <- = <cap> %a %z] @@ -151,11 +151,11 @@ (test "" (|> value -> <- (= value))))))] - ["Int->Nat" r;int int-to-nat nat-to-int i/= (i/% 1000000) %i %n] - ["Nat->Int" r;nat nat-to-int int-to-nat n/= (n/% +1000000) %n %i] - ["Int->Frac" r;int int-to-frac frac-to-int i/= (i/% 1000000) %i %r] - ["Frac->Int" r;frac frac-to-int int-to-frac f/= math;floor %r %i] - ## [r;frac frac-to-deg deg-to-frac f/= (f/% 1.0) %r %f] + ["Int->Nat" r.int int-to-nat nat-to-int i/= (i/% 1000000) %i %n] + ["Nat->Int" r.nat nat-to-int int-to-nat n/= (n/% +1000000) %n %i] + ["Int->Frac" r.int int-to-frac frac-to-int i/= (i/% 1000000) %i %r] + ["Frac->Int" r.frac frac-to-int int-to-frac f/= math.floor %r %i] + ## [r.frac frac-to-deg deg-to-frac f/= (f/% 1.0) %r %f] ) (context: "Simple macros and constructs" @@ -170,25 +170,25 @@ (test "Can create lists easily through macros." (and (case (list 1 2 3) - (#;Cons 1 (#;Cons 2 (#;Cons 3 #;Nil))) + (#.Cons 1 (#.Cons 2 (#.Cons 3 #.Nil))) true _ false) (case (list& 1 2 3 (list 4 5 6)) - (#;Cons 1 (#;Cons 2 (#;Cons 3 (#;Cons 4 (#;Cons 5 (#;Cons 6 #;Nil)))))) + (#.Cons 1 (#.Cons 2 (#.Cons 3 (#.Cons 4 (#.Cons 5 (#.Cons 6 #.Nil)))))) true _ false))) (test "Can have defaults for Maybe values." - (and (is "yolo" (maybe;default "yolo" - #;None)) + (and (is "yolo" (maybe.default "yolo" + #.None)) - (is "lol" (maybe;default "yolo" - (#;Some "lol"))))) + (is "lol" (maybe.default "yolo" + (#.Some "lol"))))) )) (template: (hypotenuse x y) @@ -197,8 +197,8 @@ (context: "Templates." (<| (times +100) (do @ - [x r;int - y r;int] + [x r.int + y r.int] (test "Template application is a stand-in for the templated code." (i/= (i/+ (i/* x x) (i/* y y)) (hypotenuse x y)))))) |