This will pick up the local copies of the test data by default, without
needing to create a subdirectory in the backend/tests path and executing
the tests from there. The Current Working Directory can be set if this
proves to be insufficient
Zint backend test suite
-----------------------
To make, first make libzint with ZINT_TEST defined:
cd <project-dir>
mkdir build
cd build
cmake -DZINT_TEST=ON ..
make
Then make the tests:
cd <project-dir>
cd backend/tests
mkdir build
cd build
cmake -DZINT_TEST=ON ..
make
(ZINT_TEST is needed to export INTERNAL functions for use and testing.)
------------------------------------------------------------------------------
To run all tests (within <project-dir>/backend/tests/build):
ctest
To run individual tests, eg:
./test_common
./test_vector
To run a single test function within an individual test, use '-f <func-name>':
./test_common -f utf8_to_unicode
./test_dotcode -f input
To run a single dataset item in a single test function, use '-i <index>':
./test_dotcode -f input -i 2
To show debug info (if any), use '-d <flag>':
./test_dotcode -f input -i 2 -d 1
(for other flags see <project-dir>/backend/tests/testcommon.h)
To generate test data, use '-g':
./test_dotcode -f encode -g
To run a test against BWIPP (if any), use '-d 128':
./test_composite -d 128
(see also <project-dir>/backend/tests/tools/run_bwipp_tests.sh)
------------------------------------------------------------------------------
To make with gcc sanitize, first set for libzint and make:
cd <project-dir>
cd build
cmake -DZINT_SANITIZE=ON ..
make && sudo make install
Then set for tests and make:
cd <project-dir>
cd backend/tests/build
cmake -DZINT_SANITIZE=ON ..
make
Similarly to make with gcc debug:
cd <project-dir>
cd build
cmake -DZINT_DEBUG=ON ..
make && sudo make install
cd <project-dir>
cd backend/tests/build
cmake -DZINT_DEBUG=ON ..
make
To undo sanitize/debug, remake each after setting:
cmake -DZINT_SANITIZE=OFF ..
cmake -DZINT_DEBUG=OFF ..
To get a clean libzint, set the above and also:
cmake -DZINT_TEST=OFF ..
(The tests will now fail to link.)