aboutsummaryrefslogtreecommitdiff
path: root/tests/math.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-01-26 20:20:12 -0800
committerBruce Hill <bitbucket@bruce-hill.com>2018-01-26 20:20:38 -0800
commit90c56d31352a0eeccd382ef5921baf3af4971040 (patch)
tree5167eafb5785c94b48458b18b0454222ca70c749 /tests/math.nom
parentd5aa4e52983712f9f4c5b23528d0c2dab12b0b33 (diff)
Added a ton of tests for virtually all the functionality. Helped me find
and fix a lot of latent problems.
Diffstat (limited to 'tests/math.nom')
-rw-r--r--tests/math.nom17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/math.nom b/tests/math.nom
new file mode 100644
index 0000000..245fe52
--- /dev/null
+++ b/tests/math.nom
@@ -0,0 +1,17 @@
+#..
+ Tests for the stuff defined in lib/control_flow.nom
+
+use "lib/core.nom"
+
+assume (all of [inf, pi, tau, golden ratio, e]) or barf "math constants failed"
+%nan <- (NaN)
+assume (%nan != %nan) or barf "NaN failed"
+assume (("5" as a number) = 5)
+assume
+ all of [..]
+ abs 5, |5|, sqrt 5, √(5), sine 5, cosine 5, tangent 5, arc sine 5, arc cosine 5,
+ arc tangent 5, arc tangent 5/10, hyperbolic sine 5, hyperbolic cosine 5,
+ hyperbolic tangent 5, e^5, ln 5, log_(2) 5, floor 5, ceiling 5, round 5,
+..or barf "math functions failed"
+assume ((463 to the nearest 100) = 500) or barf "rounding failed"
+assume ((2.6 to the nearest 0.25) = 2.5) or barf "rounding failed"