From e3dc47dafccb1d21a5c162e4329afd72ddb00650 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 19 Jan 2022 16:43:04 -0400 Subject: Cleaner test reporting. --- .../compiler/language/lux/analysis/pattern.lux | 8 +++++- .../tool/compiler/language/lux/phase/extension.lux | 10 +++++++ .../lux/tool/compiler/meta/archive/artifact.lux | 21 ++++---------- .../compiler/meta/archive/artifact/category.lux | 32 ++++++++++++++++++++++ 4 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 stdlib/source/test/lux/tool/compiler/meta/archive/artifact/category.lux (limited to 'stdlib/source/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 85a701185..e5eb0c0f5 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 @@ -43,11 +43,17 @@ expected_text (random.ascii/lower 2) expected_lefts random.nat - expected_right? random.bit]) + expected_right? random.bit + + left ..random + right ..random]) (`` ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) + (_.cover [/.format] + (bit#= (# /.equivalence = left right) + (text#= (/.format left) (/.format right)))) (_.cover [/.unit] (case (/.unit) (^ (/.unit)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension.lux index 517d5eb57..ab2af87eb 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension.lux @@ -257,6 +257,16 @@ _ false)))) + (_.cover [/.up] + (|> (do phase.monad + [] + (in expected)) + (: (/.Operation Int Nat Nat Nat)) + /.up + (: (phase.Operation Int Nat)) + (# phase.functor each (same? expected)) + (phase.result state) + (try.else false))) )) (_.for [/.State] ..test|state) diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/artifact.lux index b241b0c46..2bb161796 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/archive/artifact.lux @@ -6,22 +6,12 @@ [\\specification ["$[0]" equivalence]]] [math - ["[0]" random {"+" Random} ("[1]#[0]" monad)]]]] + ["[0]" random {"+" Random}]]]] + ["[0]" / "_" + ["[1][0]" category]] [\\library ["[0]" /]]) -(def: random_category - (Random /.Category) - ($_ random.or - (random#in []) - (random.ascii/lower 1) - (random.ascii/lower 2) - (random.ascii/lower 3) - (random.ascii/lower 4) - (random.ascii/lower 5) - (random.ascii/lower 6) - )) - (def: random_dependency (Random /.Dependency) ($_ random.and @@ -33,9 +23,8 @@ (Random /.Artifact) ($_ random.and random.nat - ..random_category + /category.random random.bit - (random.set /.dependency_hash 5 ..random_dependency) )) (def: .public test @@ -45,4 +34,6 @@ ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) + + /category.test ))) diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/artifact/category.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/artifact/category.lux new file mode 100644 index 000000000..8f31cca51 --- /dev/null +++ b/stdlib/source/test/lux/tool/compiler/meta/archive/artifact/category.lux @@ -0,0 +1,32 @@ +(.using + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [\\specification + ["$[0]" equivalence]]] + [math + ["[0]" random {"+" Random} ("[1]#[0]" monad)]]]] + [\\library + ["[0]" /]]) + +(def: .public random + (Random /.Category) + ($_ random.or + (random#in []) + (random.ascii/lower 1) + (random.ascii/lower 2) + (random.ascii/lower 3) + (random.ascii/lower 4) + (random.ascii/lower 5) + (random.ascii/lower 6) + )) + +(def: .public test + Test + (<| (_.covering /._) + (_.for [/.Category]) + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + ))) -- cgit v1.2.3