When developing a grammar, it is important to check that existing input configurations remain compatible whenever the grammar is changed. To this end, FUF includes a regression testing mechanism an a test system. This system allows the grammar developer to define a set of test cases, which are pairs of input FDs together with the sentence they are expected to produce. The test system allows to run a series of tests and checks whether the output is equal to the expected output, it can in addition measure the time spent on each test. A final advantage of the test facility is that test definitions can use the :& notation and therefore big FD specifications can be written modularly.
The following functions are defined to take advantage of this facility:
(def-test name result input)
;; Define a named test: test on input should produce result.
;; If result is a list, testing result can produce any one of the elements
;; of result.
|
When running the tests, the following output is produced:
FUG5 12> (test :item '(t1 t14 t212))
|
If a test does not succeed, the following output is produced:
FUG5 14> (test :item 't1bis)
|