2019-11-28 05:16:14 +13:00
|
|
|
Zint backend test suite
|
|
|
|
-----------------------
|
|
|
|
|
2019-12-19 13:37:55 +13:00
|
|
|
To make, first make libzint with ZINT_TEST defined:
|
|
|
|
|
|
|
|
cd <project-dir>
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2020-04-09 08:19:30 +12:00
|
|
|
cmake -DZINT_TEST:BOOL=1 ..
|
2019-12-19 13:37:55 +13:00
|
|
|
make
|
|
|
|
|
|
|
|
Then make the tests:
|
2019-11-28 05:16:14 +13:00
|
|
|
|
|
|
|
cd <project-dir>
|
|
|
|
cd backend/tests
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2020-04-09 08:19:30 +12:00
|
|
|
cmake -DZINT_TEST:BOOL=1 ..
|
2019-11-28 05:16:14 +13:00
|
|
|
make
|
|
|
|
|
2019-12-19 13:37:55 +13:00
|
|
|
(ZINT_TEST is needed to export INTERNAL functions for use and testing.)
|
|
|
|
|
2020-05-06 09:28:25 +12:00
|
|
|
------------------------------------------------------------------------------
|
2019-11-28 05:16:14 +13:00
|
|
|
|
2020-05-06 09:28:25 +12:00
|
|
|
To run all tests (within <project-dir>/backend/tests/build):
|
|
|
|
|
|
|
|
ctest
|
2019-11-28 05:16:14 +13:00
|
|
|
|
|
|
|
To run individual tests, eg:
|
|
|
|
|
|
|
|
./test_common
|
|
|
|
./test_vector
|
|
|
|
|
2020-05-06 09:28:25 +12:00
|
|
|
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
|
|
|
|
|
2020-07-16 06:00:12 +12:00
|
|
|
(for other flags see <project-dir>/backend/tests/testcommon.h)
|
|
|
|
|
2020-05-06 09:28:25 +12:00
|
|
|
To generate test data, use '-g':
|
|
|
|
|
|
|
|
./test_dotcode -f encode -g
|
|
|
|
|
2020-07-16 06:00:12 +12:00
|
|
|
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)
|
|
|
|
|
2020-05-06 09:28:25 +12:00
|
|
|
------------------------------------------------------------------------------
|
|
|
|
|
2019-11-28 05:16:14 +13:00
|
|
|
To make with gcc sanitize, first set for libzint and make:
|
|
|
|
|
|
|
|
cd <project-dir>
|
|
|
|
cd build
|
|
|
|
cmake -DZINT_SANITIZE:BOOL=1 ..
|
|
|
|
make && sudo make install
|
|
|
|
|
|
|
|
Then set for tests and make:
|
|
|
|
|
|
|
|
cd <project-dir>
|
|
|
|
cd backend/tests/build
|
|
|
|
cmake -DZINT_SANITIZE:BOOL=1 ..
|
|
|
|
make
|
|
|
|
|
|
|
|
Similarly to make with gcc debug:
|
|
|
|
|
|
|
|
cd <project-dir>
|
|
|
|
cd build
|
|
|
|
cmake -DZINT_DEBUG:BOOL=1 ..
|
|
|
|
make && sudo make install
|
|
|
|
|
|
|
|
cd <project-dir>
|
|
|
|
cd backend/tests/build
|
|
|
|
cmake -DZINT_DEBUG:BOOL=1 ..
|
|
|
|
make
|
|
|
|
|
|
|
|
To undo sanitize/debug, remake each after setting:
|
|
|
|
|
|
|
|
cmake -DZINT_SANITIZE:BOOL=0 ..
|
|
|
|
cmake -DZINT_DEBUG:BOOL=0 ..
|
|
|
|
|
2019-12-19 13:37:55 +13:00
|
|
|
To get a clean libzint, set the above and also:
|
|
|
|
|
|
|
|
cmake -DZINT_TEST:BOOL=0 ..
|
|
|
|
|
|
|
|
(The tests will now fail to link.)
|