zint/backend/tests
gitlost c0791ad85e Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
DOTCODE: use pre-calculated generator poly coeffs in Reed-Solomon for
  performance improvement
PDF417/MICROPDF417: use common routine pdf417_initial()
GUI: code lines <= 118, shorthand widget_obj(),
  shorten calling upcean_addon_gap(), upcean_guard_descent()
various backend: var name debug -> debug_print
2021-09-28 21:42:44 +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 Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
tools RMQR: add ECI support; GUI/CLI: fix dev version test 2021-08-20 16:50:39 +01:00
CMakeLists.txt Add output_options BARCODE_QUIET_ZONES and BARCODE_NO_QUIET_ZONES 2021-09-24 13:21:24 +01:00
README CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs 2021-06-10 11:15:39 +01:00
test_2of5.c tests: VC6 compatible; plot_raster_dotty: avoid float rounding difference 2021-06-23 15:00:49 +01:00
test_auspost.c library: compat symbology 39 fix; ISBN: "X" check 2021-07-06 19:53:31 +01:00
test_aztec.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +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 CODE128: suppress cppcheck out-of-bounds warning; plus others (#233) 2021-07-07 13:58:04 +01: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 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_codablock.c CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow 2021-08-10 12:04:25 +01:00
test_code1.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_code16k.c CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow 2021-08-10 12:04:25 +01:00
test_code49.c library: compat symbology 39 fix; ISBN: "X" check 2021-07-06 19:53:31 +01:00
test_code128.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_code.c CODE93: add option_2 = 1 to display check chars in HRT 2021-09-13 18:49:25 +01:00
test_common.c CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow 2021-08-10 12:04:25 +01:00
test_composite.c composite: fix buffer overflow for large linear, small composite (500 -> 1000) 2021-08-05 16:34:45 +01:00
test_dmatrix.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_dotcode.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_eci.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_emf.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_gb2312_tab.h eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
test_gb2312.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_gb18030_tab.h eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
test_gb18030.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_gif.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_gridmtx.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_gs1.c raster.c: need ceilf(large_bar_height * si) to avoid zero height rows; 2021-09-26 23:55:16 +01:00
test_hanxin.c CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow 2021-08-10 12:04:25 +01:00
test_imail.c C25/DBAR: use new func gs1_check_digit() for common GS1 check digit calc 2021-06-27 11:47:55 +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_tab.h eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
test_ksx1001.c CODE128: suppress cppcheck out-of-bounds warning; plus others (#233) 2021-07-07 13:58:04 +01:00
test_large.c C25/DBAR: use new func gs1_check_digit() for common GS1 check digit calc 2021-06-27 11:47:55 +01:00
test_library.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +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 Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_medical.c library: compat symbology 39 fix; ISBN: "X" check 2021-07-06 19:53:31 +01:00
test_output.c GUI: fix dot size label position 2021-09-25 14:44:32 +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 Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_plessey.c CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow 2021-08-10 12:04:25 +01:00
test_png.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_postal.c composite: fix buffer overflow for large linear, small composite (500 -> 1000) 2021-08-05 16:34:45 +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 GUI: Separate out SCM fields for MAXICODE (Ticket #212) 2021-09-09 21:50:02 +01:00
test_qr.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_raster.c raster.c: need ceilf(large_bar_height * si) to avoid zero height rows; 2021-09-26 23:55:16 +01:00
test_reedsol.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_rss.c Replace WARN_ZPL_COMPAT with GS1NOCHECK_MODE 2021-07-13 17:39:03 +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 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_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 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_tif.c CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow 2021-08-10 12:04:25 +01:00
test_ultra.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
test_upcean.c UPCE/UPCE_CC: allow check digit (same as UPCA/UPCA_CC) so selecting composite doesn't give error 2021-07-12 22:27:16 +01:00
test_vector.c raster.c: need ceilf(large_bar_height * si) to avoid zero height rows; 2021-09-26 23:55:16 +01:00
testcommon.c Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, 2021-09-28 21:42:44 +01:00
testcommon.h CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow 2021-08-10 12:04:25 +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.)