aboutsummaryrefslogtreecommitdiff
path: root/stdlib/test
diff options
context:
space:
mode:
authorEduardo Julian2018-07-30 23:40:48 -0400
committerEduardo Julian2018-07-30 23:40:48 -0400
commit748c868680683df1949f62aac274040ac5bf43da (patch)
tree67b3bd8fb402dfd00fc0ee472186fc79e6545ac7 /stdlib/test
parent76b47564f89bac5eb6604da7bbb94aabb83d6d84 (diff)
Now implementing math functionality in stdlib instead of the compiler.
Diffstat (limited to 'stdlib/test')
-rw-r--r--stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux31
-rw-r--r--stdlib/test/test/lux/math.lux15
2 files changed, 8 insertions, 38 deletions
diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux
index 5fc04278b..8d3e8b8fa 100644
--- a/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux
+++ b/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux
@@ -207,37 +207,6 @@
(` ("lux array size" (~ g!array)))))
))))
-(context: "Math procedures"
- (<| (times 100)
- (do @
- [subjectC (|> r.frac (:: @ map code.frac))
- paramC (|> r.frac (:: @ map code.frac))]
- (`` ($_ seq
- (~~ (do-template [<proc> <desc>]
- [(test (format "Can calculate " <desc> ".")
- (check-success+ <proc> (list subjectC) Frac))]
-
- ["lux math cos" "cosine"]
- ["lux math sin" "sine"]
- ["lux math tan" "tangent"]
- ["lux math acos" "inverse/arc cosine"]
- ["lux math asin" "inverse/arc sine"]
- ["lux math atan" "inverse/arc tangent"]
- ["lux math cosh" "hyperbolic cosine"]
- ["lux math sinh" "hyperbolic sine"]
- ["lux math tanh" "hyperbolic tangent"]
- ["lux math exp" "exponentiation"]
- ["lux math log" "logarithm"]
- ["lux math ceil" "ceiling"]
- ["lux math floor" "floor"]
- ["lux math round" "rounding"]))
- (~~ (do-template [<proc> <desc>]
- [(test (format "Can calculate " <desc> ".")
- (check-success+ <proc> (list subjectC paramC) Frac))]
-
- ["lux math atan2" "inverse/arc tangent (with 2 arguments)"]
- ["lux math pow" "power"])))))))
-
(context: "Atom procedures"
(<| (times 100)
(do @
diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux
index 4cdb8eed5..059f19c4c 100644
--- a/stdlib/test/test/lux/math.lux
+++ b/stdlib/test/test/lux/math.lux
@@ -6,6 +6,7 @@
[bit ("bit/." Equivalence<Bit>)]
[number ("frac/." Number<Frac>)]]
["&" math
+ infix
["r" random]]]
lux/test)
@@ -98,27 +99,27 @@
($_ seq
(test "Constant values don't change."
(n/= x
- (&.infix x)))
+ (infix x)))
(test "Can call binary functions."
(n/= (&.n/gcd y x)
- (&.infix [x &.n/gcd y])))
+ (infix [x &.n/gcd y])))
(test "Can call unary functions."
(f/= (&.sin theta)
- (&.infix [&.sin theta])))
+ (infix [&.sin theta])))
(test "Can use regular syntax in the middle of infix code."
(n/= (&.n/gcd 450 (n/* 3 9))
- (&.infix [(n/* 3 9) &.n/gcd 450])))
+ (infix [(n/* 3 9) &.n/gcd 450])))
(test "Can use non-numerical functions/macros as operators."
(bit/= (and (n/< y x) (n/< z y))
- (&.infix [[x n/< y] and [y n/< z]])))
+ (infix [[x n/< y] and [y n/< z]])))
(test "Can combine bit operations in special ways via special keywords."
(and (bit/= (and (n/< y x) (n/< z y))
- (&.infix [#and x n/< y n/< z]))
+ (infix [#and x n/< y n/< z]))
(bit/= (and (n/< y x) (n/> z y))
- (&.infix [#and x n/< y n/> z]))))
+ (infix [#and x n/< y n/> z]))))
))))