diff options
author | Eduardo Julian | 2022-08-10 19:38:43 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-08-10 19:38:43 -0400 |
commit | 68d78235694c633c956bb9e8a007cad7d65370bc (patch) | |
tree | f84fcb298d29d3c85d149fd2f3c94f31b59305d4 /stdlib/source/documentation/lux/test.lux | |
parent | 6ec8f5d2f6cbf8db45f91e5c4b48c6ec17659f72 (diff) |
Extracted property-based testing machinery into its own module.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/documentation/lux/test.lux | 118 |
1 files changed, 19 insertions, 99 deletions
diff --git a/stdlib/source/documentation/lux/test.lux b/stdlib/source/documentation/lux/test.lux index 467b04150..7787512c5 100644 --- a/stdlib/source/documentation/lux/test.lux +++ b/stdlib/source/documentation/lux/test.lux @@ -1,104 +1,24 @@ (.require [library - [lux (.except and for) + [lux (.except) ["$" documentation] [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]]]] + [collection + ["[0]" list (.use "[1]#[0]" monoid)]]]]] [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "Tools for unit & property-based/generative testing." - [($.definition /.must_try_test_at_least_once) - ($.definition /.error_during_execution) - - ($.definition /.Tally - "A record of successes and failures while executing tests.") - - ($.definition /.Assertion - "An asynchronous operation that yields test results.") - - ($.definition /.Test - "A test that relies on random data generation to thoroughly cover different scenarios.") - - ($.definition /.and' - "Sequencing combinator (for assertions)." - [(and' left right)]) - - ($.definition /.and - "Sequencing combinator." - [(and left right)]) - - ($.definition /.context - "Adds a contextual description to a test's documentation." - [(context description)]) - - ($.definition /.failure - "A failing test, with a given error message.") - - ($.definition /.assertion - "Check that a condition is #1, and fail with the given message otherwise." - [(assertion message condition)]) - - ($.definition /.property - "Check that a condition is #1, and fail with the given message otherwise." - [(property message condition)]) - - ($.definition /.lifted - "" - [(lifted message random)]) - - ($.definition /.Seed - "The seed value used for random testing (if that feature is used).") - - ($.definition /.seed - (format "Execute the given test with a specific seed value." - \n "This allows you to reproduce a failing test case as many times as you want while debugging.") - [(seed value test)]) - - ($.definition /.times - (format "Allows executing a test several times." - \n "By doing this, it's possible to thoroughly test code with many different scenarios." - \n "This assumes that random data generation is being used in tests instead of fixed/constant inputs.") - [(times amount test)]) - - ($.definition /.run! - (format "Executes a test, and exits the program with either a successful or a failing exit code." - \n "WARNING: This procedure is only meant to be used in (program ...) forms.") - [(run! test)]) - - ($.definition /.coverage' - (format "Specifies a test as covering one or more definitions." - \n "Adds to the test tally information to track which definitions have been tested.") - [(coverage' [definition/0 definition/1 ,,, definition/N] - (is Bit - (some "computation")))]) - - ($.definition /.coverage - (format "Specifies a test as covering one or more definitions." - \n "Adds to the test tally information to track which definitions have been tested.") - [(coverage [definition/0 definition/1 ,,, definition/N] - (is Bit - (some "computation")))]) - - ($.definition /.for - (format "Specifies a context for tests as covering one or more definitions." - \n "Adds to the test tally information to track which definitions have been tested.") - [(for [definition/0 definition/1 ,,, definition/N] - (is Test - some_test))]) - - ($.definition /.covering - (format "Specifies the module being covered by a test." - \n "Adds tracking information to the tally to know which exported definitions in the module need to be covered.") - [(covering .._ - (is Test - some_test))]) - - ($.definition /.in_parallel - "Executes multiple tests in parallel (if the host platform supports it) to take advantage of multiple cores." - [(in_parallel tests)])] - [])) + ["[0]" / + ["[1]" property]]] + ["[0]" / + ["[1][0]" coverage] + ["[1][0]" property] + ["[1][0]" tally] + ["[1][0]" unit]]) + +(def .public documentation + (List $.Documentation) + (all list#composite + /coverage.documentation + /property.documentation + /tally.documentation + /unit.documentation + )) |