diff options
author | Eduardo Julian | 2022-01-15 02:17:35 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-01-15 02:17:35 -0400 |
commit | e1af5374ba4d969f866867db47af7ecf60cc9933 (patch) | |
tree | 8aa83faa67253d5beab931f4950bb319204a2944 /stdlib/source/test | |
parent | 68a17d42bab808290de0d975f4083b52b37d0706 (diff) |
Fixed a logging/reporting issue for Lux/JS.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/tool.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/tool/compiler/language/lux/analysis/simple.lux (renamed from stdlib/source/test/lux/tool/compiler/language/lux/analysis/primitive.lux) | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/tool/compiler/meta/archive/document.lux | 93 |
4 files changed, 102 insertions, 7 deletions
diff --git a/stdlib/source/test/lux/tool.lux b/stdlib/source/test/lux/tool.lux index 79d25b75e..736c8757c 100644 --- a/stdlib/source/test/lux/tool.lux +++ b/stdlib/source/test/lux/tool.lux @@ -12,7 +12,7 @@ [lux ... ["[1][0]" syntax] ["[1][0]" analysis "_" - ["[1]/[0]" primitive] + ["[1]/[0]" simple] ["[1]/[0]" composite] ["[1]/[0]" pattern]] ... [phase @@ -22,7 +22,8 @@ ["[1][0]" meta "_" ["[1]/[0]" archive "_" ["[1]/[0]" signature] - ["[1]/[0]" key]]] + ["[1]/[0]" key] + ["[1]/[0]" document]]] ]]) (def: .public test @@ -32,11 +33,12 @@ /version.test /reference.test /phase.test - /analysis/primitive.test + /analysis/simple.test /analysis/composite.test /analysis/pattern.test /meta/archive/signature.test /meta/archive/key.test + /meta/archive/document.test ... /syntax.test ... /analysis.test ... /synthesis.test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux index b4ee9e9c8..7a1d4c66d 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux @@ -16,7 +16,7 @@ [\\library ["[0]" /]] ["[0]" // "_" - ["[1][0]" primitive] + ["[1][0]" simple] ["[1][0]" composite]]) (def: .public random @@ -24,7 +24,7 @@ (random.rec (function (_ random) ($_ random.or - //primitive.random + //simple.random (//composite.random 4 random) random.nat )))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/simple.lux index 3c88cd1e5..e7c22559f 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/simple.lux @@ -17,7 +17,7 @@ ["[0]" /]]) (def: .public random - (Random /.Primitive) + (Random /.Simple) ($_ random.or (random#in []) random.bit @@ -31,7 +31,7 @@ (def: .public test Test (<| (_.covering /._) - (_.for [/.Primitive]) + (_.for [/.Simple]) ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/document.lux new file mode 100644 index 000000000..749dcdd09 --- /dev/null +++ b/stdlib/source/test/lux/tool/compiler/meta/archive/document.lux @@ -0,0 +1,93 @@ +(.using + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + [pipe {"+" case>}] + ["[0]" try ("[1]#[0]" functor)] + ["[0]" exception] + [parser + ["<[0]>" binary]]] + [data + [format + ["[0]F" binary]]] + [math + ["[0]" random] + [number + ["[0]" nat]]]]] + [\\library + ["[0]" / + [// + ["[1][0]" signature ("[1]#[0]" equivalence)] + ["[1][0]" key]]]] + ["[0]" // "_" + ["[1][0]" signature]]) + +(def: .public test + Test + (<| (_.covering /._) + (_.for [/.Document]) + (do random.monad + [signature/0 //signature.random + signature/1 (random.only (|>> (/signature#= signature/0) not) + //signature.random) + .let [key/0 (/key.key signature/0 0) + key/1 (/key.key signature/1 0)] + expected random.nat] + ($_ _.and + (_.cover [/.document /.content] + (|> expected + (/.document key/0) + (/.content key/0) + (try#each (same? expected)) + (try.else false))) + (_.cover [/.signature] + (|> expected + (/.document key/0) + /.signature + (same? signature/0))) + (_.cover [/.marked?] + (and (|> expected + (/.document key/0) + (/.marked? key/0) + (case> {try.#Success it} true + {try.#Failure error} false)) + (|> expected + (/.document key/0) + (/.marked? key/1) + (case> {try.#Success it} false + {try.#Failure error} true)))) + (_.cover [/.invalid_signature] + (and (|> expected + (/.document key/0) + (/.content key/1) + (case> {try.#Success it} + false + + {try.#Failure error} + (exception.match? /.invalid_signature error))) + (|> expected + (/.document key/0) + (/.marked? key/1) + (case> {try.#Success it} + false + + {try.#Failure error} + (exception.match? /.invalid_signature error))))) + (_.cover [/.writer /.parser] + (|> expected + (/.document key/0) + (binaryF.result (/.writer binaryF.nat)) + (<binary>.result (/.parser <binary>.nat)) + (case> {try.#Success it} + (and (/signature#= signature/0 (/.signature it)) + (|> it + (/.content key/0) + (try#each (nat.= expected)) + (try.else false))) + + {try.#Failure error} + false))) + )))) |