Reva: Unit testing

The word [IFTEST] has been around for a long time in Reva. It is an interpret-mode conditional like [IF], which is true if there is a word TESTING defined. Starting Reva with a '-t' command-line option creates such a word, loads the 'testing' library, and also runs the word 'test'... which commences a series of "unit tests".

One example of how the testing library is used can be seen in the tests/test.f file, which is uses for regression testing against reported bugs. Another example is the newly added examples/testing.f, which shows how one would normally use the library.

A handful of libraries currently have unit tests. I will be going over all the libraries and adding unit tests to the majority of them in the next period, before the next release of Reva.

I have found unit tests an excellent and painless way to improve code quality, and I encourage other Reva users to take advantage of the test framework built-in to Reva.

As a simple example:

[IFTEST]
test: Sample, always succeeds
	true ;

test: Another one, always fails
	false ;
[THEN]

If the library or code file in which this snippet exists is run with the '-t' command-line option, the testing library will run each test: in turn, and report the results afterwords.