This code scaffold uses CxxTest. We recommend using the
docker image euranova/cxxtest, but
installing cxxtest
with the package manager is also an option.
See scripts/
folder.
Start a bash prompt in the docker image, with the code mounted as a volume, using the provided script:
./cpp-env
See https://docs.docker.com/engine/installation for instructions on how to install docker.
In order to run the tests, execute the following command:
make test
make
does the following:
- parse the test file (in our case test/Tests.h) using
cxxtestgen
and generate the C++ code for the test runner, - build the test runner along with the code to be tested using
g++
, - run the test executable.
To remove the build folder, which contains all the generated files:
make clean
When writing tests, it is important to keep the src-files and header-files constants updated in the Makefile if new files are added or removed.
For more information about CxxTest assertions, see CxxTest's documentation
When using cxxtestgen
with the --fog-parser
option, the following warning is
displayed:
WARNING: Couldn't create 'cxxtest.parsetab'.
[Errno 13] Permission denied: '/cxxtest/python/python3/cxxtest/parsetab.py'
This warning can safely be ignored.