aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux.lux')
-rw-r--r--stdlib/source/test/lux.lux93
1 files changed, 93 insertions, 0 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index dffa24069..e7ad9d03c 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -619,6 +619,98 @@
(text\= static_char)))
)))
+(type: Small
+ {#small_left Nat
+ #small_right Text})
+
+(type: Big
+ {#big_left Nat
+ #big_right Small})
+
+(def: for_slot
+ Test
+ (do random.monad
+ [start/s random.nat
+ start/b random.nat
+ shift/s random.nat
+ shift/b random.nat
+ text (random.ascii/lower 1)
+ #let [expected/s (n.+ shift/s start/s)
+ expected/b (n.+ shift/b start/b)
+
+ sample {#big_left start/b
+ #big_right {#small_left start/s
+ #small_right text}}]]
+ ($_ _.and
+ (_.cover [/.get@]
+ (and (and (|> sample
+ (/.get@ #big_left)
+ (is? start/b))
+ (|> sample
+ ((/.get@ #big_left))
+ (is? start/b)))
+ (and (|> sample
+ (/.get@ [#big_right #small_left])
+ (is? start/s))
+ (|> sample
+ ((/.get@ [#big_right #small_left]))
+ (is? start/s)))))
+ (_.cover [/.set@]
+ (and (and (|> sample
+ (/.set@ #big_left shift/b)
+ (/.get@ #big_left)
+ (is? shift/b))
+ (|> sample
+ ((/.set@ #big_left shift/b))
+ (/.get@ #big_left)
+ (is? shift/b))
+ (|> sample
+ ((/.set@ #big_left) shift/b)
+ (/.get@ #big_left)
+ (is? shift/b)))
+ (and (|> sample
+ (/.set@ [#big_right #small_left] shift/s)
+ (/.get@ [#big_right #small_left])
+ (is? shift/s))
+ (|> sample
+ ((/.set@ [#big_right #small_left] shift/s))
+ (/.get@ [#big_right #small_left])
+ (is? shift/s))
+ (|> sample
+ ((/.set@ [#big_right #small_left]) shift/s)
+ (/.get@ [#big_right #small_left])
+ (is? shift/s)))))
+ (_.cover [/.update@]
+ (and (and (|> sample
+ (/.update@ #big_left (n.+ shift/b))
+ (/.get@ #big_left)
+ (n.= expected/b))
+ (|> sample
+ ((/.update@ #big_left (n.+ shift/b)))
+ (/.get@ #big_left)
+ (n.= expected/b))
+ (|> sample
+ ((: (-> (-> Nat Nat) (-> Big Big))
+ (/.update@ #big_left))
+ (n.+ shift/b))
+ (/.get@ #big_left)
+ (n.= expected/b)))
+ (and (|> sample
+ (/.update@ [#big_right #small_left] (n.+ shift/s))
+ (/.get@ [#big_right #small_left])
+ (n.= expected/s))
+ (|> sample
+ ((/.update@ [#big_right #small_left] (n.+ shift/s)))
+ (/.get@ [#big_right #small_left])
+ (n.= expected/s))
+ (|> sample
+ ((: (-> (-> Nat Nat) (-> Big Big))
+ (/.update@ [#big_right #small_left]))
+ (n.+ shift/s))
+ (/.get@ [#big_right #small_left])
+ (n.= expected/s)))))
+ )))
+
(def: test
Test
(<| (_.covering /._)
@@ -645,6 +737,7 @@
..for_function
..for_template
..for_static
+ ..for_slot
..sub_tests
)))