CMakeLists.txt: cmake min required 3.13 -> 3.5 using CMAKE_REQUIRED_LIBRARIES; add ZINT_COVERAGE option

bmp/emf/ps.c: allow for foreground colour in ULTRA
bmp/gif/pcx.c: allow for BARCODE_STDOUT (fflush/fclose)
emf.c: hexagon rotation field not used; dont't use float index in font loop; Windows stdout binary mode
png.c: remove unused 8-bit; simplify libpng error handling and fclose outfile on error
ps.c: fix buffer overflow on colour_to_pscolor() CMYK
tif.c: fix BLACKISZERO indexes
CODE39: simplify check digit setting
reedsol.c: rs_uint_init_gf() log/alog tables must be zeroed
ZBarcode_Encode: debug: fix access out-of-bounds on non-NUL-terminated source if length < 10
manual.txt/zint.h: document NUL-terminated strings
tests: cover further cases for output (bmp/emf/etc), eci/gb18030/gb2312/sjis, reedsol, AZTEC, CODE39
This commit is contained in:
gitlost 2021-07-26 15:29:05 +01:00
parent 059abdf6a1
commit 3f33ed3eb9
90 changed files with 3754 additions and 863 deletions

View file

@ -55,40 +55,45 @@ static void test_input(int index, int debug) {
/* 10*/ { 3, "000", 0, 1, 19, },
/* 11*/ { 3, "001", 0, 1, 19, },
/* 12*/ { 3, "026", 0, 1, 19, },
/* 13*/ { -1, "026", 0, 1, 23, }, // Defaults to channel 4 due to length
/* 14*/ { 3, "0026", 0, 1, 19, },
/* 15*/ { 3, "1234", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 16*/ { 4, "000", 0, 1, 23 },
/* 17*/ { -1, "000", 0, 1, 23 }, // Defaults to channel 4 due to length
/* 18*/ { 4, "026", 0, 1, 23 },
/* 19*/ { 4, "0000026", 0, 1, 23 },
/* 20*/ { 4, "0000", 0, 1, 23 },
/* 21*/ { 4, "292", 0, 1, 23 },
/* 22*/ { 4, "293", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 23*/ { 5, "0000", 0, 1, 27 },
/* 24*/ { -1, "0000", 0, 1, 27 }, // Defaults to channel 5 due to length
/* 25*/ { -1, "3493", 0, 1, 27 },
/* 26*/ { 5, "3493", 0, 1, 27 },
/* 27*/ { 5, "3494", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 28*/ { 6, "00000", 0, 1, 31 },
/* 29*/ { -1, "00000", 0, 1, 31 }, // Defaults to channel 5 due to length
/* 30*/ { -1, "44072", 0, 1, 31 },
/* 31*/ { 6, "44072", 0, 1, 31 },
/* 32*/ { 6, "44073", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 33*/ { -1, "576688", 0, 1, 35 },
/* 34*/ { 7, "000000", 0, 1, 35 },
/* 35*/ { -1, "000000", 0, 1, 35 }, // Defaults to channel 7 due to length
/* 36*/ { 7, "576688", 0, 1, 35 },
/* 37*/ { 7, "576689", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 38*/ { 7, "0576688", 0, 1, 35 },
/* 39*/ { -1, "1234567", 0, 1, 39 },
/* 40*/ { 8, "0000000", 0, 1, 39, },
/* 41*/ { -1, "0000000", 0, 1, 39, }, // Defaults to channel 8 due to length
/* 42*/ { 8, "1234567", 0, 1, 39, },
/* 43*/ { 8, "7742863", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 44*/ { 8, "01234567", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 45*/ { 8, "00000000", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 46*/ { 9, "7742863", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 13*/ { -1, "27", 0, 1, 23 }, // Channel 4
/* 14*/ { -1, "026", 0, 1, 23, }, // Defaults to channel 4 due to length
/* 15*/ { 3, "0026", 0, 1, 19, },
/* 16*/ { 3, "1234", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 17*/ { 4, "000", 0, 1, 23 },
/* 18*/ { -1, "000", 0, 1, 23 }, // Defaults to channel 4 due to length
/* 19*/ { 4, "026", 0, 1, 23 },
/* 20*/ { 4, "0000026", 0, 1, 23 },
/* 21*/ { 4, "0000", 0, 1, 23 },
/* 22*/ { 4, "292", 0, 1, 23 },
/* 23*/ { 4, "293", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 24*/ { -1, "293", 0, 1, 27 }, // Channel 5
/* 25*/ { 5, "0000", 0, 1, 27 },
/* 26*/ { -1, "0000", 0, 1, 27 }, // Defaults to channel 5 due to length
/* 27*/ { -1, "3493", 0, 1, 27 },
/* 28*/ { 5, "3493", 0, 1, 27 },
/* 29*/ { 5, "3494", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 30*/ { -1, "3494", 0, 1, 31 }, // Channel 6
/* 31*/ { 6, "00000", 0, 1, 31 },
/* 32*/ { -1, "00000", 0, 1, 31 }, // Defaults to channel 5 due to length
/* 33*/ { -1, "44072", 0, 1, 31 },
/* 34*/ { 6, "44072", 0, 1, 31 },
/* 35*/ { 6, "44073", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 36*/ { -1, "44073", 0, 1, 35 }, // Channel 7
/* 37*/ { 7, "000000", 0, 1, 35 },
/* 38*/ { -1, "000000", 0, 1, 35 }, // Defaults to channel 7 due to length
/* 39*/ { 7, "576688", 0, 1, 35 },
/* 40*/ { 7, "576689", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 41*/ { 7, "0576688", 0, 1, 35 },
/* 42*/ { -1, "1234567", 0, 1, 39 },
/* 43*/ { -1, "576689", 0, 1, 39 }, // Channel 8
/* 44*/ { 8, "0000000", 0, 1, 39, },
/* 45*/ { -1, "0000000", 0, 1, 39, }, // Defaults to channel 8 due to length
/* 46*/ { 8, "1234567", 0, 1, 39, },
/* 47*/ { 8, "7742863", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 48*/ { 8, "01234567", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 49*/ { 8, "00000000", ZINT_ERROR_TOO_LONG, -1, -1 },
/* 50*/ { 9, "7742863", ZINT_ERROR_INVALID_DATA, -1, -1 },
/* 51*/ { -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;