general: improve some wrong length error messages

This commit is contained in:
gitlost 2025-02-22 16:17:37 +00:00
parent c499620ff6
commit bfcc398c35
14 changed files with 62 additions and 58 deletions

View file

@ -207,7 +207,7 @@ static void test_upca_input(const testCtx *const p_ctx) {
/* 1*/ { BARCODE_UPCA, "1234567890", 0, "" },
/* 2*/ { BARCODE_UPCA, "123456789012", 0, "" }, /* UPC-A accepts CHK */
/* 3*/ { BARCODE_UPCA, "123456789011", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '1', expecting '2'" },
/* 4*/ { BARCODE_UPCA, "1234567890123", ZINT_ERROR_TOO_LONG, "Error 288: Input length 13 wrong (11 or 12 only)" },
/* 4*/ { BARCODE_UPCA, "1234567890123", ZINT_ERROR_TOO_LONG, "Error 288: Input length 13 wrong (11 or 12 characters required)" },
/* 5*/ { BARCODE_UPCA, "123456789012A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 13 in input (digits and \"+\" only)" },
/* 6*/ { BARCODE_UPCA, "12345678901A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 12 in input (digits and \"+\" only)" },
/* 7*/ { BARCODE_UPCA, "12345", 0, "" },
@ -231,7 +231,7 @@ static void test_upca_input(const testCtx *const p_ctx) {
/* 25*/ { BARCODE_UPCA, "123456789017+12345A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 19 in input (digits and \"+\" only)" },
/* 26*/ { BARCODE_UPCA_CHK, "123456789012", 0, "" },
/* 27*/ { BARCODE_UPCA_CHK, "123456789011", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '1', expecting '2'" },
/* 28*/ { BARCODE_UPCA_CHK, "1234567890123", ZINT_ERROR_TOO_LONG, "Error 288: Input length 13 wrong (11 or 12 only)" },
/* 28*/ { BARCODE_UPCA_CHK, "1234567890123", ZINT_ERROR_TOO_LONG, "Error 288: Input length 13 wrong (11 or 12 characters required)" },
/* 29*/ { BARCODE_UPCA_CHK, "123456789012A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 13 in input (digits and \"+\" only)" },
/* 30*/ { BARCODE_UPCA_CHK, "12345678901A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 12 in input (digits and \"+\" only)" },
/* 31*/ { BARCODE_UPCA_CHK, "12345678901", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '1', expecting '5'" },
@ -541,11 +541,11 @@ static void test_isbn_input(const testCtx *const p_ctx) {
/* 39*/ { "0486600882", 0, 0, "", "2 is correct check digit" },
/* 40*/ { "04866008X2", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" },
/* 41*/ { "123456789A", ZINT_ERROR_INVALID_DATA, -1, "Error 285: Invalid character at position 10 in input (digits, \"X\" and \"+\" only)", "" },
/* 42*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 11 wrong (9, 10, or 13 only)", "" },
/* 42*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 11 wrong (9, 10, or 13 characters required)", "" },
/* 43*/ { "1234567890A", ZINT_ERROR_INVALID_DATA, -1, "Error 285: Invalid character at position 11 in input (digits, \"X\" and \"+\" only)", "" },
/* 44*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 12 wrong (9, 10, or 13 only)", "" },
/* 45*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 11 wrong (9, 10, or 13 only)", "" },
/* 46*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 12 wrong (9, 10, or 13 only)", "" },
/* 44*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 12 wrong (9, 10, or 13 characters required)", "" },
/* 45*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 11 wrong (9, 10, or 13 characters required)", "" },
/* 46*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 12 wrong (9, 10, or 13 characters required)", "" },
/* 47*/ { "1234567890123", ZINT_ERROR_INVALID_DATA, -1, "Error 279: Invalid ISBN (must begin with \"978\" or \"979\")", "" },
/* 48*/ { "9784567890123", ZINT_ERROR_INVALID_CHECK, -1, "Error 280: Invalid ISBN check digit '3', expecting '0'", "" },
/* 49*/ { "9784567890120", 0, 0, "", "0 is correct check digit" },