zint/backend/tests
Schaich afea0ad2c3 Get test_library compiled on windows
test_file_unreadable cannot be implemented easily, as files are always
readable by their owner on windows. While `_chmod` is available in the POSIX
compatibility function set, it cannot be used to take away read permissions,
either.

While here, move functional code out of any assert statements. It shall be
executed even when the assertions are disabled
2021-06-10 21:00:42 +09:00
..
cmake/Modules Remove further refs to QZint; win32/README; add zintconfig.h to Win make files 2020-11-24 22:22:12 +00:00
data png: ULTRA: allow for fgcolour if bind/box, bug introduced by [ed3cc5] (MR #111) 2021-05-28 14:37:57 +01:00
tools CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
CMakeLists.txt CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
README CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_2of5.c C25STANDARD/C25INTER/C25IATA/C25LOGIC/C25IND: add check digit option (#216) 2021-05-17 20:04:00 +01:00
test_auspost.c DATAMATRIX: make EOD encodation strictly ISO 16022 compliant 2021-02-23 00:01:15 +00:00
test_aztec.c AZTEC: optimize populate_map (good for small data) 2021-05-27 18:33:19 +01:00
test_big5_tab.h eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
test_big5.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_bmp.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_channel.c DATAMATRIX: make EOD encodation strictly ISO 16022 compliant 2021-02-23 00:01:15 +00:00
test_codablock.c DATAMATRIX: make EOD encodation strictly ISO 16022 compliant 2021-02-23 00:01:15 +00:00
test_code1.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_code16k.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_code49.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_code128.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_code.c DATAMATRIX: make EOD encodation strictly ISO 16022 compliant 2021-02-23 00:01:15 +00:00
test_common.c Fix "most" compilation issues MSVC has 2021-06-02 21:14:14 +09:00
test_composite.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_dmatrix.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_dotcode.c DOTCODE: allow for max 200 cols in CLI, GUI, Tcl; more detailed size error messages 2021-05-28 15:05:06 +01:00
test_eci.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_emf.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_gb2312_tab.h eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
test_gb2312.c Fix "most" compilation issues MSVC has 2021-06-02 21:14:14 +09:00
test_gb18030_tab.h eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
test_gb18030.c Fix "most" compilation issues MSVC has 2021-06-02 21:14:14 +09:00
test_gif.c #209 suppress CodeQL warnings except CODEONE; simplifications AZTEC_RUNE, MICROPDF417 2020-12-23 10:57:24 +00:00
test_gridmtx.c eci.c: fix bad bug in Korean, return EUC-KR instead of raw KS X 1001 2021-03-20 14:36:21 +00:00
test_gs1.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_hanxin.c eci.c: fix bad bug in Korean, return EUC-KR instead of raw KS X 1001 2021-03-20 14:36:21 +00:00
test_imail.c Move only downwards in the filesystem hierarchy 2021-06-02 21:14:14 +09:00
test_iso3166.c gs1_verify: validate AIs from BWIPP gs1-format-spec.txt 2021-01-18 20:10:52 +00:00
test_iso4217.c gs1_verify: validate AIs from BWIPP gs1-format-spec.txt 2021-01-18 20:10:52 +00:00
test_ksx1001_tab.h eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
test_ksx1001.c eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
test_large.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_library.c Get test_library compiled on windows 2021-06-10 21:00:42 +09:00
test_mailmark.c DATAMATRIX: make EOD encodation strictly ISO 16022 compliant 2021-02-23 00:01:15 +00:00
test_maxicode.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_medical.c DATAMATRIX: make EOD encodation strictly ISO 16022 compliant 2021-02-23 00:01:15 +00:00
test_pcx.c Tabs/typo in zint.h; PostNet -> POSTNET; ui: shortcuts, tooltips; tests inkscape -> libreoffice 2020-10-03 22:51:08 +01:00
test_pdf417.c tests: small additions for AZTEC READER_INIT, PDF417, Big5 2021-04-20 11:49:14 +01:00
test_plessey.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_png.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_postal.c DATAMATRIX: make EOD encodation strictly ISO 16022 compliant 2021-02-23 00:01:15 +00:00
test_print.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_ps.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_qr.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_raster.c Add whitespace_height to zint_symbol (vertical whitespace) 2021-05-25 20:42:26 +01:00
test_reedsol.c HANXIN: 0xFFE terminator; reedsol/AZTEC: stack-based; AZTEC/HANXIN/QR/GRIDMATRIX speedups; #209 2020-11-27 12:54:44 +00:00
test_rss.c DATAMATRIX: make EOD encodation strictly ISO 16022 compliant 2021-02-23 00:01:15 +00:00
test_sjis_tab.h eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
test_sjis.c Fix "most" compilation issues MSVC has 2021-06-02 21:14:14 +09:00
test_svg.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_telepen.c DATAMATRIX: make EOD encodation strictly ISO 16022 compliant 2021-02-23 00:01:15 +00:00
test_tif.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_ultra.c Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
test_upcean.c #218 Prevent buffer overflow in ean_leading_zeroes by checking max lengths 2021-02-25 17:14:49 +00:00
test_vector.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
testcommon.c CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
testcommon.h CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00

Zint backend test suite
-----------------------

In order to build the zint test suite, zint has to be compiled with the
ZINT_TEST option enabled:

  cd <project-dir>
  mkdir build
  cd build
  cmake -DZINT_TEST=ON ..
  make

------------------------------------------------------------------------------

In order to run the test suite, the path of the zint library may need to be
communicated to the runtime linker. On UNIX-like systems, this is done by
exporting LD_LIBRARY_PATH to the path containing the zint library, which is
<build-dir>/backend:

  cd <project-dir>
  cd build
  export LD_LIBRARY_PATH=$(pwd)/backend

Setting LD_LIBRARY_PATH is not required if the zint library to be tested is
installed into a system library path ( /usr/lib for example ) prior to running
the tests.

To run all tests (within <build-dir>):

  ctest

For various useful options, e.g. matching (-R) and excluding (-E) tests, see
https://cmake.org/cmake/help/latest/manual/ctest.1.html#options

Tests can also be run individually, eg:

  backend/tests/test_common
  backend/tests/test_vector

To run a single test function within an individual test, use '-f <func-name>':

  backend/tests/test_common -f utf8_to_unicode
  backend/tests/test_dotcode -f input

To run a single dataset item in a single test function, use '-i <index>':

  backend/tests/test_dotcode -f input -i 2

To show debug info (if any), use '-d <flag>':

  backend/tests/test_dotcode -f input -i 2 -d 1

(for other flags see <project-dir>/backend/tests/testcommon.h)

To generate test data, use '-g':

  backend/tests/test_dotcode -f encode -g

To run a test against BWIPP (if any), use '-d 128':

  backend/tests/test_composite -d 128

(see also <project-dir>/backend/tests/tools/run_bwipp_tests.sh)

------------------------------------------------------------------------------

If the zint library was built with static linkage support, i.e. ZINT_STATIC
is ON, an additional test executable, which uses the zint-static library, will
be built. The static variant of each test shares the test name, but has a
"-static" suffix. For example,

  backend/tests/test_dotcode

would run the dotcode test that uses the shared zint library, while

  backend/tests/test_dotcode-static

runs the same test built against the zint-static library.

------------------------------------------------------------------------------

To make with gcc sanitize, first set for libzint and make:

  cd <project-dir>
  cd build
  cmake -DZINT_SANITIZE=ON ..
  make && sudo make install

Similarly to make with gcc debug:

  cd <project-dir>
  cd build
  cmake -DZINT_DEBUG=ON ..
  make && sudo make install

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.)