Spot-Testing

Topic: Spot-Testing

MOSVM has the ability to perform in-line unit testing. This tool is normally used by software developers--the typical user will likely find little use for it.

Examples of spot-testing may be found in the "test" subdir that came with the MOSVM package. A brief explanation:

These are only valid when spot-testing has been enabled.
enable-spot-tests sets the variable *spot-test? to #t
While this variable returns true, spot-tests will be performed.

(s: expr)

expr is evaluated, and the result is bound to the underscore symbol (_). This symbol will be used in (t:).

(r: expr)

expr is evaluated. If the result is equal? to the previous s: expr's result, nothing happens. Otherwise, an error message is displayed.

Example:

(s: (+ 1 1))
(r: 2)

(t: expr)

expr is evaluated. t: uses the _ variable, unlike r:

Example:

(s: (vector 100))
(t: (= (vector-length _) 100))

If the result of the t: expression is true, nothing happens.
Otherwise, an error message is displayed.

Spot-testing is disabled with disable-spot-tests. This sets *spot-test?* to #f.

This is a very elementary explanation of the spot-testing capability of MOSVM. It is assumed that those who will be using it are already familiar with unit-testing.