class TEST |
---|
**** | To be included by a testing class. The test routine should start with the call `class_name("CLASS_FOO");'. It should then have calls to `test' or `unchecked_test' which actually perform the test. It should end with `finish' to print out the results. The results are sent to both `stderr' and `stdout' so you can redirect output to a file and still see whether all tests were passed. The routine being tested must return a string. The basic classes all have routines named `str' to produce string representations of themselves. A typical test might look something like: `test("sum", (1+1).str, "2");'. The tests are numbered and the failures are summarized at the end. |
shared checked_tests:INT; |
---|
shared class_name_str:STR; |
---|
**** | The name of the tested class. |
shared failure_docs:FLIST{STR}; |
---|
**** | The documentation of the failures. |
shared failures:FLIST{INT}; |
---|
**** | The tests which failed. |
shared test_number:INT; |
---|
**** | Which test. |
shared checked_tests:INT; |
---|
shared class_name_str:STR; |
---|
**** | The name of the tested class. |
shared failure_docs:FLIST{STR}; |
---|
**** | The documentation of the failures. |
shared failures:FLIST{INT}; |
---|
**** | The tests which failed. |
shared test_number:INT; |
---|
**** | Which test. |
class_name(nm:STR) |
---|
**** | Specify the name of the class being tested. Must be called first. |
finish |
---|
**** | Complete the testing on the current class. |
raise_test(testname:$STR,testrout:ROUT:FMT,should:STR) |
---|
**** | Performs the test with the desciption 'doc'. The routine 'testrout' is expected to raise an exception with the string representation 'should'. |
test(doc_ds,does_ds,should_ds:$STR) |
---|
**** | Perform the test with the description `doc', return value `does', and desired return value `should'. Keep track of failures. |
unchecked_test(doc_ds,does_ds,should_ds:$STR) |
---|
**** | Perform the test with the description `doc', return value `does', and desired return value `should'. Don't keep track of failures. |