|Version 18 (modified by benl, 6 years ago)|
The war2 test driver automates regression testing.
$ bin/war2 test
This tool descends into the given directory, and runs any tests it finds.
- For subdirectories containing a Main.ds file, it builds and executes that program. The resulting binary is named Main.bin and placed in the same directory as the source. If there is also a Main.stdout file, then checks the program's output against this expected output. If there is any difference it prompts the user whether to stop testing, or update the expected output.
- For subdirectories that do not contain a Main.ds, it simply compiles all the source files there.
- If a subdirectory contains a Module.error.check file, where Module is some arbitrary module name, then compilation is expected to fail with the error message given by that check file.
Regression tests require the base libraries to be built. So before running them you may need to do a:
$ bin/ddc -O -build library/Prelude.ds
We've started to add Quick Check style properties to the DDC code. There are some examples in src/Util/Data/List/Split.hs. We're using src/Util/Test/Check.hs as a wrapper around the standard Quick Check library.
You can run the tests with:
$ bin/ddc --test
The programs in test/93-Graphics can open up X windows and display pretty pictures. When run with no arguments they dump their final frame as a PPM image to stdout. When run with "-x" they open up an X window an display the animation in real-time.
$ bin/war2 test/93-Graphics +compway opt -O $ test/93-Graphics/Styrene/Main.bin -x
You can also compile and run demos individually with something like:
$ bin/ddc -O -make demo/Graphics/Styrene/Main.ds -o styrene $ ./styrene -x
Note that DDC's -make flag will rebuild any module needed by the program being compiled, including modules in the base libraries. This can be useful when working on the libraries, or on DDC's -make support.
For example, we can clean out all the binaries in the library, test and demo directories with:
$ make cleanWar
We can then rebuild the whole styrene program with:
$ bin/ddc -O -make demo/Graphics/Styrene/Main.ds -o styrene