aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux.lux21
-rw-r--r--stdlib/source/test/lux/control/parser/binary.lux4
-rw-r--r--stdlib/source/test/lux/control/parser/code.lux11
-rw-r--r--stdlib/source/test/lux/macro/code.lux19
-rw-r--r--stdlib/source/test/lux/meta.lux2
-rw-r--r--stdlib/source/test/lux/meta/annotation.lux125
6 files changed, 18 insertions, 164 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index d40709cf6..fefe5270e 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -329,13 +329,14 @@
(/.' #..example))
(code\= (code.form (list (code.nat 6) (code.int +7) (code.rev .8)))
(/.' (6 +7 .8)))
+ (code\= (code.variant (list (code.frac +9.0)
+ (code.text "9")
+ (code.identifier ["" "i8"])))
+ (/.' {+9.0 "9" i8}))
(code\= (code.tuple (list (code.frac +9.0)
(code.text "9")
(code.identifier ["" "i8"])))
(/.' [+9.0 "9" i8]))
- (code\= (code.record (list [(code.identifier [/.prelude_module "i7"])
- (code.identifier [..current_module "i6"])]))
- (/.' {.i7 ..i6}))
(not (code\= (code.nat example_nat)
(/.' (~ (code.nat example_nat)))))
))))
@@ -364,13 +365,14 @@
(/.` #..example))
(code\= (code.form (list (code.nat 6) (code.int +7) (code.rev .8)))
(/.` (6 +7 .8)))
+ (code\= (code.variant (list (code.frac +9.0)
+ (code.text "9")
+ (code.identifier [..current_module "i8"])))
+ (/.` {+9.0 "9" i8}))
(code\= (code.tuple (list (code.frac +9.0)
(code.text "9")
(code.identifier [..current_module "i8"])))
(/.` [+9.0 "9" i8]))
- (code\= (code.record (list [(code.identifier [/.prelude_module "i7"])
- (code.identifier [..current_module "i6"])]))
- (/.` {.i7 ..i6}))
(code\= (code.nat example_nat)
(/.` (~ (code.nat example_nat))))))))
@@ -398,13 +400,14 @@
(/.`' #..example))
(code\= (code.form (list (code.nat 6) (code.int +7) (code.rev .8)))
(/.`' (6 +7 .8)))
+ (code\= (code.variant (list (code.frac +9.0)
+ (code.text "9")
+ (code.identifier ["" "i8"])))
+ (/.`' {+9.0 "9" i8}))
(code\= (code.tuple (list (code.frac +9.0)
(code.text "9")
(code.identifier ["" "i8"])))
(/.`' [+9.0 "9" i8]))
- (code\= (code.record (list [(code.identifier [/.prelude_module "i7"])
- (code.identifier [..current_module "i6"])]))
- (/.`' {.i7 ..i6}))
(code\= (code.nat example_nat)
(/.`' (~ (code.nat example_nat))))))))
diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux
index 73c94aa76..7e8ddd47c 100644
--- a/stdlib/source/test/lux/control/parser/binary.lux
+++ b/stdlib/source/test/lux/control/parser/binary.lux
@@ -108,9 +108,7 @@
..random_name
random_sequence
random_sequence
- (do [! random.monad]
- [size (\ ! each (n.% 2) random.nat)]
- (random.list size (random.and recur recur)))
+ random_sequence
)))))))
(def: random_type
diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux
index 6e072a050..8ee19b7e4 100644
--- a/stdlib/source/test/lux/control/parser/code.lux
+++ b/stdlib/source/test/lux/control/parser/code.lux
@@ -92,19 +92,10 @@
(\ int.equivalence = expected_right actual_right)))))))]
[/.form code.form]
+ [/.variant code.variant]
[/.tuple code.tuple]
))
(do [! random.monad]
- [expected_left random.nat
- expected_right random.int]
- (_.cover [/.record]
- (|> (/.result (/.record (<>.and /.nat /.int))
- (list (code.record (list [(code.nat expected_left)
- (code.int expected_right)]))))
- (!expect (^multi (#try.Success [actual_left actual_right])
- (and (\ nat.equivalence = expected_left actual_left)
- (\ int.equivalence = expected_right actual_right)))))))
- (do [! random.monad]
[expected_local random.nat
expected_global random.int]
(_.cover [/.local]
diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux
index 69a2f5ab0..1e694ada1 100644
--- a/stdlib/source/test/lux/macro/code.lux
+++ b/stdlib/source/test/lux/macro/code.lux
@@ -41,12 +41,6 @@
[size (|> random.nat (\ ! each (n.% 3)))]
(random.list size random)))
-(def: (random_record random)
- (All (_ a) (-> (Random a) (Random (List [a a]))))
- (do [! random.monad]
- [size (|> random.nat (\ ! each (n.% 3)))]
- (random.list size (random.and random random))))
-
(def: .public random
(Random Code)
(random.rec
@@ -61,8 +55,8 @@
(random\each /.identifier ..random_name)
(random\each /.tag ..random_name)
(random\each /.form (..random_sequence random))
+ (random\each /.variant (..random_sequence random))
(random\each /.tuple (..random_sequence random))
- (random\each /.record (..random_record random))
))))
(def: (read source_code)
@@ -104,13 +98,8 @@
(random\each /.tag ..random_name)))]
(in [sample sample]))
(for_sequence /.form)
+ (for_sequence /.variant)
(for_sequence /.tuple)
- (do [! random.monad]
- [parts (..random_sequence replacement_simulation)]
- (in [(/.record (let [parts' (list\each product.left parts)]
- (list.zipped/2 parts' parts')))
- (/.record (let [parts' (list\each product.right parts)]
- (list.zipped/2 parts' parts')))]))
)))))
(def: for_format
@@ -141,8 +130,8 @@
[/.tag ..random_name #.Tag]
[/.identifier ..random_name #.Identifier]
[/.form (..random_sequence ..random) #.Form]
- [/.tuple (..random_sequence ..random) #.Tuple]
- [/.record (..random_record ..random) #.Record]))
+ [/.variant (..random_sequence ..random) #.Variant]
+ [/.tuple (..random_sequence ..random) #.Tuple]))
(~~ (template [<coverage> <random> <tag>]
[(do [! random.monad]
[expected <random>]
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index ce832a8cf..fa5e55c24 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -31,7 +31,6 @@
[\\library
["[0]" /]]
["[0]" / "_"
- ["[1][0]" annotation]
["[1][0]" location]])
(template: (!expect <pattern> <value>)
@@ -945,6 +944,5 @@
..locals_related
))
- /annotation.test
/location.test
)))
diff --git a/stdlib/source/test/lux/meta/annotation.lux b/stdlib/source/test/lux/meta/annotation.lux
deleted file mode 100644
index 3dae7f7b9..000000000
--- a/stdlib/source/test/lux/meta/annotation.lux
+++ /dev/null
@@ -1,125 +0,0 @@
-(.module:
- [library
- [lux "*"
- ["_" test {"+" [Test]}]
- [abstract
- [monad {"+" [do]}]]
- [control
- ["[0]" try {"+" [Try]}]]
- [data
- ["[0]" product]
- ["[0]" bit]
- ["[0]" name ("[1]\[0]" equivalence)]
- ["[0]" text]
- [collection
- ["[0]" list ("[1]\[0]" functor)]]]
- [macro
- ["[0]" code ("[1]\[0]" equivalence)]]
- [math
- ["[0]" random {"+" [Random]}]
- [number
- ["[0]" nat]
- ["[0]" int]
- ["[0]" rev]
- ["[0]" frac]]]]]
- [///
- [macro
- ["_[0]" code]]]
- [\\library
- ["[0]" /]])
-
-(def: random_key
- (Random Name)
- (random.and (random.ascii/alpha 1)
- (random.ascii/alpha 1)))
-
-(def: (random_sequence random)
- (All (_ a) (-> (Random a) (Random (List a))))
- (do [! random.monad]
- [size (|> random.nat (\ ! each (nat.% 3)))]
- (random.list size random)))
-
-(def: (random_record random)
- (All (_ a) (-> (Random a) (Random (List [a a]))))
- (do [! random.monad]
- [size (|> random.nat (\ ! each (nat.% 3)))]
- (random.list size (random.and random random))))
-
-(template: (!expect <pattern> <value>)
- [(case <value>
- <pattern> true
- _ false)])
-
-(def: (annotation key value)
- (-> Name Code /.Annotation)
- (code.record (list [(code.tag key)
- value])))
-
-(def: typed_value
- Test
- (do [! random.monad]
- [key ..random_key]
- (`` ($_ _.and
- (~~ (template [<definition> <random> <constructor> <equivalence>]
- [(do [! random.monad]
- [expected <random>]
- (_.cover [<definition>]
- (|> expected <constructor>
- (..annotation key)
- (<definition> key)
- (!expect (^multi (#.Some actual)
- (\ <equivalence> = expected actual))))))]
-
- [/.bit random.bit code.bit bit.equivalence]
- [/.nat random.nat code.nat nat.equivalence]
- [/.int random.int code.int int.equivalence]
- [/.rev random.rev code.rev rev.equivalence]
- [/.frac random.safe_frac code.frac frac.equivalence]
- [/.text (random.ascii/alpha 1) code.text text.equivalence]
- [/.identifier ..random_key code.identifier name.equivalence]
- [/.tag ..random_key code.tag name.equivalence]
- [/.form (..random_sequence _code.random) code.form (list.equivalence code.equivalence)]
- [/.tuple (..random_sequence _code.random) code.tuple (list.equivalence code.equivalence)]
- [/.record (..random_record _code.random) code.record (list.equivalence (product.equivalence code.equivalence code.equivalence))]
- ))
- ))))
-
-(def: flag
- Test
- (do [! random.monad]
- [key ..random_key]
- (`` ($_ _.and
- (do !
- [dummy (random.only (|>> (name\= key) not)
- ..random_key)
- expected random.bit]
- (_.cover [/.flagged?]
- (and (|> expected code.bit
- (..annotation key)
- (/.flagged? key)
- (\ bit.equivalence = expected))
- (not (|> expected code.bit
- (..annotation dummy)
- (/.flagged? key))))))
- ))))
-
-(def: .public test
- Test
- (<| (_.covering /._)
- (_.for [/.Annotation])
- (do [! random.monad]
- [key ..random_key]
- ($_ _.and
- (do !
- [expected _code.random]
- (_.cover [/.value]
- (|> expected
- (..annotation key)
- (/.value key)
- (!expect (^multi (#.Some actual)
- (code\= expected actual))))))
-
- ..typed_value
-
- ..flag
- ))))