aboutsummaryrefslogtreecommitdiff
path: root/stdlib/test
diff options
context:
space:
mode:
authorEduardo Julian2017-01-25 07:03:10 -0400
committerEduardo Julian2017-01-25 07:03:10 -0400
commit79eef70a52ae4aa8f09979e9be15d091b4fdefa4 (patch)
tree6317627854abad1349863122d645eb090ec4717f /stdlib/test
parentf8c2389db4a9b3239b00b9d209237d5116e12e3c (diff)
- Added a module for continuous logic.
Diffstat (limited to 'stdlib/test')
-rw-r--r--stdlib/test/test/lux/math/logic/continuous.lux38
-rw-r--r--stdlib/test/tests.lux3
2 files changed, 40 insertions, 1 deletions
diff --git a/stdlib/test/test/lux/math/logic/continuous.lux b/stdlib/test/test/lux/math/logic/continuous.lux
new file mode 100644
index 000000000..883d54a06
--- /dev/null
+++ b/stdlib/test/test/lux/math/logic/continuous.lux
@@ -0,0 +1,38 @@
+## Copyright (c) Eduardo Julian. All rights reserved.
+## This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
+## If a copy of the MPL was not distributed with this file,
+## You can obtain one at http://mozilla.org/MPL/2.0/.
+
+(;module:
+ lux
+ (lux (codata [io])
+ (control monad)
+ (codata function)
+ ["R" random]
+ pipe
+ ["&" math/logic/continuous])
+ lux/test)
+
+(test: "Operations"
+ [left R;deg
+ right R;deg]
+ ($_ seq
+ (assert "AND is the minimum."
+ (let [result (&;and~ left right)]
+ (and (d.<= left result)
+ (d.<= right result))))
+
+ (assert "OR is the maximum."
+ (let [result (&;or~ left right)]
+ (and (d.>= left result)
+ (d.>= right result))))
+
+ (assert "Double negation results in the original value."
+ (d.= left (&;not~ (&;not~ left))))
+
+ (assert "Every value is equivalent to itself."
+ (and (d.>= left
+ (&;=~ left left))
+ (d.>= right
+ (&;=~ right right))))
+ ))
diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux
index 8e0c165c1..fdcf01457 100644
--- a/stdlib/test/tests.lux
+++ b/stdlib/test/tests.lux
@@ -56,7 +56,8 @@
(math ["_;" ratio]
["_;" complex]
## ["_;" random]
- ["_;" simple])
+ ["_;" simple]
+ (logic ["_;" continuous]))
## ["_;" macro]
(macro ["_;" ast]
["_;" syntax]