aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2021-07-28 04:48:42 -0400
committerEduardo Julian2021-07-28 04:48:42 -0400
commit5d4583aebd00adced10275b32ff1a93ab418be50 (patch)
tree89315e104e2b0ddd6d56f894f01a0575d3078699 /stdlib/source/test
parent061fd8a209bbcaffc2bfb850ac6046752a567d50 (diff)
Re-named List's tags: Nil => End && Cons => Item
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/aedifex/command/build.lux8
-rw-r--r--stdlib/source/test/lux.lux18
-rw-r--r--stdlib/source/test/lux/abstract/enum.lux4
-rw-r--r--stdlib/source/test/lux/abstract/equivalence.lux4
-rw-r--r--stdlib/source/test/lux/abstract/predicate.lux4
-rw-r--r--stdlib/source/test/lux/control/concatenative.lux4
-rw-r--r--stdlib/source/test/lux/control/concurrency/frp.lux6
-rw-r--r--stdlib/source/test/lux/control/continuation.lux8
-rw-r--r--stdlib/source/test/lux/control/parser.lux2
-rw-r--r--stdlib/source/test/lux/data/binary.lux6
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux8
-rw-r--r--stdlib/source/test/lux/data/collection/queue.lux8
-rw-r--r--stdlib/source/test/lux/target/jvm.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux10
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux130
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux326
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux10
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux244
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux46
21 files changed, 435 insertions, 417 deletions
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux
index 141573f6f..b38b61340 100644
--- a/stdlib/source/test/aedifex/command/build.lux
+++ b/stdlib/source/test/aedifex/command/build.lux
@@ -84,18 +84,18 @@
(if error?
(exception.except shell.no_more_output [])
(case state
- (#.Cons head tail)
+ (#.Item head tail)
(#try.Success [tail head])
- #.Nil
+ #.End
(exception.except shell.no_more_output []))))
(def: (on_error state)
(if error?
(case state
- (#.Cons head tail)
+ (#.Item head tail)
(#try.Success [tail head])
- #.Nil
+ #.End
(exception.except shell.no_more_output []))
(exception.except shell.no_more_output [])))
(def: (on_write input state)
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index de99ee775..bfdc93f30 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -972,6 +972,23 @@
(is? post (io.run (atom.read box)))))))
))
+(def: identity/constant
+ (All [a] (-> a a))
+ (function (_ value)
+ value))
+
+(def: (identity/function value)
+ (All [a] (-> a a))
+ value)
+
+(def: for_def:
+ Test
+ (do random.monad
+ [expected random.nat]
+ (_.cover [/.def:]
+ (and (is? expected (identity/constant expected))
+ (is? expected (identity/function expected))))))
+
(def: test
Test
(<| (_.covering /._)
@@ -995,6 +1012,7 @@
..for_value
..for_case
..for_control_flow
+ ..for_def:
..sub_tests
)))
diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux
index b5c39ad75..8e472db22 100644
--- a/stdlib/source/test/lux/abstract/enum.lux
+++ b/stdlib/source/test/lux/abstract/enum.lux
@@ -37,7 +37,7 @@
(/.range n.enum start end)
(list.reverse (/.range n.enum end start)))
every_element_is_a_successor? (case range
- (#.Cons head tail)
+ (#.Item head tail)
(|> (list\fold (function (_ next [verdict prev])
[(and verdict
(n.= next (\ n.enum succ prev)))
@@ -46,7 +46,7 @@
tail)
product.left)
- #.Nil
+ #.End
false)]
(and (n.= expected_size (list.size range))
expected_start?
diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux
index 007382e60..10af6891d 100644
--- a/stdlib/source/test/lux/abstract/equivalence.lux
+++ b/stdlib/source/test/lux/abstract/equivalence.lux
@@ -45,10 +45,10 @@
(implementation
(def: (= left right)
(case [left right]
- [#.Nil #.Nil]
+ [#.End #.End]
true
- [(#.Cons leftH lefT) (#.Cons rightH rightT)]
+ [(#.Item leftH lefT) (#.Item rightH rightT)]
(and (n.= leftH rightH)
(\ equivalence = lefT rightT))
diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux
index 0e902fb40..b821865de 100644
--- a/stdlib/source/test/lux/abstract/predicate.lux
+++ b/stdlib/source/test/lux/abstract/predicate.lux
@@ -80,10 +80,10 @@
(/.rec (function (_ recur)
(function (_ values)
(case values
- #.Nil
+ #.End
false
- (#.Cons head tail)
+ (#.Item head tail)
(or (even? head)
(recur tail)))))))]
(bit\= (list.any? even? samples)
diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux
index 678a8aa99..fe7773eea 100644
--- a/stdlib/source/test/lux/control/concatenative.lux
+++ b/stdlib/source/test/lux/control/concatenative.lux
@@ -266,12 +266,12 @@
(/.push |inc|)
/.compose
/.call)))
- (_.cover [/.curry]
+ (_.cover [/.partial]
(n.= (n.+ sample sample)
(||> (/.push sample)
(/.push sample)
(/.push (/.apply/2 n.+))
- /.curry
+ /.partial
/.call)))
(_.cover [/.when]
(n.= (if choice
diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux
index 5c555ebfc..6d60c750f 100644
--- a/stdlib/source/test/lux/control/concurrency/frp.lux
+++ b/stdlib/source/test/lux/control/concurrency/frp.lux
@@ -51,15 +51,15 @@
(case amount_of_polls
0 (do async.monad
[_ (async.future (\ sink close))]
- (in #.Nil))
+ (in #.End))
_ (do {! async.monad}
[event channel]
(case event
#.None
- (in #.Nil)
+ (in #.End)
(#.Some [head tail])
- (\ ! map (|>> (#.Cons head))
+ (\ ! map (|>> (#.Item head))
(take_amount (dec amount_of_polls) [channel sink]))))))
(def: #export test
diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux
index 24944c49e..4103d1a1f 100644
--- a/stdlib/source/test/lux/control/continuation.lux
+++ b/stdlib/source/test/lux/control/continuation.lux
@@ -72,15 +72,15 @@
(/.Cont (List Nat) (List Nat)))
(function (visit xs)
(case xs
- #.Nil
- (_\in #.Nil)
+ #.End
+ (_\in #.End)
- (#.Cons x xs')
+ (#.Item x xs')
(do {! /.monad}
[output (/.shift (function (_ k)
(do !
[tail (k xs')]
- (in (#.Cons x tail)))))]
+ (in (#.Item x tail)))))]
(visit output)))))]
(list\= elems
(/.run (/.reset (visit elems))))))
diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux
index 382d17063..b71ab1256 100644
--- a/stdlib/source/test/lux/control/parser.lux
+++ b/stdlib/source/test/lux/control/parser.lux
@@ -110,7 +110,7 @@
(\ (list.equivalence n.equivalence) = expected+ actual)))
(|> (list\map (|>> .int code.int) expected+)
(/.run (/.some <code>.nat))
- (match #.Nil
+ (match #.End
#1))))
(_.cover [/.many]
(and (|> (list\map code.nat expected+)
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index b8775be48..a9e977c0a 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -72,7 +72,7 @@
(def: as_list
(-> /.Binary (List Nat))
(/.fold (function (_ head tail)
- (#.Cons head tail))
+ (#.Item head tail))
(list)))
(def: #export test
@@ -138,10 +138,10 @@
(and (\ /.equivalence = sample (/.drop 0 sample))
(\ /.equivalence = (/.create 0) (/.drop size sample))
(case (list.reverse (..as_list sample))
- #.Nil
+ #.End
false
- (#.Cons head tail)
+ (#.Item head tail)
(n.= (list.fold n.+ 0 tail)
(/.fold n.+ 0 (/.drop 1 sample))))))
(_.cover [/.copy]
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index 207ba73d9..2374b2f21 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -238,20 +238,20 @@
[($_ _.and
(_.cover [<head>]
(case [(<pre> sample) (<head> sample)]
- [(#.Cons expected _) (#.Some actual)]
+ [(#.Item expected _) (#.Some actual)]
(n.= expected actual)
- [#.Nil #.None]
+ [#.End #.None]
true
_
false))
(_.cover [<tail>]
(case [(<pre> sample) (<tail> sample)]
- [(#.Cons _ expected) (#.Some actual)]
+ [(#.Item _ expected) (#.Some actual)]
(/\= (<pre> expected) actual)
- [#.Nil #.None]
+ [#.End #.None]
true
_
diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux
index 3bc695aca..b394220ef 100644
--- a/stdlib/source/test/lux/data/collection/queue.lux
+++ b/stdlib/source/test/lux/data/collection/queue.lux
@@ -60,10 +60,10 @@
all_empty_queues_look_the_same!)))
(_.cover [/.peek]
(case [members (/.peek sample)]
- [(#.Cons head tail) (#.Some first)]
+ [(#.Item head tail) (#.Some first)]
(n.= head first)
- [#.Nil #.None]
+ [#.End #.None]
true
_
@@ -95,7 +95,7 @@
has_expected_order!)))
(_.cover [/.pop]
(case members
- (#.Cons target expected)
+ (#.Item target expected)
(let [popped (/.pop sample)
size_decreases!
@@ -113,7 +113,7 @@
popped_member_is_not_identified!
has_expected_order!))
- #.Nil
+ #.End
(and (/.empty? sample)
(/.empty? (/.pop sample)))))
))))
diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux
index fbbcc2414..1f52753d1 100644
--- a/stdlib/source/test/lux/target/jvm.lux
+++ b/stdlib/source/test/lux/target/jvm.lux
@@ -1030,7 +1030,7 @@
(..bytecode (|>> (:as Nat) (n.= sizesH)))
(do {! /.monad}
[_ (monad.map ! (|>> (:as java/lang/Long) ffi.long_to_int ..$Integer::literal)
- (#.Cons sizesH sizesT))
+ (#.Item sizesH sizesT))
_ (/.multianewarray type (|> dimensions /unsigned.u1 try.assumed))
_ ?length]
$Long::wrap))))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux
index 0c1d1a712..4afc28a2d 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux
@@ -40,17 +40,17 @@
(def: (exhaustive_weaving branchings)
(-> (List (List Code)) (List (List Code)))
(case branchings
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons head+ #.Nil)
+ (#.Item head+ #.End)
(list\map (|>> list) head+)
- (#.Cons head+ tail++)
+ (#.Item head+ tail++)
(do list.monad
[tail+ (exhaustive_weaving tail++)
head head+]
- (in (#.Cons head tail+)))))
+ (in (#.Item head tail+)))))
(def: #export (exhaustive_branches allow_literals? variantTC inputC)
(-> Bit (List [Code Code]) Code (Random (List Code)))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux
index b8a692f07..1cf61d839 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux
@@ -101,7 +101,7 @@
partial_polyT1 (<| (type.function partial_poly_inputsT)
poly_inputT)
partial_polyT2 (<| (type.univ_q 1)
- (type.function (#.Cons varT partial_poly_inputsT))
+ (type.function (#.Item varT partial_poly_inputsT))
varT)
dummy_function (#////analysis.Function (list) (#////analysis.Reference (////reference.local 1)))]]
(<| (_.context (%.name (name_of /.apply)))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
index 8eed2d440..e24fac097 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux
@@ -39,7 +39,7 @@
[meta
["." archive]]]]]]]])
-(def: masking-test
+(def: masking_test
Test
(do {! random.monad}
[maskedA //primitive.primitive
@@ -49,14 +49,14 @@
[[(#analysis.Bind temp)
(#analysis.Reference (////reference.local temp))]
(list)]])]]
- (_.cover [/.synthesize-masking]
+ (_.cover [/.synthesize_masking]
(|> maskA
(//.phase archive.empty)
(phase.run [///bundle.empty synthesis.init])
(try\map (//primitive.corresponds? maskedA))
(try.default false)))))
-(def: let-test
+(def: let_test
Test
(do random.monad
[registerA random.nat
@@ -67,7 +67,7 @@
[[(#analysis.Bind registerA)
outputA]
(list)]])]]
- (_.cover [/.synthesize-let]
+ (_.cover [/.synthesize_let]
(|> letA
(//.phase archive.empty)
(phase.run [///bundle.empty synthesis.init])
@@ -79,7 +79,7 @@
_
false)))))
-(def: if-test
+(def: if_test
Test
(do random.monad
[then|else random.bit
@@ -95,7 +95,7 @@
ifA (if then|else
(analysis.control/case [inputA [thenB (list elseB)]])
(analysis.control/case [inputA [elseB (list thenB)]]))]]
- (_.cover [/.synthesize-if]
+ (_.cover [/.synthesize_if]
(|> ifA
(//.phase archive.empty)
(phase.run [///bundle.empty synthesis.init])
@@ -107,7 +107,7 @@
_
false)))))
-(def: random-member
+(def: random_member
(Random synthesis.Member)
(do {! random.monad}
[lefts (|> random.nat (\ ! map (n.% 10)))
@@ -116,13 +116,13 @@
(#.Right lefts)
(#.Left lefts)))))
-(def: random-path
+(def: random_path
(Random (analysis.Tuple synthesis.Member))
(do {! random.monad}
- [size-1 (|> random.nat (\ ! map (|>> (n.% 10) inc)))]
- (random.list size-1 ..random-member)))
+ [size_1 (|> random.nat (\ ! map (|>> (n.% 10) inc)))]
+ (random.list size_1 ..random_member)))
-(def: (get-pattern path)
+(def: (get_pattern path)
(-> (analysis.Tuple synthesis.Member)
(Random [analysis.Pattern Register]))
(do random.monad
@@ -142,19 +142,19 @@
(list.reverse path))
@member])))
-(def: get-test
+(def: get_test
Test
(do {! random.monad}
[recordA (|> random.nat
(\ ! map (|>> analysis.nat))
(random.list 10)
(\ ! map (|>> analysis.tuple)))
- pathA ..random-path
- [pattern @member] (get-pattern pathA)
+ pathA ..random_path
+ [pattern @member] (get_pattern pathA)
#let [getA (analysis.control/case [recordA [[pattern
(#analysis.Reference (////reference.local @member))]
(list)]])]]
- (_.cover [/.synthesize-get]
+ (_.cover [/.synthesize_get]
(|> getA
(//.phase archive.empty)
(phase.run [///bundle.empty synthesis.init])
@@ -165,7 +165,7 @@
_
false)))))
-(def: random-bit
+(def: random_bit
(Random [Path Match])
(do {! random.monad}
[test random.bit
@@ -180,9 +180,9 @@
(list {#analysis.when (analysis.pattern/bit (not test))
#analysis.then (analysis.nat else)})]])))
-(def: (random-five hash random-element)
+(def: (random_five hash random_element)
(All [a] (-> (Hash a) (Random a) (Random [a a a a a])))
- (|> random-element
+ (|> random_element
(random.set hash 5)
(\ random.monad map (|>> set.to_list
(case> (^ (list s0 s1 s2 s3 s4))
@@ -195,8 +195,8 @@
[(def: <name>
(Random [Path Match])
(do {! random.monad}
- [[test/0 test/1 test/2 test/3 test/4] (random-five <hash> <random>)
- [body/0 body/1 body/2 body/3 body/4] (random-five <hash> <random>)]
+ [[test/0 test/1 test/2 test/3 test/4] (random_five <hash> <random>)
+ [body/0 body/1 body/2 body/3 body/4] (random_five <hash> <random>)]
(in [($_ #synthesis.Alt
(#synthesis.Seq (<path> test/0) (#synthesis.Then (<synthesis> body/0)))
(#synthesis.Seq (<path> test/1) (#synthesis.Then (<synthesis> body/1)))
@@ -209,30 +209,30 @@
{#analysis.when (<pattern> test/3) #analysis.then (<analysis> body/3)}
{#analysis.when (<pattern> test/4) #analysis.then (<analysis> body/4)})]])))]
- [random-nat n.hash random.nat (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/nat analysis.nat]
- [random-int int.hash random.int (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/int analysis.int]
- [random-rev rev.hash random.rev (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/rev analysis.rev]
- [random-frac frac.hash random.frac synthesis.path/f64 synthesis.f64 analysis.pattern/frac analysis.frac]
- [random-text text.hash (random.unicode 1) synthesis.path/text synthesis.text analysis.pattern/text analysis.text]
+ [random_nat n.hash random.nat (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/nat analysis.nat]
+ [random_int int.hash random.int (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/int analysis.int]
+ [random_rev rev.hash random.rev (|>> .i64 synthesis.path/i64) (|>> .i64 synthesis.i64) analysis.pattern/rev analysis.rev]
+ [random_frac frac.hash random.frac synthesis.path/f64 synthesis.f64 analysis.pattern/frac analysis.frac]
+ [random_text text.hash (random.unicode 1) synthesis.path/text synthesis.text analysis.pattern/text analysis.text]
)
-(def: random-simple
+(def: random_simple
($_ random.either
- ..random-bit
- ..random-nat
- ..random-int
- ..random-rev
- ..random-frac
- ..random-text
+ ..random_bit
+ ..random_nat
+ ..random_int
+ ..random_rev
+ ..random_frac
+ ..random_text
))
-(def: random-variant
+(def: random_variant
(Random [Path Match])
(do {! random.monad}
- [[lefts/0 lefts/1 lefts/2 lefts/3 lefts/4] (random-five n.hash random.nat)
- [value/0 value/1 value/2 value/3 value/4] (random-five text.hash (random.unicode 1))
- last-is-right? random.bit
- [body/0 body/1 body/2 body/3 body/4] (random-five frac.hash random.frac)
+ [[lefts/0 lefts/1 lefts/2 lefts/3 lefts/4] (random_five n.hash random.nat)
+ [value/0 value/1 value/2 value/3 value/4] (random_five text.hash (random.unicode 1))
+ last_is_right? random.bit
+ [body/0 body/1 body/2 body/3 body/4] (random_five frac.hash random.frac)
#let [path (: (-> Nat Bit Text Frac Path)
(function (_ lefts right? value body)
($_ #synthesis.Seq
@@ -252,24 +252,24 @@
(path lefts/1 false value/1 body/1)
(path lefts/2 false value/2 body/2)
(path lefts/3 false value/3 body/3)
- (path lefts/4 last-is-right? value/4 body/4))
+ (path lefts/4 last_is_right? value/4 body/4))
[(branch lefts/0 false value/0 body/0)
(list (branch lefts/1 false value/1 body/1)
(branch lefts/2 false value/2 body/2)
(branch lefts/3 false value/3 body/3)
- (branch lefts/4 last-is-right? value/4 body/4))]])))
+ (branch lefts/4 last_is_right? value/4 body/4))]])))
-(def: random-tuple
+(def: random_tuple
(Random [Path Match])
(do {! random.monad}
- [mid-size (\ ! map (n.% 4) random.nat)
+ [mid_size (\ ! map (n.% 4) random.nat)
value/first (random.unicode 1)
- value/mid (random.list mid-size (random.unicode 1))
+ value/mid (random.list mid_size (random.unicode 1))
value/last (random.unicode 1)
body/first random.frac
- body/mid (random.list mid-size random.frac)
+ body/mid (random.list mid_size random.frac)
body/last random.frac
#let [path (: (-> Nat Bit Text Frac Path)
(function (_ lefts right? value body)
@@ -299,9 +299,9 @@
#analysis.then (analysis.frac body)}))]]
(in [(list\fold (function (_ left right)
(#synthesis.Alt left right))
- (path (inc mid-size) true value/last body/last)
+ (path (inc mid_size) true value/last body/last)
(|> (list.zipped/2 value/mid body/mid)
- (#.Cons [value/first body/first])
+ (#.Item [value/first body/first])
list.enumeration
(list\map (function (_ [lefts' [value body]])
(path lefts' false value body)))
@@ -311,31 +311,31 @@
list.enumeration
(list\map (function (_ [lefts' [value body]])
(branch (inc lefts') false value body))))
- (list (branch (inc mid-size) true value/last body/last)))]])))
+ (list (branch (inc mid_size) true value/last body/last)))]])))
-(def: random-complex
+(def: random_complex
($_ random.either
- ..random-variant
- ..random-tuple
+ ..random_variant
+ ..random_tuple
))
-(def: random-case
+(def: random_case
($_ random.either
- ..random-simple
- ..random-complex
+ ..random_simple
+ ..random_complex
))
-(def: case-test
+(def: case_test
Test
(do {! random.monad}
- [expected-input (\ ! map (|>> .i64 synthesis.i64) random.nat)
- [expected-path match] ..random-case]
- (_.cover [/.synthesize-case]
- (|> (/.synthesize-case //.phase archive.empty expected-input match)
+ [expected_input (\ ! map (|>> .i64 synthesis.i64) random.nat)
+ [expected_path match] ..random_case]
+ (_.cover [/.synthesize_case]
+ (|> (/.synthesize_case //.phase archive.empty expected_input match)
(phase.run [///bundle.empty synthesis.init])
- (case> (^ (#try.Success (synthesis.branch/case [actual-input actual-path])))
- (and (\ synthesis.equivalence = expected-input actual-input)
- (\ synthesis.path-equivalence = expected-path actual-path))
+ (case> (^ (#try.Success (synthesis.branch/case [actual_input actual_path])))
+ (and (\ synthesis.equivalence = expected_input actual_input)
+ (\ synthesis.path_equivalence = expected_path actual_path))
_
false)))))
@@ -345,9 +345,9 @@
(<| (_.covering /._)
(_.for [/.synthesize])
($_ _.and
- ..masking-test
- ..let-test
- ..if-test
- ..get-test
- ..case-test
+ ..masking_test
+ ..let_test
+ ..if_test
+ ..get_test
+ ..case_test
)))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index 63d9d9d20..4b9b9a9f3 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -37,7 +37,7 @@
[meta
["." archive]]]]]]]])
-(def: (n-function loop? arity body)
+(def: (n_function loop? arity body)
(-> Bit Arity Synthesis Synthesis)
(synthesis.function/abstraction
{#synthesis.environment (list)
@@ -49,14 +49,14 @@
#synthesis.iteration body})
body)}))
-(def: (n-abstraction arity body)
+(def: (n_abstraction arity body)
(-> Arity Analysis Analysis)
- (list\fold (function (_ arity-1 body)
- (case arity-1
+ (list\fold (function (_ arity_1 body)
+ (case arity_1
0 (#analysis.Function (list) body)
_ (#analysis.Function ($_ list\compose
(list\map (|>> #variable.Foreign)
- (list.indices arity-1))
+ (list.indices arity_1))
(list (#variable.Local 1)))
body)))
body
@@ -78,7 +78,7 @@
(type: Scenario
(-> Bit (Random Circumstance)))
-(def: (random-unit output?)
+(def: (random_unit output?)
Scenario
(\ random.monad in
[true
@@ -94,57 +94,57 @@
(<synthesis> value)
(<analysis> value)])))]
- [random-bit random.bit synthesis.bit analysis.bit]
- [random-nat random.nat (|>> .i64 synthesis.i64) analysis.nat]
- [random-int random.int (|>> .i64 synthesis.i64) analysis.int]
- [random-rev random.rev (|>> .i64 synthesis.i64) analysis.rev]
- [random-frac random.frac synthesis.f64 analysis.frac]
- [random-text (random.unicode 1) synthesis.text analysis.text]
+ [random_bit random.bit synthesis.bit analysis.bit]
+ [random_nat random.nat (|>> .i64 synthesis.i64) analysis.nat]
+ [random_int random.int (|>> .i64 synthesis.i64) analysis.int]
+ [random_rev random.rev (|>> .i64 synthesis.i64) analysis.rev]
+ [random_frac random.frac synthesis.f64 analysis.frac]
+ [random_text (random.unicode 1) synthesis.text analysis.text]
)
-(def: (random-primitive output?)
+(def: (random_primitive output?)
Scenario
- (random.either (random.either (..random-unit output?)
- (random.either (..random-bit output?)
- (..random-nat output?)))
- (random.either (random.either (..random-int output?)
- (..random-rev output?))
- (random.either (..random-frac output?)
- (..random-text output?)))))
-
-(def: (random-variant random-value output?)
+ (random.either (random.either (..random_unit output?)
+ (random.either (..random_bit output?)
+ (..random_nat output?)))
+ (random.either (random.either (..random_int output?)
+ (..random_rev output?))
+ (random.either (..random_frac output?)
+ (..random_text output?)))))
+
+(def: (random_variant random_value output?)
(-> Scenario Scenario)
(do {! random.monad}
[lefts random.nat
right? random.bit
- [loop? expected-value actual-value] (random-value false)]
+ [loop? expected_value actual_value] (random_value false)]
(in [loop?
(synthesis.variant
{#analysis.lefts lefts
#analysis.right? right?
- #analysis.value expected-value})
+ #analysis.value expected_value})
(analysis.variant
{#analysis.lefts lefts
#analysis.right? right?
- #analysis.value actual-value})])))
+ #analysis.value actual_value})])))
-(def: (random-tuple random-value output?)
+(def: (random_tuple random_value output?)
(-> Scenario Scenario)
(do {! random.monad}
- [[loop?-left expected-left actual-left] (random-value false)
- [loop?-right expected-right actual-right] (random-value false)]
- (in [(and loop?-left
- loop?-right)
- (synthesis.tuple (list expected-left expected-right))
- (analysis.tuple (list actual-left actual-right))])))
-
-(def: (random-structure random-value output?)
+ [[loop?_left expected_left actual_left] (random_value false)
+ [loop?_right expected_right actual_right] (random_value false)]
+ (in [(and loop?_left
+ loop?_right)
+ (synthesis.tuple (list expected_left expected_right))
+ (analysis.tuple (list actual_left actual_right))])))
+
+(def: (random_structure random_value output?)
(-> Scenario Scenario)
($_ random.either
- (..random-variant random-value output?)
- (..random-tuple random-value output?)))
+ (..random_variant random_value output?)
+ (..random_tuple random_value output?)))
-(def: (random-variable arity output?)
+(def: (random_variable arity output?)
(-> Arity Scenario)
(do {! random.monad}
[register (\ ! map (|>> (n.% arity) inc) random.nat)]
@@ -154,7 +154,7 @@
(#analysis.Reference (reference.local 1))
(#analysis.Reference (reference.foreign register)))])))
-(def: (random-constant output?)
+(def: (random_constant output?)
Scenario
(do {! random.monad}
[module (random.unicode 1)
@@ -163,131 +163,131 @@
(synthesis.constant [module short])
(#analysis.Reference (reference.constant [module short]))])))
-(def: (random-reference arity output?)
+(def: (random_reference arity output?)
(-> Arity Scenario)
- (random.either (..random-variable arity output?)
- (..random-constant output?)))
+ (random.either (..random_variable arity output?)
+ (..random_constant output?)))
-(def: (random-case arity random-value output?)
+(def: (random_case arity random_value output?)
(-> Arity Scenario Scenario)
(do {! random.monad}
- [bit-test random.bit
- i64-test random.nat
- f64-test random.frac
- text-test (random.unicode 1)
- [loop?-input expected-input actual-input] (random-value false)
- [loop?-output expected-output actual-output] (random-value output?)
+ [bit_test random.bit
+ i64_test random.nat
+ f64_test random.frac
+ text_test (random.unicode 1)
+ [loop?_input expected_input actual_input] (random_value false)
+ [loop?_output expected_output actual_output] (random_value output?)
lefts (|> random.nat (\ ! map (n.% 10)))
right? random.bit
#let [side|member (if right?
(#.Right lefts)
(#.Left lefts))]]
- (in [(and loop?-input
- loop?-output)
- (synthesis.branch/case [expected-input
+ (in [(and loop?_input
+ loop?_output)
+ (synthesis.branch/case [expected_input
($_ synthesis.path/alt
- (synthesis.path/then expected-output)
- (synthesis.path/seq (synthesis.path/bit bit-test)
- (synthesis.path/then expected-output))
- (synthesis.path/seq (synthesis.path/i64 (.i64 i64-test))
- (synthesis.path/then expected-output))
- (synthesis.path/seq (synthesis.path/f64 f64-test)
- (synthesis.path/then expected-output))
- (synthesis.path/seq (synthesis.path/text text-test)
- (synthesis.path/then expected-output))
+ (synthesis.path/then expected_output)
+ (synthesis.path/seq (synthesis.path/bit bit_test)
+ (synthesis.path/then expected_output))
+ (synthesis.path/seq (synthesis.path/i64 (.i64 i64_test))
+ (synthesis.path/then expected_output))
+ (synthesis.path/seq (synthesis.path/f64 f64_test)
+ (synthesis.path/then expected_output))
+ (synthesis.path/seq (synthesis.path/text text_test)
+ (synthesis.path/then expected_output))
(synthesis.path/seq (synthesis.path/bind (inc arity))
- (synthesis.path/then expected-output))
+ (synthesis.path/then expected_output))
($_ synthesis.path/seq
(synthesis.path/side side|member)
(synthesis.path/bind (inc arity))
- (synthesis.path/then expected-output))
+ (synthesis.path/then expected_output))
(if right?
($_ synthesis.path/seq
(synthesis.path/member side|member)
(synthesis.path/bind (inc arity))
- (synthesis.path/then expected-output))
+ (synthesis.path/then expected_output))
($_ synthesis.path/seq
(synthesis.path/member side|member)
(synthesis.path/bind (inc arity))
synthesis.path/pop
- (synthesis.path/then expected-output))))])
- (#analysis.Case actual-input
+ (synthesis.path/then expected_output))))])
+ (#analysis.Case actual_input
[{#analysis.when (analysis.pattern/unit)
- #analysis.then actual-output}
- (list {#analysis.when (analysis.pattern/bit bit-test)
- #analysis.then actual-output}
- {#analysis.when (analysis.pattern/nat (.nat i64-test))
- #analysis.then actual-output}
- {#analysis.when (analysis.pattern/frac f64-test)
- #analysis.then actual-output}
- {#analysis.when (analysis.pattern/text text-test)
- #analysis.then actual-output}
+ #analysis.then actual_output}
+ (list {#analysis.when (analysis.pattern/bit bit_test)
+ #analysis.then actual_output}
+ {#analysis.when (analysis.pattern/nat (.nat i64_test))
+ #analysis.then actual_output}
+ {#analysis.when (analysis.pattern/frac f64_test)
+ #analysis.then actual_output}
+ {#analysis.when (analysis.pattern/text text_test)
+ #analysis.then actual_output}
{#analysis.when (#analysis.Bind 2)
- #analysis.then actual-output}
+ #analysis.then actual_output}
{#analysis.when (analysis.pattern/variant
{#analysis.lefts lefts
#analysis.right? right?
#analysis.value (#analysis.Bind 2)})
- #analysis.then actual-output}
+ #analysis.then actual_output}
{#analysis.when (analysis.pattern/tuple
(list\compose (list.repeat lefts (analysis.pattern/unit))
(if right?
(list (analysis.pattern/unit) (#analysis.Bind 2))
(list (#analysis.Bind 2) (analysis.pattern/unit)))))
- #analysis.then actual-output})])])))
+ #analysis.then actual_output})])])))
-(def: (random-let arity random-value output?)
+(def: (random_let arity random_value output?)
(-> Arity Scenario Scenario)
(do {! random.monad}
- [[loop?-input expected-input actual-input] (random-value false)
- [loop?-output expected-output actual-output] (random-value output?)]
- (in [(and loop?-input
- loop?-output)
- (synthesis.branch/let [expected-input
+ [[loop?_input expected_input actual_input] (random_value false)
+ [loop?_output expected_output actual_output] (random_value output?)]
+ (in [(and loop?_input
+ loop?_output)
+ (synthesis.branch/let [expected_input
(inc arity)
- expected-output])
- (#analysis.Case actual-input
+ expected_output])
+ (#analysis.Case actual_input
[{#analysis.when (#analysis.Bind 2)
- #analysis.then actual-output}
+ #analysis.then actual_output}
(list)])])))
-(def: (random-if random-value output?)
+(def: (random_if random_value output?)
(-> Scenario Scenario)
(do {! random.monad}
- [[loop?-test expected-test actual-test] (random-value false)
- [loop?-then expected-then actual-then] (random-value output?)
- [loop?-else expected-else actual-else] (random-value output?)
+ [[loop?_test expected_test actual_test] (random_value false)
+ [loop?_then expected_then actual_then] (random_value output?)
+ [loop?_else expected_else actual_else] (random_value output?)
flip? random.bit]
- (in [(and loop?-test
- loop?-then
- loop?-else)
- (synthesis.branch/if [expected-test
- expected-then
- expected-else])
+ (in [(and loop?_test
+ loop?_then
+ loop?_else)
+ (synthesis.branch/if [expected_test
+ expected_then
+ expected_else])
(if flip?
- (#analysis.Case actual-test
+ (#analysis.Case actual_test
[{#analysis.when (analysis.pattern/bit false)
- #analysis.then actual-else}
+ #analysis.then actual_else}
(list {#analysis.when (analysis.pattern/bit true)
- #analysis.then actual-then})])
- (#analysis.Case actual-test
+ #analysis.then actual_then})])
+ (#analysis.Case actual_test
[{#analysis.when (analysis.pattern/bit true)
- #analysis.then actual-then}
+ #analysis.then actual_then}
(list {#analysis.when (analysis.pattern/bit false)
- #analysis.then actual-else})]))])))
+ #analysis.then actual_else})]))])))
-(def: (random-get random-value output?)
+(def: (random_get random_value output?)
(-> Scenario Scenario)
(do {! random.monad}
[lefts (|> random.nat (\ ! map (n.% 10)))
right? random.bit
- [loop?-record expected-record actual-record] (random-value false)]
- (in [loop?-record
+ [loop?_record expected_record actual_record] (random_value false)]
+ (in [loop?_record
(synthesis.branch/get [(list (if right?
(#.Right lefts)
(#.Left lefts)))
- expected-record])
- (#analysis.Case actual-record
+ expected_record])
+ (#analysis.Case actual_record
[{#analysis.when (analysis.pattern/tuple
(list\compose (list.repeat lefts (analysis.pattern/unit))
(if right?
@@ -296,17 +296,17 @@
#analysis.then (#analysis.Reference (reference.local 2))}
(list)])])))
-(def: (random-branch arity random-value output?)
+(def: (random_branch arity random_value output?)
(-> Arity Scenario Scenario)
- (random.either (random.either (..random-case arity random-value output?)
- (..random-let arity random-value output?))
- (random.either (..random-if random-value output?)
- (..random-get random-value output?))))
+ (random.either (random.either (..random_case arity random_value output?)
+ (..random_let arity random_value output?))
+ (random.either (..random_if random_value output?)
+ (..random_get random_value output?))))
-(def: (random-recur arity random-value output?)
+(def: (random_recur arity random_value output?)
(-> Arity Scenario Scenario)
(do {! random.monad}
- [resets (random.list arity (random-value false))]
+ [resets (random.list arity (random_value false))]
(in [true
(synthesis.loop/recur (list\map (|>> product.right product.left) resets))
(analysis.apply [(#analysis.Reference (case arity
@@ -314,11 +314,11 @@
_ (reference.foreign 0)))
(list\map (|>> product.right product.right) resets)])])))
-(def: (random-scope arity output?)
+(def: (random_scope arity output?)
(-> Arity Scenario)
(do {! random.monad}
- [resets (random.list arity (..random-variable arity output?))
- [_ expected-output actual-output] (..random-nat output?)]
+ [resets (random.list arity (..random_variable arity output?))
+ [_ expected_output actual_output] (..random_nat output?)]
(in [(list\fold (function (_ new old)
(and new old))
true
@@ -326,23 +326,23 @@
(synthesis.loop/scope
{#synthesis.start (inc arity)
#synthesis.inits (list\map (|>> product.right product.left) resets)
- #synthesis.iteration expected-output})
- (analysis.apply [(..n-abstraction arity actual-output)
+ #synthesis.iteration expected_output})
+ (analysis.apply [(..n_abstraction arity actual_output)
(list\map (|>> product.right product.right) resets)])])))
-(def: (random-loop arity random-value output?)
+(def: (random_loop arity random_value output?)
(-> Arity Scenario Scenario)
(if output?
($_ random.either
- (..random-recur arity random-value output?)
- (..random-scope arity output?)
+ (..random_recur arity random_value output?)
+ (..random_scope arity output?)
)
- (..random-scope arity output?)))
+ (..random_scope arity output?)))
-(def: (random-abstraction' output?)
+(def: (random_abstraction' output?)
Scenario
(do {! random.monad}
- [[loop?-output expected-output actual-output] (..random-nat output?)
+ [[loop?_output expected_output actual_output] (..random_nat output?)
arity (|> random.nat (\ ! map (|>> (n.% 5) inc)))
#let [environment ($_ list\compose
(list\map (|>> #variable.Foreign)
@@ -355,79 +355,79 @@
#synthesis.body (synthesis.loop/scope
{#synthesis.start 1
#synthesis.inits (list)
- #synthesis.iteration expected-output})})
+ #synthesis.iteration expected_output})})
(#analysis.Function environment
- actual-output)])))
+ actual_output)])))
-(def: (random-apply random-value output?)
+(def: (random_apply random_value output?)
(-> Scenario Scenario)
(do {! random.monad}
- [[loop?-abstraction expected-abstraction actual-abstraction] (..random-nat output?)
+ [[loop?_abstraction expected_abstraction actual_abstraction] (..random_nat output?)
arity (|> random.nat (\ ! map (|>> (n.% 5) inc)))
- inputs (random.list arity (random-value false))]
+ inputs (random.list arity (random_value false))]
(in [(list\fold (function (_ new old)
(and new old))
- loop?-abstraction
+ loop?_abstraction
(list\map product.left inputs))
- (synthesis.function/apply [expected-abstraction
+ (synthesis.function/apply [expected_abstraction
(list\map (|>> product.right product.left) inputs)])
- (analysis.apply [actual-abstraction
+ (analysis.apply [actual_abstraction
(list\map (|>> product.right product.right) inputs)])])))
-(def: (random-function random-value output?)
+(def: (random_function random_value output?)
(-> Scenario Scenario)
(if output?
- (..random-apply random-value output?)
+ (..random_apply random_value output?)
($_ random.either
- (..random-abstraction' output?)
- (..random-apply random-value output?)
+ (..random_abstraction' output?)
+ (..random_apply random_value output?)
)))
-(def: (random-control arity random-value output?)
+(def: (random_control arity random_value output?)
(-> Arity Scenario Scenario)
($_ random.either
- (..random-branch arity random-value output?)
- (..random-loop arity random-value output?)
- (..random-function random-value output?)
+ (..random_branch arity random_value output?)
+ (..random_loop arity random_value output?)
+ (..random_function random_value output?)
))
-(def: (random-extension random-value output?)
+(def: (random_extension random_value output?)
(-> Scenario Scenario)
(do {! random.monad}
[name (random.unicode 1)
- [loop?-first expected-first actual-first] (random-value false)
- [loop?-second expected-second actual-second] (random-value false)
- [loop?-third expected-third actual-third] (random-value false)]
- (in [(and loop?-first
- loop?-second
- loop?-third)
- (#synthesis.Extension name (list expected-first expected-second expected-third))
- (#analysis.Extension name (list actual-first actual-second actual-third))])))
-
-(def: (random-body arity)
+ [loop?_first expected_first actual_first] (random_value false)
+ [loop?_second expected_second actual_second] (random_value false)
+ [loop?_third expected_third actual_third] (random_value false)]
+ (in [(and loop?_first
+ loop?_second
+ loop?_third)
+ (#synthesis.Extension name (list expected_first expected_second expected_third))
+ (#analysis.Extension name (list actual_first actual_second actual_third))])))
+
+(def: (random_body arity)
(-> Arity Scenario)
- (function (random-value output?)
+ (function (random_value output?)
(random.rec
(function (_ _)
($_ random.either
- (..random-primitive output?)
- (..random-structure random-value output?)
- (..random-reference arity output?)
- (..random-control arity random-value output?)
- (..random-extension random-value output?))))))
+ (..random_primitive output?)
+ (..random_structure random_value output?)
+ (..random_reference arity output?)
+ (..random_control arity random_value output?)
+ (..random_extension random_value output?))))))
-(def: random-abstraction
+(def: random_abstraction
(Random [Synthesis Analysis])
(do {! random.monad}
[arity (|> random.nat (\ ! map (|>> (n.% 5) inc)))
- [loop? expected-body actual-body] (random-body arity true)]
- (in [(..n-function loop? arity expected-body)
- (..n-abstraction arity actual-body)])))
+ [loop? expected_body actual_body] (random_body arity true)]
+ (in [(..n_function loop? arity expected_body)
+ (..n_abstraction arity actual_body)])))
(def: abstraction
Test
(do random.monad
- [[expected input] ..random-abstraction]
+ [[expected input] ..random_abstraction]
(_.cover [/.abstraction]
(|> input
(//.phase archive.empty)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
index e46960793..e4ccec535 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux
@@ -44,11 +44,11 @@
(def: #export (corresponds? analysis synthesis)
(-> Analysis Synthesis Bit)
(`` (case [analysis synthesis]
- (~~ (template [<analysis> <post-analysis> <synthesis> <post-synthesis>]
+ (~~ (template [<analysis> <post_analysis> <synthesis> <post_synthesis>]
[[(#////analysis.Primitive (<analysis> expected))
(#////synthesis.Primitive (<synthesis> actual))]
- (is? (|> expected <post-analysis>)
- (|> actual <post-synthesis>))]
+ (is? (|> expected <post_analysis>)
+ (|> actual <post_synthesis>))]
[#////analysis.Unit (:as Text) #////synthesis.Text (|>)]
[#////analysis.Bit (|>) #////synthesis.Bit (|>)]
@@ -72,12 +72,12 @@
(def: #export test
Test
- (<| (_.context (%.name (name-of #////synthesis.Primitive)))
+ (<| (_.context (%.name (name_of #////synthesis.Primitive)))
(`` ($_ _.and
(~~ (template [<analysis> <synthesis> <generator>]
[(do r.monad
[expected <generator>]
- (_.test (%.name (name-of <synthesis>))
+ (_.test (%.name (name_of <synthesis>))
(|> (#////analysis.Primitive (<analysis> expected))
(//.phase archive.empty)
(phase.run [///bundle.empty ////synthesis.init])
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux
index af665dd7a..36d59cfd9 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux
@@ -74,7 +74,7 @@
(def: #export test
Test
- (<| (_.context (%.name (name-of #////synthesis.Structure)))
+ (<| (_.context (%.name (name_of #////synthesis.Structure)))
($_ _.and
..variant
..tuple
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
index 8fa9ad158..e9f9268ac 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
@@ -49,42 +49,42 @@
(in [(<synthesis> value)
(<synthesis> value)])))]
- [bit-scenario synthesis.bit random.bit]
- [i64-scenario synthesis.i64 (\ ! map .i64 random.nat)]
- [f64-scenario synthesis.f64 random.frac]
- [text-scenario synthesis.text (random.unicode 1)]
+ [bit_scenario synthesis.bit random.bit]
+ [i64_scenario synthesis.i64 (\ ! map .i64 random.nat)]
+ [f64_scenario synthesis.f64 random.frac]
+ [text_scenario synthesis.text (random.unicode 1)]
)
-(def: (primitive-scenario context)
+(def: (primitive_scenario context)
(Scenario Synthesis)
- (random.either (random.either (..bit-scenario context)
- (..i64-scenario context))
- (random.either (..f64-scenario context)
- (..text-scenario context))))
+ (random.either (random.either (..bit_scenario context)
+ (..i64_scenario context))
+ (random.either (..f64_scenario context)
+ (..text_scenario context))))
-(def: (with-redundancy scenario context)
+(def: (with_redundancy scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do {! random.monad}
[redundant? random.bit]
(if redundant?
(do !
[let? random.bit
- [expected-input actual-input] (..primitive-scenario context)
- #let [fake-register (n.+ (get@ #redundants context)
+ [expected_input actual_input] (..primitive_scenario context)
+ #let [fake_register (n.+ (get@ #redundants context)
(dictionary.size (get@ #necessary context)))]
- [expected-output actual-output] (scenario (update@ #redundants inc context))]
- (in [(synthesis.branch/case [expected-input
+ [expected_output actual_output] (scenario (update@ #redundants inc context))]
+ (in [(synthesis.branch/case [expected_input
(#synthesis.Seq #synthesis.Pop
- (#synthesis.Then expected-output))])
+ (#synthesis.Then expected_output))])
(if let?
- (synthesis.branch/let [actual-input fake-register actual-output])
- (synthesis.branch/case [actual-input
- (#synthesis.Seq (#synthesis.Bind fake-register)
+ (synthesis.branch/let [actual_input fake_register actual_output])
+ (synthesis.branch/case [actual_input
+ (#synthesis.Seq (#synthesis.Bind fake_register)
(#synthesis.Seq #synthesis.Pop
- (#synthesis.Then actual-output)))]))]))
+ (#synthesis.Then actual_output)))]))]))
(scenario context))))
-(def: (variant-scenario scenario context)
+(def: (variant_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do {! random.monad}
[lefts random.nat
@@ -93,45 +93,45 @@
(in [(synthesis.variant [lefts right? expected])
(synthesis.variant [lefts right? input])])))
-(def: (tuple-scenario context)
+(def: (tuple_scenario context)
(Scenario Synthesis)
(let [registers (dictionary.entries (get@ #necessary context))]
(\ random.monad in
[(synthesis.tuple (list\map (|>> product.left synthesis.variable/local) registers))
(synthesis.tuple (list\map (|>> product.right synthesis.variable/local) registers))])))
-(def: (structure-scenario context)
+(def: (structure_scenario context)
(Scenario Synthesis)
- (random.either (..variant-scenario (..with-redundancy ..tuple-scenario) context)
- (..tuple-scenario context)))
+ (random.either (..variant_scenario (..with_redundancy ..tuple_scenario) context)
+ (..tuple_scenario context)))
-(def: (let-scenario scenario context)
+(def: (let_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do random.monad
[_ (in [])
- [expected-input actual-input] (scenario context)
- #let [real-register (dictionary.size (get@ #necessary context))
- fake-register (n.+ (get@ #redundants context)
+ [expected_input actual_input] (scenario context)
+ #let [real_register (dictionary.size (get@ #necessary context))
+ fake_register (n.+ (get@ #redundants context)
(dictionary.size (get@ #necessary context)))]
- [expected-output actual-output] (scenario (update@ #necessary (dictionary.put real-register fake-register) context))]
- (in [(synthesis.branch/let [expected-input real-register expected-output])
- (synthesis.branch/let [actual-input fake-register actual-output])])))
+ [expected_output actual_output] (scenario (update@ #necessary (dictionary.put real_register fake_register) context))]
+ (in [(synthesis.branch/let [expected_input real_register expected_output])
+ (synthesis.branch/let [actual_input fake_register actual_output])])))
-(def: (if-scenario scenario context)
+(def: (if_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do random.monad
[_ (in [])
- [expected-test actual-test] (scenario context)
- [expected-then actual-then] (scenario context)
- [expected-else actual-else] (scenario context)]
- (in [(synthesis.branch/if [expected-test
- expected-then
- expected-else])
- (synthesis.branch/if [actual-test
- actual-then
- actual-else])])))
+ [expected_test actual_test] (scenario context)
+ [expected_then actual_then] (scenario context)
+ [expected_else actual_else] (scenario context)]
+ (in [(synthesis.branch/if [expected_test
+ expected_then
+ expected_else])
+ (synthesis.branch/if [actual_test
+ actual_then
+ actual_else])])))
-(def: random-member
+(def: random_member
(Random Member)
(do random.monad
[lefts random.nat
@@ -140,51 +140,51 @@
(#.Right lefts)
(#.Left lefts)))))
-(def: (get-scenario scenario context)
+(def: (get_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do {! random.monad}
[length (\ ! map (|>> (n.% 5) inc) random.nat)
- path (random.list length ..random-member)
- [expected-record actual-record] (scenario context)]
- (in [(synthesis.branch/get [path expected-record])
- (synthesis.branch/get [path actual-record])])))
+ path (random.list length ..random_member)
+ [expected_record actual_record] (scenario context)]
+ (in [(synthesis.branch/get [path expected_record])
+ (synthesis.branch/get [path actual_record])])))
-(def: random-side
+(def: random_side
(Random Side)
- ..random-member)
+ ..random_member)
-(def: (path-scenario scenario context)
+(def: (path_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Path))
(`` ($_ random.either
($_ random.either
(do {! random.monad}
[_ (in [])
- [expected-then actual-then] (scenario context)]
+ [expected_then actual_then] (scenario context)]
(in [(#synthesis.Seq #synthesis.Pop
- (#synthesis.Then expected-then))
+ (#synthesis.Then expected_then))
(#synthesis.Seq #synthesis.Pop
- (#synthesis.Then actual-then))]))
+ (#synthesis.Then actual_then))]))
(do {! random.monad}
[_ (in [])
- #let [real-register (dictionary.size (get@ #necessary context))
- fake-register (n.+ (get@ #redundants context)
+ #let [real_register (dictionary.size (get@ #necessary context))
+ fake_register (n.+ (get@ #redundants context)
(dictionary.size (get@ #necessary context)))]
- [expected-then actual-then] (scenario (update@ #necessary (dictionary.put real-register fake-register) context))]
- (in [(#synthesis.Seq (#synthesis.Bind real-register)
+ [expected_then actual_then] (scenario (update@ #necessary (dictionary.put real_register fake_register) context))]
+ (in [(#synthesis.Seq (#synthesis.Bind real_register)
(#synthesis.Seq #synthesis.Pop
- (#synthesis.Then expected-then)))
- (#synthesis.Seq (#synthesis.Bind fake-register)
+ (#synthesis.Then expected_then)))
+ (#synthesis.Seq (#synthesis.Bind fake_register)
(#synthesis.Seq #synthesis.Pop
- (#synthesis.Then actual-then)))])))
+ (#synthesis.Then actual_then)))])))
($_ random.either
(~~ (template [<tag> <random>]
[(do {! random.monad}
[test <random>
- [expected-then actual-then] (scenario context)]
+ [expected_then actual_then] (scenario context)]
(in [(#synthesis.Seq (#synthesis.Test (<tag> test))
- (#synthesis.Then expected-then))
+ (#synthesis.Then expected_then))
(#synthesis.Seq (#synthesis.Test (<tag> test))
- (#synthesis.Then actual-then))]))]
+ (#synthesis.Then actual_then))]))]
[#synthesis.Bit random.bit]
[#synthesis.I64 (\ ! map .i64 random.nat)]
@@ -193,127 +193,127 @@
)))
($_ random.either
(do {! random.monad}
- [side ..random-side
- [expected-next actual-next] (path-scenario scenario context)]
+ [side ..random_side
+ [expected_next actual_next] (path_scenario scenario context)]
(in [(#synthesis.Seq (#synthesis.Access (#synthesis.Side side))
- expected-next)
+ expected_next)
(#synthesis.Seq (#synthesis.Access (#synthesis.Side side))
- actual-next)]))
+ actual_next)]))
(do {! random.monad}
- [member ..random-member
- [expected-next actual-next] (path-scenario scenario context)]
+ [member ..random_member
+ [expected_next actual_next] (path_scenario scenario context)]
(in [(#synthesis.Seq (#synthesis.Access (#synthesis.Member member))
- expected-next)
+ expected_next)
(#synthesis.Seq (#synthesis.Access (#synthesis.Member member))
- actual-next)])))
+ actual_next)])))
(do {! random.monad}
[_ (in [])
- [expected-left actual-left] (path-scenario scenario context)
- [expected-right actual-right] (path-scenario scenario context)]
- (in [(#synthesis.Alt expected-left expected-right)
- (#synthesis.Alt actual-left actual-right)]))
+ [expected_left actual_left] (path_scenario scenario context)
+ [expected_right actual_right] (path_scenario scenario context)]
+ (in [(#synthesis.Alt expected_left expected_right)
+ (#synthesis.Alt actual_left actual_right)]))
)))
-(def: (case-scenario scenario context)
+(def: (case_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do {! random.monad}
[_ (in [])
- [expected-input actual-input] (scenario context)
- [expected-path actual-path] (..path-scenario scenario context)]
- (in [(synthesis.branch/case [expected-input expected-path])
- (synthesis.branch/case [actual-input actual-path])])))
+ [expected_input actual_input] (scenario context)
+ [expected_path actual_path] (..path_scenario scenario context)]
+ (in [(synthesis.branch/case [expected_input expected_path])
+ (synthesis.branch/case [actual_input actual_path])])))
-(def: (branch-scenario scenario context)
+(def: (branch_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
($_ random.either
- (..let-scenario scenario context)
- (..if-scenario scenario context)
- (..get-scenario scenario context)
- (..case-scenario scenario context)
+ (..let_scenario scenario context)
+ (..if_scenario scenario context)
+ (..get_scenario scenario context)
+ (..case_scenario scenario context)
))
-(def: scope-arity 5)
+(def: scope_arity 5)
-(def: (scope-scenario scenario context)
+(def: (scope_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do {! random.monad}
[_ (in [])
- #let [real-start (dictionary.size (get@ #necessary context))
- fake-start (n.+ (get@ #redundants context)
- real-start)]
- inits (random.list ..scope-arity (scenario context))
- [expected-iteration actual-iteration] (scenario (update@ #necessary
+ #let [real_start (dictionary.size (get@ #necessary context))
+ fake_start (n.+ (get@ #redundants context)
+ real_start)]
+ inits (random.list ..scope_arity (scenario context))
+ [expected_iteration actual_iteration] (scenario (update@ #necessary
(function (_ necessary)
(list\fold (function (_ [idx _] context)
- (dictionary.put (n.+ real-start idx)
- (n.+ fake-start idx)
+ (dictionary.put (n.+ real_start idx)
+ (n.+ fake_start idx)
context))
necessary
(list.enumeration inits)))
context))]
- (in [(synthesis.loop/scope [real-start (list\map product.left inits) expected-iteration])
- (synthesis.loop/scope [fake-start (list\map product.right inits) actual-iteration])])))
+ (in [(synthesis.loop/scope [real_start (list\map product.left inits) expected_iteration])
+ (synthesis.loop/scope [fake_start (list\map product.right inits) actual_iteration])])))
-(def: (recur-scenario scenario context)
+(def: (recur_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do {! random.monad}
[_ (in [])
- resets (random.list ..scope-arity (scenario context))]
+ resets (random.list ..scope_arity (scenario context))]
(in [(synthesis.loop/recur (list\map product.left resets))
(synthesis.loop/recur (list\map product.right resets))])))
-(def: (loop-scenario scenario context)
+(def: (loop_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
($_ random.either
- (..scope-scenario scenario context)
- (..recur-scenario scenario context)
+ (..scope_scenario scenario context)
+ (..recur_scenario scenario context)
))
-(def: (abstraction-scenario scenario context)
+(def: (abstraction_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do {! random.monad}
[_ (in [])
#let [registers (dictionary.entries (get@ #necessary context))
- expected-environment (list\map (|>> product.left #variable.Local) registers)
- actual-environment (list\map (|>> product.right #variable.Local) registers)]
- [expected-body actual-body] (..primitive-scenario context)]
- (in [(synthesis.function/abstraction [expected-environment 1 expected-body])
- (synthesis.function/abstraction [actual-environment 1 actual-body])])))
+ expected_environment (list\map (|>> product.left #variable.Local) registers)
+ actual_environment (list\map (|>> product.right #variable.Local) registers)]
+ [expected_body actual_body] (..primitive_scenario context)]
+ (in [(synthesis.function/abstraction [expected_environment 1 expected_body])
+ (synthesis.function/abstraction [actual_environment 1 actual_body])])))
-(def: (apply-scenario scenario context)
+(def: (apply_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
(do {! random.monad}
[abstraction (\ ! map (|>> synthesis.constant)
(random.and (random.unicode 1)
(random.unicode 1)))
- inputs (random.list ..scope-arity (scenario context))]
+ inputs (random.list ..scope_arity (scenario context))]
(in [(synthesis.function/apply [abstraction (list\map product.left inputs)])
(synthesis.function/apply [abstraction (list\map product.right inputs)])])))
-(def: (function-scenario scenario context)
+(def: (function_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
($_ random.either
- (..abstraction-scenario scenario context)
- (..apply-scenario scenario context)
+ (..abstraction_scenario scenario context)
+ (..apply_scenario scenario context)
))
-(def: (control-scenario scenario context)
+(def: (control_scenario scenario context)
(-> (Scenario Synthesis) (Scenario Synthesis))
($_ random.either
- (..branch-scenario scenario context)
- (..loop-scenario scenario context)
- (..function-scenario scenario context)
+ (..branch_scenario scenario context)
+ (..loop_scenario scenario context)
+ (..function_scenario scenario context)
))
(def: (scenario context)
(Scenario Synthesis)
($_ random.either
- (..primitive-scenario context)
- (..structure-scenario context)
- (..control-scenario (..with-redundancy
- (..control-scenario
- (..with-redundancy
- ..structure-scenario)))
+ (..primitive_scenario context)
+ (..structure_scenario context)
+ (..control_scenario (..with_redundancy
+ (..control_scenario
+ (..with_redundancy
+ ..structure_scenario)))
context)
))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux
index 4e4968462..48f1f9817 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux
@@ -24,15 +24,15 @@
[\\
["." /]])
-(def: name-part^
+(def: name_part^
(Random Text)
(do {! r.monad}
[size (|> r.nat (\ ! map (|>> (n.% 20) (n.max 1))))]
- (r.ascii/lower-alpha size)))
+ (r.ascii/lower_alpha size)))
(def: name^
(Random Name)
- (r.and name-part^ name-part^))
+ (r.and name_part^ name_part^))
(def: code^
(Random Code)
@@ -42,12 +42,12 @@
(|> r.nat (r\map code.nat))
(|> r.int (r\map code.int))
(|> r.rev (r\map code.rev))
- (|> r.safe-frac (r\map code.frac))))
+ (|> r.safe_frac (r\map code.frac))))
textual^ (: (Random Code)
($_ r.either
(do r.monad
[size (|> r.nat (r\map (n.% 20)))]
- (|> (r.ascii/upper-alpha size) (r\map code.text)))
+ (|> (r.ascii/upper_alpha size) (r\map code.text)))
(|> name^ (r\map code.identifier))
(|> name^ (r\map code.tag))))
simple^ (: (Random Code)
@@ -77,9 +77,9 @@
[sample code^]
($_ _.and
(_.test "Can parse Lux code."
- (case (let [source-code (%.code sample)]
- (/.parse "" (dictionary.new text.hash) (text.size source-code)
- [location.dummy 0 source-code]))
+ (case (let [source_code (%.code sample)]
+ (/.parse "" (dictionary.new text.hash) (text.size source_code)
+ [location.dummy 0 source_code]))
(#.Left error)
false
@@ -88,15 +88,15 @@
(do !
[other code^]
(_.test "Can parse multiple Lux code nodes."
- (let [source-code (format (%.code sample) " " (%.code other))
- source-code//size (text.size source-code)]
- (case (/.parse "" (dictionary.new text.hash) source-code//size
- [location.dummy 0 source-code])
+ (let [source_code (format (%.code sample) " " (%.code other))
+ source_code//size (text.size source_code)]
+ (case (/.parse "" (dictionary.new text.hash) source_code//size
+ [location.dummy 0 source_code])
(#.Left error)
false
(#.Right [remaining =sample])
- (case (/.parse "" (dictionary.new text.hash) source-code//size
+ (case (/.parse "" (dictionary.new text.hash) source_code//size
remaining)
(#.Left error)
false
@@ -106,18 +106,18 @@
(\ code.equivalence = other =other)))))))
)))
-(def: comment-text^
+(def: comment_text^
(Random Text)
- (let [char-gen (|> r.nat (r.only (|>> (n.= (`` (char (~~ (static text.new-line))))) not)))]
+ (let [char_gen (|> r.nat (r.only (|>> (n.= (`` (char (~~ (static text.new_line))))) not)))]
(do r.monad
[size (|> r.nat (r\map (n.% 20)))]
- (r.text char-gen size))))
+ (r.text char_gen size))))
(def: comment^
(Random Text)
(do r.monad
- [comment comment-text^]
- (in (format "## " comment text.new-line))))
+ [comment comment_text^]
+ (in (format "## " comment text.new_line))))
(def: comments
Test
@@ -126,10 +126,10 @@
comment comment^]
($_ _.and
(_.test "Can handle comments."
- (case (let [source-code (format comment (%.code sample))
- source-code//size (text.size source-code)]
- (/.parse "" (dictionary.new text.hash) source-code//size
- [location.dummy 0 source-code]))
+ (case (let [source_code (format comment (%.code sample))
+ source_code//size (text.size source_code)]
+ (/.parse "" (dictionary.new text.hash) source_code//size
+ [location.dummy 0 source_code]))
(#.Left error)
false
@@ -139,7 +139,7 @@
(def: #export test
Test
- (<| (_.context (name.module (name-of /._)))
+ (<| (_.context (name.module (name_of /._)))
($_ _.and
..code
..comments