Uses general_field_encode in rss_binary_string; min 4 chars; bottom separator

This commit is contained in:
gitlost 2019-10-31 02:01:42 +00:00
parent 0fe9051324
commit 1dd4b08986
6 changed files with 483 additions and 397 deletions

View file

@ -45,7 +45,7 @@ static void test_gs1_reduce(void)
int symbology;
int input_mode;
unsigned char* data;
unsigned char* primary;
unsigned char* composite;
int ret;
char* comment;
@ -103,34 +103,34 @@ static void test_gs1_reduce(void)
},
/*13*/ { BARCODE_RSS_EXP, -1, "2012", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" },
/*14*/ { BARCODE_RSS_EXP, -1, "[20]12", "", 0, "Input mode ignored",
"0101010100000000011011111111000010101011000000010001011111001011100010111100000000101"
"010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101"
},
/*15*/ { BARCODE_RSS_EXP, GS1_MODE, "[20]12", "", 0, "Input mode ignored",
"0101010100000000011011111111000010101011000000010001011111001011100010111100000000101"
"010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101"
},
/*16*/ { BARCODE_RSS_EXP, UNICODE_MODE, "[20]12", "", 0, "Input mode ignored",
"0101010100000000011011111111000010101011000000010001011111001011100010111100000000101"
"010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101"
},
/*17*/ { BARCODE_RSS_EXP_CC, -1, "[20]12", "[21]1234", 0, "Input mode ignored",
"00110110111011010000100000110100110011101100001001110100110000101000110001001001101100000011011000101"
"00110110110011111010001001100110101110010000001001100100100111100101111001110101100100000011001000101"
"00110110100010111110011000010100111101000000101001100110101110111001111001001111011000011011101000101"
"00001010111111111001000000001010010001100100011101101000001101000111010000111111100000000000000000000"
"01010101000000000110111111110000101110011011100010010111110010111000101111000000001010000000000000000"
"001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010"
"001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010"
"001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010"
"000001111111010110010000000010100100111001100001011010000011010001100100001010101001010000011110100000"
"010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101"
},
/*18*/ { BARCODE_RSS_EXP_CC, GS1_MODE, "[20]12", "[21]1234", 0, "Input mode ignored",
"00110110111011010000100000110100110011101100001001110100110000101000110001001001101100000011011000101"
"00110110110011111010001001100110101110010000001001100100100111100101111001110101100100000011001000101"
"00110110100010111110011000010100111101000000101001100110101110111001111001001111011000011011101000101"
"00001010111111111001000000001010010001100100011101101000001101000111010000111111100000000000000000000"
"01010101000000000110111111110000101110011011100010010111110010111000101111000000001010000000000000000"
"001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010"
"001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010"
"001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010"
"000001111111010110010000000010100100111001100001011010000011010001100100001010101001010000011110100000"
"010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101"
},
/*19*/ { BARCODE_RSS_EXP_CC, UNICODE_MODE, "[20]12", "[21]1234", 0, "Input mode ignored",
"00110110111011010000100000110100110011101100001001110100110000101000110001001001101100000011011000101"
"00110110110011111010001001100110101110010000001001100100100111100101111001110101100100000011001000101"
"00110110100010111110011000010100111101000000101001100110101110111001111001001111011000011011101000101"
"00001010111111111001000000001010010001100100011101101000001101000111010000111111100000000000000000000"
"01010101000000000110111111110000101110011011100010010111110010111000101111000000001010000000000000000"
"001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010"
"001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010"
"001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010"
"000001111111010110010000000010100100111001100001011010000011010001100100001010101001010000011110100000"
"010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101"
},
/*20*/ { BARCODE_RSS_EXPSTACK, -1, "12", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" },
/*21*/ { BARCODE_RSS_EXPSTACK, -1, "[20]12", "", 0, "Input mode ignored",
@ -179,8 +179,8 @@ static void test_gs1_reduce(void)
symbol->input_mode = data[i].input_mode;
}
if (strlen(data[i].primary)) {
text = data[i].primary;
if (strlen(data[i].composite)) {
text = data[i].composite;
strcpy(symbol->primary, data[i].data);
} else {
text = data[i].data;
@ -192,12 +192,12 @@ static void test_gs1_reduce(void)
#ifdef TEST_GS1_REDUCE_GENERATE_EXPECTED
if (data[i].ret == 0) {
printf(" /*%2d*/ { %s, %s, \"%s\", \"%s\", %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].data, data[i].primary, data[i].ret, data[i].comment);
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].data, data[i].composite, data[i].ret, data[i].comment);
testUtilModulesDump(symbol, " ", "\n");
printf(" },\n");
} else {
printf(" /*%2d*/ { %s, %s, \"%s\", \"%s\", %s, \"%s\", \"\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].data, data[i].primary, testUtilErrorName(data[i].ret), data[i].comment);
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].data, data[i].composite, testUtilErrorName(data[i].ret), data[i].comment);
}
#else
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt);
@ -223,7 +223,7 @@ static void test_hrt(void)
struct item {
int symbology;
unsigned char* data;
unsigned char* primary;
unsigned char* composite;
unsigned char* expected;
};
@ -245,8 +245,8 @@ static void test_hrt(void)
symbol->symbology = data[i].symbology;
if (strlen(data[i].primary)) {
text = data[i].primary;
if (strlen(data[i].composite)) {
text = data[i].composite;
strcpy(symbol->primary, data[i].data);
} else {
text = data[i].data;