mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
fab7435fac
- use fixed-length string tables (mostly) instead of (char *) pointer ones (saves ~40K) - re-use C128Table for CODABLOCKF and CODE16K (required removal of Stop character and extra CODE16K-only entry) - use pointer to destination and copy (memcpy/strcpy(), bin_append_posn()) instead of concatenating (strcat()) (mostly) - replace last remaining bin_append()s with bin_append_posn(); bin_append() removed - add length arg to toupper() and expand() (avoids strlen()) - change is_sane() to use table-based flags (avoids an iteration) - rename lookup() to is_sane_lookup() and change to check and return posns and use in pointer to destination loops (avoids strcat()s) - remove special case PHARMA in expand() (dealt with in pharma()) - make #define SILVER/CALCIUM/TECHNETIUM/KRSET etc static strings - replace strchr() -> posn() - CODE128: populate destination once in checksum loop; re-use and export some more routines (c128_set_a/b/c(), c128_put_in_set()) for sharing; prefix defines (SHIFTA -> C128_SHIFTA etc) and existing exported routines - use factor XOR toggle trick in checksum calcs (avoids branch) - raster.c: fill out single 1-pixel row and copy using new draw_bar_line(), copy_bar_line() routines; similarly in buffer_plot compare previous line & copy if same (same technique as used to improve non-half-integer scaling, significant performance increase, (c) codemonkey82); also done for PNG (BMP/GIF/PCX/TIFF not done) - raster/vector/output.c: shorten "output_" prefix -> "out_"; sync vector to other raster changes to try to keep source files similar - 2of5.c: prefix "c25_" JAPANPOST: return error if input data truncated (backward incompatible) DAFT: max chars 50 -> 100 common.c: istwodigit() -> is_twodigit() common.c/emf.c/output.c: use some further stripf()s (MSVC6 float variations) library.c: new check_output_args() helper zint.h: add BARCODE_LAST marker and use in library.c QRCODE: remove a NOLINT (requires clang-tidy-13), one remaining CMake: separate no-optimize from ZINT_DEBUG into new ZINT_NOOPT option
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.)