Next: checks result, Previous: checks select, Up: checks [Index]
Evaluate expr and compare its return value to the return value of
expected using the predicate equal, which is equal?
when omitted. Then a report is printed according to the current mode
setting (see below) and the outcome is recorded in a global state to be
used in check-report.
The precise order of evaluation is that first equal and
expected are evaluated (in unspecified order) and then expr
is evaluated. Example: (check (+ 1 1) => 2).
When name is given: it is the name of this test, Selecting tests to be run.
Print a summary and the first failed check, if there is any, depending
on the current mode settings. Call exit to exit the current
process with code:
0If all the tests were run successfully.
1If at least one test failed.
Set the current mode to mode, which must be a symbol among:
off, summary, report-failed, report; the
default is report. Note that you can change the mode at any
time, and that check and check-report use the current
value.
The mode symbols have the following meaning:
offdo not execute any of the checks;
summaryprint only summary in check-report and nothing else;
report-failedreport failed checks when they happen, and in summary;
reportreport every example executed.
Reset the global state (counters of correct/failed examples) to the state immediately after loading the module for the first time, i.e. no checks have been executed.
Return #t if there were no failed checks and
expected-total-count correct checks, #f otherwise.
Rationale: This procedure can be used in automatized tests by terminating a test program with the statement:
(exit (if (check-passed? n) 0 1))
Evaluate all the forms as in begin. If an exception is
raised: return #f.
Evaluate expr in a check form, expecting a non–false or
#f value as result.
When name is given: it is the name of this test, Selecting tests to be run.
Expand to:
(check
(guard (E ((assertion-violation? E)
(list (condition-who E)
(condition-irritants E))
(else E))
?body)
=> ?expected-who/irritants))
Expand to:
(check
(guard (E ((procedure-argument-violation? E)
(list (condition-who E)
(condition-irritants E))
(else E))
?body)
=> ?expected-who/irritants))
Expand to:
(check
(guard (E ((procedure-argument-violation? E)
(list (condition-who E)
(procedure-argument-violation.one-based-argument-index E)
(procedure-argument-violation.failed-expression E)
(procedure-argument-violation.offending-value E)))
(else E))
?body)
=> ?expected-who/irritants)
Expand to:
(check
(guard (E ((procedure-signature-return-value-violation? E)
(list (condition-who E)
(procedure-signature-return-value-violation.one-based-return-value-index E)
(procedure-signature-return-value-violation.failed-expression E)
(procedure-signature-return-value-violation.offending-value E)))
(else E))
?body)
=> ?expected-who/irritants)
Expand to:
(check
(guard (E ((procedure-arguments-consistency-violation? E)
(list (condition-who E)
(condition-irritants E)))
(else E))
?body)
=> ?expected-who/irritants)
Expand to:
(check
(guard (E ((expression-return-value-violation? E)
(list (condition-who E)
(condition-irritants E)))
(else E))
?body)
=> ?expected-who/irritants)
Next: checks result, Previous: checks select, Up: checks [Index]