aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/control/function.lux4
-rw-r--r--stdlib/source/test/lux/control/function/inline.lux32
2 files changed, 35 insertions, 1 deletions
diff --git a/stdlib/source/test/lux/control/function.lux b/stdlib/source/test/lux/control/function.lux
index d9444edd1..eed6c9635 100644
--- a/stdlib/source/test/lux/control/function.lux
+++ b/stdlib/source/test/lux/control/function.lux
@@ -17,7 +17,8 @@
["[1][0]" contract]
["[1][0]" memo]
["[1][0]" mixin]
- ["[1][0]" mutual]])
+ ["[1][0]" mutual]
+ ["[1][0]" inline]])
(def: .public test
Test
@@ -62,4 +63,5 @@
/memo.test
/mixin.test
/mutual.test
+ /inline.test
))))
diff --git a/stdlib/source/test/lux/control/function/inline.lux b/stdlib/source/test/lux/control/function/inline.lux
new file mode 100644
index 000000000..7c05e39e0
--- /dev/null
+++ b/stdlib/source/test/lux/control/function/inline.lux
@@ -0,0 +1,32 @@
+(.using
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]]
+ [math
+ ["[0]" random]
+ [number
+ ["i" int]]]]]
+ [\\library
+ ["[0]" /]])
+
+(template: (!quadrance/2 m0 m1)
+ [(i.+ (i.* m0 m0) (i.* m1 m1))])
+
+(/.inline: .public (quadrance/2 m0 m1)
+ (-> Int Int Int)
+ (!quadrance/2 m0 m1))
+
+(def: .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [.let [measurement (# ! each (i.% +1000) random.int)]
+ m0 measurement
+ m1 measurement])
+ ($_ _.and
+ (_.cover [/.inline:]
+ (i.= (..!quadrance/2 m0 m1)
+ (..quadrance/2 m0 m1)))
+ )))