aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/target/lua.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/target/lua.lux746
1 files changed, 373 insertions, 373 deletions
diff --git a/stdlib/source/test/lux/target/lua.lux b/stdlib/source/test/lux/target/lua.lux
index 7d81b41f5..631b754f5 100644
--- a/stdlib/source/test/lux/target/lua.lux
+++ b/stdlib/source/test/lux/target/lua.lux
@@ -52,25 +52,25 @@
float random.frac
string (random.upper_case 5)]
(all _.and
- (_.cover [/.nil]
- (|> /.nil
- /.code
- ..load
- (pipe.case
- {.#None} true
- {.#Some _} false)))
- (_.cover [/.boolean]
- (expression (|>> (as Bit) (bit#= boolean))
- (/.boolean boolean)))
- (_.cover [/.int]
- (expression (|>> (as Int) (i.= int))
- (/.int int)))
- (_.cover [/.float]
- (expression (|>> (as Frac) (f.= float))
- (/.float float)))
- (_.cover [/.string]
- (expression (|>> (as Text) (text#= string))
- (/.string string)))
+ (_.coverage [/.nil]
+ (|> /.nil
+ /.code
+ ..load
+ (pipe.case
+ {.#None} true
+ {.#Some _} false)))
+ (_.coverage [/.boolean]
+ (expression (|>> (as Bit) (bit#= boolean))
+ (/.boolean boolean)))
+ (_.coverage [/.int]
+ (expression (|>> (as Int) (i.= int))
+ (/.int int)))
+ (_.coverage [/.float]
+ (expression (|>> (as Frac) (f.= float))
+ (/.float float)))
+ (_.coverage [/.string]
+ (expression (|>> (as Text) (text#= string))
+ (/.string string)))
)))
(def: test|boolean
@@ -80,17 +80,17 @@
right random.bit]
(`` (all _.and
(~~ (template [</> <lux>]
- [(_.cover [</>]
- (let [expected (<lux> left right)]
- (expression (|>> (as Bit) (bit#= expected))
- (</> (/.boolean left) (/.boolean right)))))]
+ [(_.coverage [</>]
+ (let [expected (<lux> left right)]
+ (expression (|>> (as Bit) (bit#= expected))
+ (</> (/.boolean left) (/.boolean right)))))]
[/.or .or]
[/.and .and]
))
- (_.cover [/.not]
- (expression (|>> (as Bit) (bit#= (not left)))
- (/.not (/.boolean left))))
+ (_.coverage [/.not]
+ (expression (|>> (as Bit) (bit#= (not left)))
+ (/.not (/.boolean left))))
))))
(template [<bits>]
@@ -115,35 +115,35 @@
subject random.int]
(`` (all _.and
(~~ (template [</> <lux>]
- [(_.cover [</>]
- (let [expected (<lux> left right)]
- (expression (|>> (as Int) (i.= expected))
- (</> (/.int left) (/.int right)))))]
+ [(_.coverage [</>]
+ (let [expected (<lux> left right)]
+ (expression (|>> (as Int) (i.= expected))
+ (</> (/.int left) (/.int right)))))]
[/.bit_or i64.or]
[/.bit_xor i64.xor]
[/.bit_and i64.and]
))
- (_.cover [/.opposite]
- (expression (|>> (as Int) (i.= (i.- left +0)))
- (/.opposite (/.int left))))
- (_.cover [/.bit_shl]
- (let [expected (i64.left_shifted shift left)]
- (expression (|>> (as Int) (i.= expected))
- (/.bit_shl (/.int (.int shift))
- (/.int left)))))
- (_.cover [/.bit_shr]
- (let [expected (i64.right_shifted shift left)]
- (expression (|>> (as Int) (i.= expected))
- (/.bit_shr (/.int (.int shift))
- (/.int left)))))
- (_.cover [/.//]
- (let [expected (if (or (i.= (i.signum parameter) (i.signum subject))
- (i.= +0 (i.% parameter subject)))
- (i./ parameter subject)
- (-- (i./ parameter subject)))]
- (expression (|>> (as Int) (i.= expected))
- (/.// (/.int parameter) (/.int subject)))))
+ (_.coverage [/.opposite]
+ (expression (|>> (as Int) (i.= (i.- left +0)))
+ (/.opposite (/.int left))))
+ (_.coverage [/.bit_shl]
+ (let [expected (i64.left_shifted shift left)]
+ (expression (|>> (as Int) (i.= expected))
+ (/.bit_shl (/.int (.int shift))
+ (/.int left)))))
+ (_.coverage [/.bit_shr]
+ (let [expected (i64.right_shifted shift left)]
+ (expression (|>> (as Int) (i.= expected))
+ (/.bit_shr (/.int (.int shift))
+ (/.int left)))))
+ (_.coverage [/.//]
+ (let [expected (if (or (i.= (i.signum parameter) (i.signum subject))
+ (i.= +0 (i.% parameter subject)))
+ (i./ parameter subject)
+ (-- (i./ parameter subject)))]
+ (expression (|>> (as Int) (i.= expected))
+ (/.// (/.int parameter) (/.int subject)))))
))))
(def: test|float
@@ -154,10 +154,10 @@
subject random.safe_frac]
(`` (all _.and
(~~ (template [</> <lux> <pre>]
- [(_.cover [</>]
- (let [expected (<lux> (<pre> parameter) (<pre> subject))]
- (expression (|>> (as Frac) (f.= expected))
- (</> (/.float (<pre> parameter)) (/.float (<pre> subject))))))]
+ [(_.coverage [</>]
+ (let [expected (<lux> (<pre> parameter) (<pre> subject))]
+ (expression (|>> (as Frac) (f.= expected))
+ (</> (/.float (<pre> parameter)) (/.float (<pre> subject))))))]
[/.+ f.+ |>]
[/.- f.- |>]
@@ -167,10 +167,10 @@
[/.^ f.pow f.abs]
))
(~~ (template [</> <lux>]
- [(_.cover [</>]
- (let [expected (<lux> parameter subject)]
- (expression (|>> (as Bit) (bit#= expected))
- (</> (/.float parameter) (/.float subject)))))]
+ [(_.coverage [</>]
+ (let [expected (<lux> parameter subject)]
+ (expression (|>> (as Bit) (bit#= expected))
+ (</> (/.float parameter) (/.float subject)))))]
[/.< f.<]
[/.<= f.<=]
@@ -187,10 +187,10 @@
right (random.lower_case 8)
.let [expected (format left right)]]
(all _.and
- (_.cover [/.concat]
- (expression (|>> (as Text) (text#= expected))
- (|> (/.string left)
- (/.concat (/.string right)))))
+ (_.coverage [/.concat]
+ (expression (|>> (as Text) (text#= expected))
+ (|> (/.string left)
+ (/.concat (/.string right)))))
)))
(def: test|array
@@ -203,17 +203,17 @@
(list.item index)
maybe.trusted)]]
(all _.and
- (_.cover [/.array /.item]
- (and (expression (|>> (as Frac) (f.= expected))
- (/.item (/.int (.int (++ index)))
- (/.array (list#each /.float items))))
- (expression (|>> (as Bit))
- (|> (/.array (list#each /.float items))
- (/.item (/.int (.int (++ size))))
- (/.= /.nil)))))
- (_.cover [/.length]
- (expression (|>> (as Int) (i.= (.int size)))
- (/.length (/.array (list#each /.float items)))))
+ (_.coverage [/.array /.item]
+ (and (expression (|>> (as Frac) (f.= expected))
+ (/.item (/.int (.int (++ index)))
+ (/.array (list#each /.float items))))
+ (expression (|>> (as Bit))
+ (|> (/.array (list#each /.float items))
+ (/.item (/.int (.int (++ size))))
+ (/.= /.nil)))))
+ (_.coverage [/.length]
+ (expression (|>> (as Int) (i.= (.int size)))
+ (/.length (/.array (list#each /.float items)))))
)))
(def: test|table
@@ -235,24 +235,24 @@
(random.upper_case 5))
method (random.upper_case 6)]
(all _.and
- (_.cover [/.table /.the]
- (and (expression (|>> (as Frac) (f.= expected))
- (/.the field (/.table (list [field (/.float expected)]))))
- (expression (|>> (as Bit))
- (|> (/.table (list [field (/.float expected)]))
- (/.the non_field)
- (/.= /.nil)))))
- (_.cover [/.do /.function]
- (expression (|>> (as Frac) (f.= expected))
- (|> (all /.then
- (/.local/1 $table (/.table (list [field (/.float expected)])))
- (/.function (/.the method $table) (list $self $arg)
- (/.if (/.= (/.float dummy) $arg)
- (/.return (/.the field $self))
- (/.return $arg)))
- (/.return (/.do method (list (/.float dummy)) $table)))
- (/.closure (list))
- (/.apply (list)))))
+ (_.coverage [/.table /.the]
+ (and (expression (|>> (as Frac) (f.= expected))
+ (/.the field (/.table (list [field (/.float expected)]))))
+ (expression (|>> (as Bit))
+ (|> (/.table (list [field (/.float expected)]))
+ (/.the non_field)
+ (/.= /.nil)))))
+ (_.coverage [/.do /.function]
+ (expression (|>> (as Frac) (f.= expected))
+ (|> (all /.then
+ (/.local/1 $table (/.table (list [field (/.float expected)])))
+ (/.function (/.the method $table) (list $self $arg)
+ (/.if (/.= (/.float dummy) $arg)
+ (/.return (/.the field $self))
+ (/.return $arg)))
+ (/.return (/.do method (list (/.float dummy)) $table)))
+ (/.closure (list))
+ (/.apply (list)))))
)))
(def: test|computation
@@ -275,33 +275,33 @@
..test|string
..test|array
..test|table
- (_.cover [/.type/1]
- (and (expression (|>> (as Text) (text#= "boolean"))
- (/.type/1 (/.boolean boolean)))
- (expression (|>> (as Text) (text#= "number"))
- (/.type/1 (/.int int)))
- (expression (|>> (as Text) (text#= "number"))
- (/.type/1 (/.float float)))
- (expression (|>> (as Text) (text#= "string"))
- (/.type/1 (/.string string)))
- (expression (|>> (as Text) (text#= "nil"))
- (/.type/1 /.nil))
- (expression (|>> (as Text) (text#= "table"))
- (/.type/1 (/.table (list [string (/.float float)]))))
- (expression (|>> (as Text) (text#= "table"))
- (/.type/1 (/.array (list (/.boolean boolean)
- (/.float float)
- (/.string string)))))
- ))
- (_.cover [/.require/1]
- (expression (|>> (as Int) (i.= (i.abs int)))
- (|> (/.require/1 (/.string "math"))
- (/.the "abs")
- (/.apply (list (/.int int))))))
- (_.cover [/.comment]
- (expression (|>> (as Frac) (f.= then))
- (/.comment comment
- (/.float then))))
+ (_.coverage [/.type/1]
+ (and (expression (|>> (as Text) (text#= "boolean"))
+ (/.type/1 (/.boolean boolean)))
+ (expression (|>> (as Text) (text#= "number"))
+ (/.type/1 (/.int int)))
+ (expression (|>> (as Text) (text#= "number"))
+ (/.type/1 (/.float float)))
+ (expression (|>> (as Text) (text#= "string"))
+ (/.type/1 (/.string string)))
+ (expression (|>> (as Text) (text#= "nil"))
+ (/.type/1 /.nil))
+ (expression (|>> (as Text) (text#= "table"))
+ (/.type/1 (/.table (list [string (/.float float)]))))
+ (expression (|>> (as Text) (text#= "table"))
+ (/.type/1 (/.array (list (/.boolean boolean)
+ (/.float float)
+ (/.string string)))))
+ ))
+ (_.coverage [/.require/1]
+ (expression (|>> (as Int) (i.= (i.abs int)))
+ (|> (/.require/1 (/.string "math"))
+ (/.the "abs")
+ (/.apply (list (/.int int))))))
+ (_.coverage [/.comment]
+ (expression (|>> (as Frac) (f.= then))
+ (/.comment comment
+ (/.float then))))
)))
(def: test|expression
@@ -325,33 +325,33 @@
.let [$foreign (/.var foreign)
$local (/.var local)]]
(all _.and
- (_.cover [/.var]
- (expression (|>> (as Frac) (f.= float/0))
- (|> (/.return $foreign)
- (/.closure (list $foreign))
- (/.apply (list (/.float float/0))))))
- (_.cover [/.let]
- (expression (|>> (as Frac) (f.= float/1))
- (|> (all /.then
- (/.let (list $local) (/.float float/1))
- (/.return $local))
- (/.closure (list $foreign))
- (/.apply (list (/.float float/0))))))
- (_.cover [/.local/1]
- (expression (|>> (as Frac) (f.= float/1))
- (|> (all /.then
- (/.local/1 $local (/.float float/1))
- (/.return $local))
- (/.closure (list $foreign))
- (/.apply (list (/.float float/0))))))
- (_.cover [/.local]
- (expression (|>> (as Frac) (f.= float/1))
- (|> (all /.then
- (/.local (list $local))
- (/.set (list $local) (/.float float/1))
- (/.return $local))
- (/.closure (list $foreign))
- (/.apply (list (/.float float/0))))))
+ (_.coverage [/.var]
+ (expression (|>> (as Frac) (f.= float/0))
+ (|> (/.return $foreign)
+ (/.closure (list $foreign))
+ (/.apply (list (/.float float/0))))))
+ (_.coverage [/.let]
+ (expression (|>> (as Frac) (f.= float/1))
+ (|> (all /.then
+ (/.let (list $local) (/.float float/1))
+ (/.return $local))
+ (/.closure (list $foreign))
+ (/.apply (list (/.float float/0))))))
+ (_.coverage [/.local/1]
+ (expression (|>> (as Frac) (f.= float/1))
+ (|> (all /.then
+ (/.local/1 $local (/.float float/1))
+ (/.return $local))
+ (/.closure (list $foreign))
+ (/.apply (list (/.float float/0))))))
+ (_.coverage [/.local]
+ (expression (|>> (as Frac) (f.= float/1))
+ (|> (all /.then
+ (/.local (list $local))
+ (/.set (list $local) (/.float float/1))
+ (/.return $local))
+ (/.closure (list $foreign))
+ (/.apply (list (/.float float/0))))))
)))
(def: test/location
@@ -365,43 +365,43 @@
$arg/1 (# ! each /.var (random.lower_case 12))
field (random.upper_case 10)]
(all _.and
- (_.cover [/.set]
- (expression (|>> (as Frac) (f.= (f.+ float/0 float/0)))
+ (_.coverage [/.set]
+ (expression (|>> (as Frac) (f.= (f.+ float/0 float/0)))
+ (|> (all /.then
+ (/.set (list $foreign) (/.+ $foreign $foreign))
+ (/.return $foreign))
+ (/.closure (list $foreign))
+ (/.apply (list (/.float float/0))))))
+ (_.coverage [/.multi]
+ (and (expression (|>> (as Frac) (f.= float/0))
+ (|> (all /.then
+ (/.set (list $arg/0 $arg/1) (/.multi (list (/.float float/0) (/.float float/1))))
+ (/.return $arg/0))
+ (/.closure (list))
+ (/.apply (list))))
+ (expression (|>> (as Frac) (f.= float/1))
+ (|> (all /.then
+ (/.set (list $arg/0 $arg/1) (/.multi (list (/.float float/0) (/.float float/1))))
+ (/.return $arg/1))
+ (/.closure (list))
+ (/.apply (list))))))
+ (_.coverage [/.Access]
+ (and (expression (|>> (as Frac) (f.= (f.+ float/0 float/0)))
+ (let [@ (/.item (/.int +1) $foreign)]
(|> (all /.then
- (/.set (list $foreign) (/.+ $foreign $foreign))
- (/.return $foreign))
+ (/.set (list $foreign) (/.array (list $foreign)))
+ (/.set (list @) (/.+ @ @))
+ (/.return @))
(/.closure (list $foreign))
(/.apply (list (/.float float/0))))))
- (_.cover [/.multi]
- (and (expression (|>> (as Frac) (f.= float/0))
- (|> (all /.then
- (/.set (list $arg/0 $arg/1) (/.multi (list (/.float float/0) (/.float float/1))))
- (/.return $arg/0))
- (/.closure (list))
- (/.apply (list))))
- (expression (|>> (as Frac) (f.= float/1))
- (|> (all /.then
- (/.set (list $arg/0 $arg/1) (/.multi (list (/.float float/0) (/.float float/1))))
- (/.return $arg/1))
- (/.closure (list))
- (/.apply (list))))))
- (_.cover [/.Access]
- (and (expression (|>> (as Frac) (f.= (f.+ float/0 float/0)))
- (let [@ (/.item (/.int +1) $foreign)]
- (|> (all /.then
- (/.set (list $foreign) (/.array (list $foreign)))
- (/.set (list @) (/.+ @ @))
- (/.return @))
- (/.closure (list $foreign))
- (/.apply (list (/.float float/0))))))
- (expression (|>> (as Frac) (f.= (f.+ float/0 float/0)))
- (let [@ (/.the field $foreign)]
- (|> (all /.then
- (/.set (list $foreign) (/.table (list [field $foreign])))
- (/.set (list @) (/.+ @ @))
- (/.return @))
- (/.closure (list $foreign))
- (/.apply (list (/.float float/0))))))))
+ (expression (|>> (as Frac) (f.= (f.+ float/0 float/0)))
+ (let [@ (/.the field $foreign)]
+ (|> (all /.then
+ (/.set (list $foreign) (/.table (list [field $foreign])))
+ (/.set (list @) (/.+ @ @))
+ (/.return @))
+ (/.closure (list $foreign))
+ (/.apply (list (/.float float/0))))))))
(_.for [/.Var]
..test/var)
)))
@@ -423,77 +423,77 @@
.let [expected (i.* expected_iterations input)
expected_iterations (/.int expected_iterations)]]
(all _.and
- (_.cover [/.break]
- (let [=for_in (expression (|>> (as Int) (i.= expected))
- (|> (all /.then
- (/.local/1 $output (/.int +0))
- (/.for_in (list $index $input) (/.ipairs/1 (/.array (list.repeated full_iterations $input)))
- (all /.then
- (/.when (/.> expected_iterations $index)
- /.break)
- (/.set (list $output) (/.+ $input $output))))
- (/.return $output))
- (/.closure (list $input))
- (/.apply (list (/.int input)))))
-
- full_iterations (/.int (.int full_iterations))
- =while (expression (|>> (as Int) (i.= expected))
- (|> (all /.then
- (/.local/1 $index (/.int +0))
- (/.local/1 $output (/.int +0))
- (/.while (/.< full_iterations $index)
- (all /.then
- (/.when (/.= expected_iterations $index)
- /.break)
- (/.set (list $output) (/.+ $input $output))
- (/.set (list $index) (/.+ (/.int +1) $index))
- ))
- (/.return $output))
- (/.closure (list $input))
- (/.apply (list (/.int input)))))
- =repeat (expression (|>> (as Int) (i.= expected))
- (|> (all /.then
- (/.local/1 $index (/.int +0))
- (/.local/1 $output (/.int +0))
- (/.repeat (/.= full_iterations $index)
- (all /.then
- (/.when (/.= expected_iterations $index)
- /.break)
- (/.set (list $output) (/.+ $input $output))
- (/.set (list $index) (/.+ (/.int +1) $index))
- ))
- (/.return $output))
- (/.closure (list $input))
- (/.apply (list (/.int input)))))
- =for_step (expression (|>> (as Int) (i.= expected))
- (|> (all /.then
- (/.local/1 $output (/.int +0))
- (/.for_step $index (/.int +0) full_iterations (/.int +1)
- (all /.then
- (/.when (/.= expected_iterations $index)
- /.break)
- (/.set (list $output) (/.+ $input $output))))
- (/.return $output))
- (/.closure (list $input))
- (/.apply (list (/.int input)))))]
- (and =while
- =repeat
- =for_step
- =for_in)))
- (_.cover [/.label /.set_label /.go_to]
- (expression (|>> (as Int) (i.= expected))
- (|> (all /.then
- (/.local/1 $index (/.int +0))
- (/.local/1 $output (/.int +0))
- (/.set_label @loop)
- (/.if (/.< expected_iterations $index)
- (all /.then
- (/.set (list $output) (/.+ $input $output))
- (/.set (list $index) (/.+ (/.int +1) $index))
- (/.go_to @loop))
- (/.return $output)))
- (/.closure (list $input))
- (/.apply (list (/.int input))))))
+ (_.coverage [/.break]
+ (let [=for_in (expression (|>> (as Int) (i.= expected))
+ (|> (all /.then
+ (/.local/1 $output (/.int +0))
+ (/.for_in (list $index $input) (/.ipairs/1 (/.array (list.repeated full_iterations $input)))
+ (all /.then
+ (/.when (/.> expected_iterations $index)
+ /.break)
+ (/.set (list $output) (/.+ $input $output))))
+ (/.return $output))
+ (/.closure (list $input))
+ (/.apply (list (/.int input)))))
+
+ full_iterations (/.int (.int full_iterations))
+ =while (expression (|>> (as Int) (i.= expected))
+ (|> (all /.then
+ (/.local/1 $index (/.int +0))
+ (/.local/1 $output (/.int +0))
+ (/.while (/.< full_iterations $index)
+ (all /.then
+ (/.when (/.= expected_iterations $index)
+ /.break)
+ (/.set (list $output) (/.+ $input $output))
+ (/.set (list $index) (/.+ (/.int +1) $index))
+ ))
+ (/.return $output))
+ (/.closure (list $input))
+ (/.apply (list (/.int input)))))
+ =repeat (expression (|>> (as Int) (i.= expected))
+ (|> (all /.then
+ (/.local/1 $index (/.int +0))
+ (/.local/1 $output (/.int +0))
+ (/.repeat (/.= full_iterations $index)
+ (all /.then
+ (/.when (/.= expected_iterations $index)
+ /.break)
+ (/.set (list $output) (/.+ $input $output))
+ (/.set (list $index) (/.+ (/.int +1) $index))
+ ))
+ (/.return $output))
+ (/.closure (list $input))
+ (/.apply (list (/.int input)))))
+ =for_step (expression (|>> (as Int) (i.= expected))
+ (|> (all /.then
+ (/.local/1 $output (/.int +0))
+ (/.for_step $index (/.int +0) full_iterations (/.int +1)
+ (all /.then
+ (/.when (/.= expected_iterations $index)
+ /.break)
+ (/.set (list $output) (/.+ $input $output))))
+ (/.return $output))
+ (/.closure (list $input))
+ (/.apply (list (/.int input)))))]
+ (and =while
+ =repeat
+ =for_step
+ =for_in)))
+ (_.coverage [/.label /.set_label /.go_to]
+ (expression (|>> (as Int) (i.= expected))
+ (|> (all /.then
+ (/.local/1 $index (/.int +0))
+ (/.local/1 $output (/.int +0))
+ (/.set_label @loop)
+ (/.if (/.< expected_iterations $index)
+ (all /.then
+ (/.set (list $output) (/.+ $input $output))
+ (/.set (list $index) (/.+ (/.int +1) $index))
+ (/.go_to @loop))
+ (/.return $output)))
+ (/.closure (list $input))
+ (/.apply (list (/.int input))))))
)))
(def: test|loop
@@ -506,50 +506,50 @@
$index (/.var "index")
expected (i.* (.int iterations) input)]]
(all _.and
- (_.cover [/.while]
- (expression (|>> (as Int) (i.= expected))
- (|> (all /.then
- (/.local/1 $index (/.int +0))
- (/.local/1 $output (/.int +0))
- (/.while (/.< (/.int (.int iterations)) $index)
- (all /.then
- (/.set (list $output) (/.+ $input $output))
- (/.set (list $index) (/.+ (/.int +1) $index))
- ))
- (/.return $output))
- (/.closure (list $input))
- (/.apply (list (/.int input))))))
- (_.cover [/.repeat]
- (expression (|>> (as Int) (i.= expected))
- (|> (all /.then
- (/.local/1 $index (/.int +0))
- (/.local/1 $output (/.int +0))
- (/.repeat (/.= (/.int (.int iterations)) $index)
- (all /.then
- (/.set (list $output) (/.+ $input $output))
- (/.set (list $index) (/.+ (/.int +1) $index))
- ))
- (/.return $output))
- (/.closure (list $input))
- (/.apply (list (/.int input))))))
- (_.cover [/.for_step]
- (expression (|>> (as Int) (i.= expected))
- (|> (all /.then
- (/.local/1 $output (/.int +0))
- (/.for_step $index (/.int +0) (/.int (.int (-- iterations))) (/.int +1)
- (/.set (list $output) (/.+ $input $output)))
- (/.return $output))
- (/.closure (list $input))
- (/.apply (list (/.int input))))))
- (_.cover [/.for_in /.ipairs/1]
- (expression (|>> (as Int) (i.= expected))
- (|> (all /.then
- (/.local/1 $output (/.int +0))
- (/.for_in (list $index $input) (/.ipairs/1 (/.array (list.repeated iterations $input)))
- (/.set (list $output) (/.+ $input $output)))
- (/.return $output))
- (/.closure (list $input))
- (/.apply (list (/.int input))))))
+ (_.coverage [/.while]
+ (expression (|>> (as Int) (i.= expected))
+ (|> (all /.then
+ (/.local/1 $index (/.int +0))
+ (/.local/1 $output (/.int +0))
+ (/.while (/.< (/.int (.int iterations)) $index)
+ (all /.then
+ (/.set (list $output) (/.+ $input $output))
+ (/.set (list $index) (/.+ (/.int +1) $index))
+ ))
+ (/.return $output))
+ (/.closure (list $input))
+ (/.apply (list (/.int input))))))
+ (_.coverage [/.repeat]
+ (expression (|>> (as Int) (i.= expected))
+ (|> (all /.then
+ (/.local/1 $index (/.int +0))
+ (/.local/1 $output (/.int +0))
+ (/.repeat (/.= (/.int (.int iterations)) $index)
+ (all /.then
+ (/.set (list $output) (/.+ $input $output))
+ (/.set (list $index) (/.+ (/.int +1) $index))
+ ))
+ (/.return $output))
+ (/.closure (list $input))
+ (/.apply (list (/.int input))))))
+ (_.coverage [/.for_step]
+ (expression (|>> (as Int) (i.= expected))
+ (|> (all /.then
+ (/.local/1 $output (/.int +0))
+ (/.for_step $index (/.int +0) (/.int (.int (-- iterations))) (/.int +1)
+ (/.set (list $output) (/.+ $input $output)))
+ (/.return $output))
+ (/.closure (list $input))
+ (/.apply (list (/.int input))))))
+ (_.coverage [/.for_in /.ipairs/1]
+ (expression (|>> (as Int) (i.= expected))
+ (|> (all /.then
+ (/.local/1 $output (/.int +0))
+ (/.for_in (list $index $input) (/.ipairs/1 (/.array (list.repeated iterations $input)))
+ (/.set (list $output) (/.+ $input $output)))
+ (/.return $output))
+ (/.closure (list $input))
+ (/.apply (list (/.int input))))))
(_.for [/.Label]
..test|label)
)))
@@ -563,40 +563,40 @@
$verdict (# ! each /.var (random.lower_case 10))
$outcome (# ! each /.var (random.lower_case 11))]
(all _.and
- (_.cover [/.pcall/1]
- (expression (|>> (as Frac) (f.= expected))
- (|> (all /.then
- (/.let (list $verdict $outcome) (/.pcall/1 (/.closure (list)
- (/.return (/.float expected)))))
- (/.if $verdict
- (/.return $outcome)
- (/.return (/.float dummy))))
- (/.closure (list))
- (/.apply (list)))))
- (_.cover [/.error/1]
- (expression (|>> (as Frac) (f.= expected))
- (|> (all /.then
- (/.let (list $verdict $outcome) (/.pcall/1 (/.closure (list)
- (all /.then
- (/.statement (/.error/1 (/.float expected)))
- (/.return (/.float dummy))))))
- (/.if $verdict
- (/.return (/.float dummy))
- (/.return $outcome)))
- (/.closure (list))
- (/.apply (list)))))
- (_.cover [/.error/2]
- (expression (|>> (as Frac) (f.= expected))
- (|> (all /.then
- (/.let (list $verdict $outcome) (/.pcall/1 (/.closure (list)
- (all /.then
- (/.statement (/.error/2 (/.float expected) (/.int +2)))
- (/.return (/.float dummy))))))
- (/.if $verdict
- (/.return (/.float dummy))
- (/.return $outcome)))
- (/.closure (list))
- (/.apply (list)))))
+ (_.coverage [/.pcall/1]
+ (expression (|>> (as Frac) (f.= expected))
+ (|> (all /.then
+ (/.let (list $verdict $outcome) (/.pcall/1 (/.closure (list)
+ (/.return (/.float expected)))))
+ (/.if $verdict
+ (/.return $outcome)
+ (/.return (/.float dummy))))
+ (/.closure (list))
+ (/.apply (list)))))
+ (_.coverage [/.error/1]
+ (expression (|>> (as Frac) (f.= expected))
+ (|> (all /.then
+ (/.let (list $verdict $outcome) (/.pcall/1 (/.closure (list)
+ (all /.then
+ (/.statement (/.error/1 (/.float expected)))
+ (/.return (/.float dummy))))))
+ (/.if $verdict
+ (/.return (/.float dummy))
+ (/.return $outcome)))
+ (/.closure (list))
+ (/.apply (list)))))
+ (_.coverage [/.error/2]
+ (expression (|>> (as Frac) (f.= expected))
+ (|> (all /.then
+ (/.let (list $verdict $outcome) (/.pcall/1 (/.closure (list)
+ (all /.then
+ (/.statement (/.error/2 (/.float expected) (/.int +2)))
+ (/.return (/.float dummy))))))
+ (/.if $verdict
+ (/.return (/.float dummy))
+ (/.return $outcome)))
+ (/.closure (list))
+ (/.apply (list)))))
)))
(def: test|function
@@ -609,20 +609,20 @@
field (random.lower_case 3)
$class (# ! each /.var (random.upper_case 4))]
(all _.and
- (_.cover [/.closure /.return]
- (expression (|>> (as Frac) (f.= float/0))
- (/.apply (list)
- (/.closure (list) (/.return (/.float float/0))))))
- (_.cover [/.local_function]
- (expression (|>> (as Int) .nat (n.= iterations))
- (|> (all /.then
- (/.local_function $self (list $arg/0)
- (/.if (/.< (/.int (.int iterations)) $arg/0)
- (/.return (/.apply (list (/.+ (/.int +1) $arg/0)) $self))
- (/.return $arg/0)))
- (/.return (/.apply (list (/.int +0)) $self)))
- (/.closure (list))
- (/.apply (list)))))
+ (_.coverage [/.closure /.return]
+ (expression (|>> (as Frac) (f.= float/0))
+ (/.apply (list)
+ (/.closure (list) (/.return (/.float float/0))))))
+ (_.coverage [/.local_function]
+ (expression (|>> (as Int) .nat (n.= iterations))
+ (|> (all /.then
+ (/.local_function $self (list $arg/0)
+ (/.if (/.< (/.int (.int iterations)) $arg/0)
+ (/.return (/.apply (list (/.+ (/.int +1) $arg/0)) $self))
+ (/.return $arg/0)))
+ (/.return (/.apply (list (/.int +0)) $self)))
+ (/.closure (list))
+ (/.apply (list)))))
(do [! random.monad]
[float/0 random.safe_frac
float/1 random.safe_frac
@@ -631,12 +631,12 @@
$arg/1 (# ! each /.var (random.lower_case 11))
$arg/2 (# ! each /.var (random.lower_case 12))]
(`` (all _.and
- (_.cover [/.apply]
- (expression (|>> (as Frac) (f.= (all f.+ float/0 float/1 float/2)))
- (/.apply (list (/.float float/0)
- (/.float float/1)
- (/.float float/2))
- (/.closure (list $arg/0 $arg/1 $arg/2) (/.return (all /.+ $arg/0 $arg/1 $arg/2))))))
+ (_.coverage [/.apply]
+ (expression (|>> (as Frac) (f.= (all f.+ float/0 float/1 float/2)))
+ (/.apply (list (/.float float/0)
+ (/.float float/1)
+ (/.float float/2))
+ (/.closure (list $arg/0 $arg/1 $arg/2) (/.return (all /.+ $arg/0 $arg/1 $arg/2))))))
)))
)))
@@ -647,21 +647,21 @@
float/1 random.safe_frac
??? random.bit]
(all _.and
- (_.cover [/.if]
- (expression (|>> (as Frac) (f.= (if ??? float/0 float/1)))
- (|> (/.if (/.boolean ???)
- (/.return (/.float float/0))
- (/.return (/.float float/1)))
- (/.closure (list))
- (/.apply (list)))))
- (_.cover [/.when]
- (expression (|>> (as Frac) (f.= (if ??? float/0 float/1)))
- (|> (all /.then
- (/.when (/.boolean ???)
- (/.return (/.float float/0)))
- (/.return (/.float float/1)))
- (/.closure (list))
- (/.apply (list)))))
+ (_.coverage [/.if]
+ (expression (|>> (as Frac) (f.= (if ??? float/0 float/1)))
+ (|> (/.if (/.boolean ???)
+ (/.return (/.float float/0))
+ (/.return (/.float float/1)))
+ (/.closure (list))
+ (/.apply (list)))))
+ (_.coverage [/.when]
+ (expression (|>> (as Frac) (f.= (if ??? float/0 float/1)))
+ (|> (all /.then
+ (/.when (/.boolean ???)
+ (/.return (/.float float/0)))
+ (/.return (/.float float/1)))
+ (/.closure (list))
+ (/.apply (list)))))
)))
(def: test|binding
@@ -688,13 +688,13 @@
$arg/0 (# ! each /.var (random.lower_case 10))
$arg/1 (# ! each /.var (random.lower_case 11))]
(`` (all _.and
- (_.cover [/.statement /.then /.print/1]
- (expression (|>> (as Frac) (f.= float/0))
- (|> (all /.then
- (/.statement (/.print/1 $arg/0))
- (/.return $arg/0))
- (/.closure (list $arg/0))
- (/.apply (list (/.float float/0))))))
+ (_.coverage [/.statement /.then /.print/1]
+ (expression (|>> (as Frac) (f.= float/0))
+ (|> (all /.then
+ (/.statement (/.print/1 $arg/0))
+ (/.return $arg/0))
+ (/.closure (list $arg/0))
+ (/.apply (list (/.float float/0))))))
..test|binding
..test|control
))))
@@ -712,9 +712,9 @@
(_.for [/.hash]
($hash.spec /.hash random))
- (_.cover [/.manual]
- (expression (|>> (as Int) (i.= expected))
- (/.manual (/.code (/.int expected)))))
+ (_.coverage [/.manual]
+ (expression (|>> (as Int) (i.= expected))
+ (/.manual (/.code (/.int expected)))))
(_.for [/.Expression]
..test|expression)
(_.for [/.Statement]