Start documenting the testing module.
This commit is contained in:
parent
606fd2dc1e
commit
01f683b957
1 changed files with 30 additions and 3 deletions
33
README.md
33
README.md
|
@ -92,17 +92,44 @@ Support Modules
|
|||
|
||||
### Testing
|
||||
|
||||
This module provides simple syntax forms for (unit) testing of other
|
||||
modules.
|
||||
|
||||
(run-tests name body ...)
|
||||
|
||||
* ```name``` - identifier describing the module being tested
|
||||
* ```body ...``` - test expressions
|
||||
|
||||
Runs all tests specified on the ```body ...```. Firstly it prints
|
||||
"[test] name " at the beginning of the line. Secondly it runs all
|
||||
tests, printing "." for each test successfully passed. If all tests
|
||||
pass, prints " ok." and moves the cursor to the next line.
|
||||
|
||||
In case any of the tests fails, exception is raised and program
|
||||
terminates.
|
||||
|
||||
(test-eq? name expression expected-result)
|
||||
|
||||
* ```name``` - identifier representing the name of the test
|
||||
* ```expression``` - expression to be evaluated
|
||||
* ```expected-result``` - expected result of the test expression
|
||||
|
||||
Evaluates the test ```expression``` and compares the result with
|
||||
```expected-result``` using ```eq?```. If the comparison fails, an
|
||||
exception is raised with the ```name``` of the test added to the
|
||||
exception. If the test passes, prints "." like all tests from this
|
||||
module do.
|
||||
|
||||
### Utils
|
||||
|
||||
To ensure there are no external dependencies (including chicken eggs),
|
||||
this module re-implements any basic procedures which are required for
|
||||
any algorithms used.
|
||||
|
||||
#### Filter
|
||||
|
||||
(filter pred? lst)
|
||||
|
||||
* ```pred?``` - procedure accepting any value and returning #t or #f
|
||||
* ```lst``` - list to be filtered
|
||||
|
||||
Returns a list containing only elements matching given ```pred?``` predicate.
|
||||
Returns a list containing only elements matching given ```pred?```
|
||||
predicate.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue