zint/backend/tests
gitlost 7c1bdba8ae output: use doubles when converting in out_colour_get_rgb()
and `out_colour_get_cmyk()`, to lessen chances of rounding
  errors (in particular for VC6)
test_large: fix regression in change to test for formatting
  `uint64_t` for `printf()`
win32/README: update MinGW/MSYS Qt version
2024-01-19 09:28:03 +00: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 - raster/BMP/GIF/PCX/TIF: fix dealing with very large data (use 2023-12-22 21:29:54 +00:00
fuzz general: use explicit float consts rather than calced ones 2024-01-09 18:38:21 +00:00
tools Add fuzz stuff ("backend/tests/fuzz"), including OSS-Fuzz 2024-01-04 20:11:04 +00:00
CMakeLists.txt Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
README - BMP/EMF/PCX/TIF: fix endianness on big-endian machines (note TIF 2024-01-17 01:45:45 +00:00
test_2of5.c CODE11/C25XXX/CODE39/EXCODE39/HIBC_39/CODE93/CODABAR/PLESSEY/ 2023-11-22 00:45:30 +00:00
test_auspost.c CODE128: allow for extended latching (double FNC4) spanning 2022-10-13 13:33:59 +01:00
test_aztec.c AZTEC: change max byte count from assert() to if as overlong data 2024-01-04 22:43:41 +00:00
test_bc412.c test suite: convert to use test context p_ctx instead of individual 2022-09-12 19:26:04 +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 QROCDE/UPNQR: add FAST_MODE (try 4 not 8 masks automatically) 2022-12-05 10:11:36 +00:00
test_bmp.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
test_channel.c test suite: convert to use test context p_ctx instead of individual 2022-09-12 19:26:04 +01:00
test_codablock.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
test_code1.c UPCA_CC/EANX_CC: fix out-of-bounds crash in AI resolve loop in 2023-11-28 08:58:56 +00:00
test_code16k.c EAN/UPC: add quiet zone indicators option (API output_options 2023-06-12 01:25:55 +01:00
test_code49.c - API/CLI/Tcl/GUI: new output option BARCODE_BIND_TOP/--bindtop/ 2022-11-10 22:13:41 +00:00
test_code128.c zint.h: increase symbol->text size 160 -> 200; 2023-11-19 19:39:54 +00:00
test_code.c CODE11/C25XXX/CODE39/EXCODE39/HIBC_39/CODE93/CODABAR/PLESSEY/ 2023-11-22 00:45:30 +00:00
test_common.c zint.h: increase symbol->text size 160 -> 200; 2023-11-19 19:39:54 +00:00
test_composite.c backend_tcl: add USE_TCL_STUBS & USE_TK_STUBS defines to 2023-12-18 08:57:49 +00:00
test_dmatrix.c QRCODE: fix out-of-bounds crash due to incorrect mode costings for 2023-11-30 09:12:11 +00:00
test_dotcode.c Add fuzz stuff ("backend/tests/fuzz"), including OSS-Fuzz 2024-01-04 20:11:04 +00:00
test_eci.c - API: add new zint_symbol dpmm field for output resolution (BMP/ 2022-12-02 21:39:01 +00:00
test_emf.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
test_filemem.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00: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 - Add special symbology-specific escape sequences (Code 128 only) 2023-01-15 00:22:43 +00: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 - Add special symbology-specific escape sequences (Code 128 only) 2023-01-15 00:22:43 +00:00
test_gbk_tab.h eci.c: replace libiconv-adapted code with own implementations so 2022-06-02 20:32:25 +01:00
test_gif.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
test_gridmtx.c QRCODE: fix out-of-bounds crash due to incorrect mode costings for 2023-11-30 09:12:11 +00:00
test_gs1.c gs1: update to latest gs1-syntax-dictionary (new AIs 4330-4333, 2023-10-27 13:51:32 +01:00
test_hanxin.c HANXIN/QRCODE: fix incorrect numeric costings (out-by-1) in 2023-12-09 10:07:11 +00:00
test_imail.c backend/tests: some tabs -> spaces 2023-11-27 13:47:38 +00:00
test_iso3166.c test suite: convert to use test context p_ctx instead of individual 2022-09-12 19:26:04 +01:00
test_iso4217.c test suite: convert to use test context p_ctx instead of individual 2022-09-12 19:26:04 +01: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 QROCDE/UPNQR: add FAST_MODE (try 4 not 8 masks automatically) 2022-12-05 10:11:36 +00:00
test_large.c output: use doubles when converting in out_colour_get_rgb() 2024-01-19 09:28:03 +00:00
test_library.c CMake: check for getopt_long_only() instead of just getopt() 2024-01-17 21:55:11 +00:00
test_mailmark.c - Add new symbology BARCODE_UPU_S10 2022-12-09 14:51:26 +00:00
test_maxicode.c Test suite: some fixes, additions 2023-04-07 15:49:36 +01:00
test_medical.c CODE11/C25XXX/CODE39/EXCODE39/HIBC_39/CODE93/CODABAR/PLESSEY/ 2023-11-22 00:45:30 +00:00
test_output.c - BMP/EMF/PCX/TIF: fix endianness on big-endian machines (note TIF 2024-01-17 01:45:45 +00:00
test_pcx.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
test_pdf417.c Add fuzz stuff ("backend/tests/fuzz"), including OSS-Fuzz 2024-01-04 20:11:04 +00:00
test_plessey.c CODE11/C25XXX/CODE39/EXCODE39/HIBC_39/CODE93/CODABAR/PLESSEY/ 2023-11-22 00:45:30 +00:00
test_png.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
test_postal.c CODE11/C25XXX/CODE39/EXCODE39/HIBC_39/CODE93/CODABAR/PLESSEY/ 2023-11-22 00:45:30 +00:00
test_print.c Actually change SVG font to "Arimo, Arial, sans-serif" ([607e4ed]) 2023-06-13 18:12:20 +01:00
test_ps.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
test_qr.c manual: pandoc latest release (3.1.10) 2023-12-14 11:03:50 +00:00
test_raster.c vector: make sure BIND_TOP trumps BIND/BOX always (fixes extraneous 2023-12-15 10:51:51 +00:00
test_reedsol.c - Add new symbology BARCODE_MAILMARK_2D (Royal Mail 2D Mailmark), 2022-12-08 13:48:31 +00:00
test_rss.c test suite: convert to use test context p_ctx instead of individual 2022-09-12 19:26:04 +01: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 - Add special symbology-specific escape sequences (Code 128 only) 2023-01-15 00:22:43 +00:00
test_svg.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
test_telepen.c CODE11/C25XXX/CODE39/EXCODE39/HIBC_39/CODE93/CODABAR/PLESSEY/ 2023-11-22 00:45:30 +00:00
test_tif.c Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00
test_ultra.c QRCODE: fix out-of-bounds crash due to incorrect mode costings for 2023-11-30 09:12:11 +00:00
test_upcean.c CLI: fix batch mode fopen() -> win_fopen() (Windows) 2023-05-10 21:29:09 +01:00
test_vector.c general: use explicit float consts rather than calced ones 2024-01-09 18:38:21 +00:00
testcommon.c CMake: check for getopt_long_only() instead of just getopt() 2024-01-17 21:55:11 +00:00
testcommon.h Add BARCODE_MEMORY_FILE to symbol->output_options to allow 2023-12-27 19:20:19 +00:00

% backend/tests/README 2024-01-17

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 ..
  cmake --build .

When using generators that support multiple build configurations, such as
Visual C++ Project Files (the default generator on win32), the configuration
can be provided via --config:

  cd <project-dir>
  mkdir build
  cd build
  cmake -DZINT_TEST=ON -DCMAKE_BUILD_TYPE=Debug ..
  cmake --build . --config Debug

Note specifying a matching CMAKE_BUILD_TYPE is required to set the test PATH
environment for Windows.
  
------------------------------------------------------------------------------

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, or if the tests are not run individually.

(On Windows, the PATH may need to be set to include the DLL location.)

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

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

  ctest

When using a generator that does support multiple build configurations, the
configuration that was used to build the project has to be explicitly provided
to ctest, even if it was the default one:

  ctest -C Debug

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 run a range of dataset items in a single test function, use '-i <start>-<end>':

  backend/tests/test_dotcode -f input -i 2-5

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

  backend/tests/test_dotcode -f input -x 4

This can also take a range, '-x <start>-<end>':

  backend/tests/test_dotcode -f input -x 4-6

Exclude can be used multiple times (unlike '-i'):

  backend/tests/test_dotcode -f input -x 4 -x 6-8

The include and exclude options can be used together:

  backend/tests/test_dotcode -f input -i 2-7 -x 4 -x 6

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

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

E.g. to print which dataset items are being run, use '-d 16':

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

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

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)

To run a test against ZXing-C++ (if any), use '-d 512':

  backend/tests/test_rss -d 512

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

To generate test data, use '-g':

  backend/tests/test_dotcode -f encode -g

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

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