Test Support
1 Using Check Forms
(require test-engine/racket-tests) | package: htdp-lib |
This module provides test forms for use in Racket programs, as well as parameters to configure the behavior of test reports.
Each check form may only occur at the top-level; results are collected and reported by the test function. Note that the check forms only register checks to be performed. The checks are actually run by the test function.
syntax
(check-expect expr expected-expr)
It is an error for expr or expected-expr to produce a function value or an inexact number.
syntax
(check-random expr expected-expr)
The form supplies the same random-number generator to both parts. If both parts request random numbers from the same interval in the same order, they receive the same random numbers.
Examples: | |||||||||||||
|
If the two parts call random for different intervals, they are likely to fail:
Examples: | ||||||||||||||
|
It is an error for expr or expected-expr to produce a function value or an inexact number.
syntax
(check-within expr expected-expr delta-expr)
delta-expr : number?
It is an error for expr or expected to produce a function value.
syntax
(check-error expr)
(check-error expr msg-expr)
msg-expr : string?
syntax
(check-member-of expr expected-expr ...)
It is an error for expr or any of the expected-exprs to produce a function value or an inexact number.
syntax
(check-range expr min-expr max-expr)
expr : number?
min-expr : number?
max-expr : number?
syntax
(test)
parameter
(test-format) → (any/c . -> . string?)
(test-format format) → void? format : (any/c . -> . string?)
parameter
(test-silence) → boolean?
(test-silence silence?) → void? silence? : any/c
parameter
(test-execute) → boolean?
(test-execute execute?) → void? execute? : any/c
2 GUI Interface
(require test-engine/racket-gui) | package: htdp-lib |
This module requires produces an independent window when displaying test results. It provides the same bindings as test-engine/racket-tests.