zint-barcode-generator/backend/tests
gitlost 930f458979 backend: define z_alloca() and use for both Unix and Windows;
replace double-slash comments with old-skool slash asterisk ones;
  define uint16_t etc for Windows ourselves and remove ms_stdint.h &
  stdint_msvc.h as no longer used;
  (backend (excepting test suite) now C89 compatible)
LICENSE: move from backend to root and move COPYING to frontend, with
  copies in frontend_qt & backend_qt, so in where it applies;
  add LICENSE section from manual to root README
2022-07-14 16:01:30 +01: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 ECI: Update ECIs to AIM ITS/04-023:2022, adding UTF-16BE (was USC-2BE), 2022-04-10 11:12:18 +01:00
tools Update to latest BWIPP; add ZINT_QT6 option to cmake 2022-07-08 19:16:02 +01:00
CMakeLists.txt BC412: add to backend_tcl; add skeleton test 2022-07-03 23:54:42 +01:00
README Enable the qt backend test on windows 2021-11-23 21:51:31 +09:00
test_2of5.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_auspost.c GUI: remove sizeConstraint so squashable again (sigh) 2022-06-24 14:38:48 +01:00
test_aztec.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_bc412.c BC412: add to backend_tcl; add skeleton test 2022-07-03 23:54:42 +01:00
test_big5.c backend: define z_alloca() and use for both Unix and Windows; 2022-07-14 16:01:30 +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_bmp.c CMakeLists.txt: cmake min required 3.13 -> 3.5 using CMAKE_REQUIRED_LIBRARIES; add ZINT_COVERAGE option 2021-07-26 15:29:05 +01:00
test_channel.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_codablock.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_code.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_code1.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_code16k.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_code49.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_code128.c RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7 2022-06-09 21:52:02 +01:00
test_common.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_composite.c composite: less confusing error message for no linear data 2022-06-11 12:28:48 +01:00
test_dmatrix.c RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7 2022-06-09 21:52:02 +01:00
test_dotcode.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_eci.c BC412: add to backend_tcl; add skeleton test 2022-07-03 23:54:42 +01:00
test_emf.c Performance improvements for linear encoding and raster output 2021-10-20 23:05:30 +01:00
test_gb2312.c eci.c: replace libiconv-adapted code with own implementations so 2022-06-02 20:32:25 +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_gb18030.c BC412: add to backend_tcl; add skeleton test 2022-07-03 23:54:42 +01:00
test_gb18030_tab.h eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +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 ULTRA: add revision 2 support (based on BWIPP 2021-09-28 update) 2021-09-29 16:25:59 +01:00
test_gridmtx.c GRIDMATRIX: default char set is GB 2312 only, not Latin-1 with GB 2312 alt 2022-05-19 10:17:51 +01:00
test_gs1.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_hanxin.c GRIDMATRIX: default char set is GB 2312 only, not Latin-1 with GB 2312 alt 2022-05-19 10:17:51 +01:00
test_imail.c RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7 2022-06-09 21:52:02 +01:00
test_iso3166.c tests: VC6 compatible; plot_raster_dotty: avoid float rounding difference 2021-06-23 15:00:49 +01:00
test_iso4217.c tests: VC6 compatible; plot_raster_dotty: avoid float rounding difference 2021-06-23 15:00:49 +01:00
test_ksx1001.c eci.c: replace libiconv-adapted code with own implementations so 2022-06-02 20:32:25 +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_large.c - library: check symbol->primary for escape sequences also 2022-06-16 16:47:34 +01:00
test_library.c README: update links, explicit link to tickets (& put before mailing list) 2022-07-04 13:19:07 +01:00
test_mailmark.c CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow 2021-08-10 12:04:25 +01:00
test_maxicode.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_medical.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_output.c BC412: add to backend_tcl; add skeleton test 2022-07-03 23:54:42 +01:00
test_pcx.c CMakeLists.txt: cmake min required 3.13 -> 3.5 using CMAKE_REQUIRED_LIBRARIES; add ZINT_COVERAGE option 2021-07-26 15:29:05 +01:00
test_pdf417.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_plessey.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_png.c RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7 2022-06-09 21:52:02 +01:00
test_postal.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_print.c tests: VC6 compatible; plot_raster_dotty: avoid float rounding difference 2021-06-23 15:00:49 +01:00
test_ps.c RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7 2022-06-09 21:52:02 +01:00
test_qr.c BC412: add to backend_tcl; add skeleton test 2022-07-03 23:54:42 +01:00
test_raster.c Matrix symbols: change horizontal boundary bars to appear outside any 2022-01-01 15:24:59 +00:00
test_reedsol.c Performance improvements for linear encoding and raster output 2021-10-20 23:05:30 +01:00
test_rss.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_sjis.c eci.c: replace libiconv-adapted code with own implementations so 2022-06-02 20:32:25 +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_svg.c - raster.c: Need ceilf(symbol->height * si) to avoid heap-buffer-overflow; 2021-09-20 14:56:27 +01:00
test_telepen.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_tif.c Performance improvements for linear encoding and raster output 2021-10-20 23:05:30 +01:00
test_ultra.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_upcean.c Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2022-05-09 19:50:50 +01:00
test_vector.c Matrix symbols: change horizontal boundary bars to appear outside any 2022-01-01 15:24:59 +00:00
testcommon.c backend: define z_alloca() and use for both Unix and Windows; 2022-07-14 16:01:30 +01:00
testcommon.h backend: define z_alloca() and use for both Unix and Windows; 2022-07-14 16:01:30 +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 ..
  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 ..
  cmake --build . --config Debug
  
------------------------------------------------------------------------------

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

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