DATAMATRIX: make EOD encodation strictly ISO 16022 compliant

This commit is contained in:
gitlost 2021-02-23 00:01:15 +00:00
parent 63053c4c0f
commit 88d1a9f625
35 changed files with 2112 additions and 1264 deletions

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019 - 2021 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -113,7 +113,7 @@ static void test_input(int index, int debug) {
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < 5) {
if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
}
@ -164,7 +164,7 @@ static void test_encode_vector(int index, int debug) {
/* 18*/ { "31833333333333333C12JQ3U ", 0, 100, 30, 0, "DTTAFFDATATFAADAFDFATFFTFFTTTADTTTDTAAATDDTFFDDFTAADTTDTFFFDAFTFAADFDDAFDFTAFF" }, // F N N L L N L S S
/* 19*/ { "22799999999999999C123JQ4U ", 0, 100, 30, 0, "DDATTDDATATTTAFDTAADATDDFFTFFDFFDTFAADDFAADFDFFTFFTFFDFDFTATATFDDFTFFFTFFTDDTF" }, // F N N N L L N L S
};
int data_size = sizeof(data) / sizeof(struct item);
int data_size = ARRAY_SIZE(data);
char actual_daft[80];
@ -175,10 +175,7 @@ static void test_encode_vector(int index, int debug) {
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
symbol->symbology = BARCODE_MAILMARK;
symbol->debug |= debug;
int length = strlen(data[i].data);
int length = testUtilSetSymbol(symbol, BARCODE_MAILMARK, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
@ -239,10 +236,10 @@ static void test_encode(int index, int generate, int debug) {
printf(" /*%3d*/ { \"%s\", %s, %d, %d, \"%s\",\n",
i, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
testUtilModulesDump(symbol, " ", "\n");
testUtilModulesPrint(symbol, " ", "\n");
printf(" },\n");
} else {
if (ret < 5) {
if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);