general: change BARCODE_RAW_TEXT to write to new zint_symbol

fields `raw_segs` and `raw_seg_count` instead of `text`, and to
  do so for all symbologies, using new common funcs `rt_cpy()` etc.
MICROPDF417: return ECC percentage in top byte of `option_1`
DBAR_EXP_STK: return `option_2`/`option_3` feedback
CLI: change warning text "ignoring" -> "**IGNORED**"
GUI: show feedback for DBAR_EXP_STK, MICROPDF417, UPNQR
ctest: fix recent inability to run tests via "ctest" on Windows
  (MSVC) by using cmake 3.22 feature `ENVIRONMENT_MODIFICATION`
manual: document feedback and RAW_TEXT in new "Feedback" section;
  rephrase some symbology descriptions
test suite: new general-use arg "-a"; add `func_name` to context;
  new "test_bwipp" test for testing BWIPP against ZXing-C++
This commit is contained in:
gitlost 2025-03-28 10:02:19 +00:00
parent d1bf02e156
commit a6c225447e
120 changed files with 10511 additions and 5620 deletions

View file

@ -102,10 +102,11 @@ static void test_upce_input(const testCtx *const p_ctx) {
char cmp_buf[4096] = {0}; /* Suppress clang -fsanitize=memory false positive */
char cmp_msg[1024] = {0}; /* Suppress clang -fsanitize=memory false positive */
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
testStartSymbol("test_upce_input", &symbol);
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@ -134,12 +135,14 @@ static void test_upce_input(const testCtx *const p_ctx) {
int cmp_len, ret_len;
char modules_dump[8192 + 1];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].hrt, (int) strlen(data[i].hrt), NULL /*primary*/, escaped, &ret_len);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].hrt, (int) strlen(data[i].hrt),
NULL /*primary*/, escaped, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
escaped);
}
}
@ -166,7 +169,7 @@ static void test_upca_print(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
testStartSymbol("test_upca_print", &symbol);
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@ -286,7 +289,7 @@ static void test_upca_input(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
testStartSymbol("test_upca_input", &symbol);
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@ -458,7 +461,7 @@ static void test_eanx_input(const testCtx *const p_ctx) {
char errtxt_escaped[256];
testStartSymbol("test_eanx_input", &symbol);
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@ -611,7 +614,7 @@ static void test_isbn_input(const testCtx *const p_ctx) {
char errtxt_escaped[256];
testStartSymbol("test_isbn_input", &symbol);
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@ -755,7 +758,7 @@ static void test_hrt(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL;
int expected_length;
testStartSymbol("test_hrt", &symbol);
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@ -801,7 +804,7 @@ static void test_vector_same(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
testStartSymbol("test_vector_same", &symbol);
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
struct zint_vector *vectors[4];
@ -977,10 +980,11 @@ static void test_encode(const testCtx *const p_ctx) {
char cmp_buf[4096] = {0}; /* Suppress clang -fsanitize=memory false positive */
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
testStartSymbol("test_encode", &symbol);
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@ -1021,12 +1025,14 @@ static void test_encode(const testCtx *const p_ctx) {
int cmp_len, ret_len;
char modules_dump[8192 + 1];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf, sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
NULL /*primary*/, escaped, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len,
escaped);
}
}
}
@ -1065,7 +1071,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
testStartSymbol("test_fuzz", &symbol);
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {