mirror of
https://git.code.sf.net/p/zint/code
synced 2026-01-09 13:05:58 +00:00
general: raw_segs -> content_segs, BARCODE_RAW_TEXT ->
`BARCODE_CONTENT_SEGS`, `z_rt_XXX()` -> `z_ct_XXX()`; move `encoded_data`/`row_height` to end of `zint_symbol` (see ZXing-C++ issue #883) manual: update re `content_segs`; `my_symbol` -> `symbol`; improve MicroPDF417 description
This commit is contained in:
@@ -39,25 +39,25 @@ static void test_4s_hrt(const testCtx *const p_ctx) {
|
||||
const char *data;
|
||||
|
||||
const char *expected;
|
||||
const char *expected_raw;
|
||||
const char *expected_content;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { -1, "1100000000000XY11", "", "" }, /* None */
|
||||
/* 1*/ { BARCODE_RAW_TEXT, "1100000000000XY11", "", "1100000000000XY11 " },
|
||||
/* 1*/ { BARCODE_CONTENT_SEGS, "1100000000000XY11", "", "1100000000000XY11 " },
|
||||
/* 2*/ { -1, "1100000000000XY11 ", "", "" }, /* None */
|
||||
/* 3*/ { BARCODE_RAW_TEXT, "1100000000000XY11 ", "", "1100000000000XY11 " },
|
||||
/* 3*/ { BARCODE_CONTENT_SEGS, "1100000000000XY11 ", "", "1100000000000XY11 " },
|
||||
/* 4*/ { -1, "0100000000000A00AA0A", "", "" }, /* None */
|
||||
/* 5*/ { BARCODE_RAW_TEXT, "0100000000000A00AA0A", "", "0100000000000A00AA0A " }, /* None */
|
||||
/* 5*/ { BARCODE_CONTENT_SEGS, "0100000000000A00AA0A", "", "0100000000000A00AA0A " }, /* None */
|
||||
/* 6*/ { -1, "41038422416563762XY11 ", "", "" }, /* None */
|
||||
/* 7*/ { BARCODE_RAW_TEXT, "41038422416563762XY11 ", "", "41038422416563762XY11 " },
|
||||
/* 7*/ { BARCODE_CONTENT_SEGS, "41038422416563762XY11 ", "", "41038422416563762XY11 " },
|
||||
/* 8*/ { -1, "01000000000000000AA000AA0A", "", "" }, /* None */
|
||||
/* 9*/ { BARCODE_RAW_TEXT, "01000000000000000AA000AA0A", "", "01000000000000000AA000AA0A" },
|
||||
/* 9*/ { BARCODE_CONTENT_SEGS, "01000000000000000AA000AA0A", "", "01000000000000000AA000AA0A" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
int expected_length, expected_raw_length;
|
||||
int expected_length, expected_content_length;
|
||||
|
||||
testStartSymbol(p_ctx->func_name, &symbol);
|
||||
|
||||
@@ -72,7 +72,7 @@ static void test_4s_hrt(const testCtx *const p_ctx) {
|
||||
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
|
||||
data[i].data, -1, debug);
|
||||
expected_length = (int) strlen(data[i].expected);
|
||||
expected_raw_length = (int) strlen(data[i].expected_raw);
|
||||
expected_content_length = (int) strlen(data[i].expected_content);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
|
||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
|
||||
@@ -81,18 +81,18 @@ static void test_4s_hrt(const testCtx *const p_ctx) {
|
||||
i, symbol->text_length, expected_length, symbol->text);
|
||||
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
|
||||
i, symbol->text, data[i].expected);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_raw_length,
|
||||
"i:%d raw_segs[0].length %d != expected_raw_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_raw_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected_raw, expected_raw_length),
|
||||
if (symbol->output_options & BARCODE_CONTENT_SEGS) {
|
||||
assert_nonnull(symbol->content_segs, "i:%d content_segs NULL\n", i);
|
||||
assert_nonnull(symbol->content_segs[0].source, "i:%d content_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->content_segs[0].length, expected_content_length,
|
||||
"i:%d content_segs[0].length %d != expected_content_length %d\n",
|
||||
i, symbol->content_segs[0].length, expected_content_length);
|
||||
assert_zero(memcmp(symbol->content_segs[0].source, data[i].expected_content, expected_content_length),
|
||||
"i:%d memcmp(%.*s, %s, %d) != 0\n",
|
||||
i, symbol->raw_segs[0].length, symbol->raw_segs[0].source, data[i].expected_raw,
|
||||
expected_raw_length);
|
||||
i, symbol->content_segs[0].length, symbol->content_segs[0].source, data[i].expected_content,
|
||||
expected_content_length);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
assert_null(symbol->content_segs, "i:%d content_segs not NULL\n", i);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
@@ -746,12 +746,12 @@ static void test_2d_rt(const testCtx *const p_ctx) {
|
||||
int expected_eci;
|
||||
const char *expected;
|
||||
int expected_length;
|
||||
int expected_raw_eci;
|
||||
int expected_content_eci;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, "jgb 012100123412345678ab19xy1a 0", -1, 0, 0, "", -1, 0 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_RAW_TEXT, "jgb 012100123412345678ab19xy1a 0", -1, 0, 0, "JGB 012100123412345678AB19XY1A 0 ", -1, 3 },
|
||||
/* 1*/ { UNICODE_MODE, BARCODE_CONTENT_SEGS, "jgb 012100123412345678ab19xy1a 0", -1, 0, 0, "JGB 012100123412345678AB19XY1A 0 ", -1, 3 },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@@ -783,23 +783,23 @@ static void test_2d_rt(const testCtx *const p_ctx) {
|
||||
if (ret < ZINT_ERROR) {
|
||||
assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n",
|
||||
i, symbol->eci, data[i].expected_eci);
|
||||
if (symbol->output_options & BARCODE_RAW_TEXT) {
|
||||
assert_nonnull(symbol->raw_segs, "i:%d raw_segs NULL\n", i);
|
||||
assert_nonnull(symbol->raw_segs[0].source, "i:%d raw_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->raw_segs[0].length, expected_length,
|
||||
"i:%d raw_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->raw_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->raw_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d raw_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->raw_segs[0].source, symbol->raw_segs[0].length,
|
||||
if (symbol->output_options & BARCODE_CONTENT_SEGS) {
|
||||
assert_nonnull(symbol->content_segs, "i:%d content_segs NULL\n", i);
|
||||
assert_nonnull(symbol->content_segs[0].source, "i:%d content_segs[0].source NULL\n", i);
|
||||
assert_equal(symbol->content_segs[0].length, expected_length,
|
||||
"i:%d content_segs[0].length %d != expected_length %d\n",
|
||||
i, symbol->content_segs[0].length, expected_length);
|
||||
assert_zero(memcmp(symbol->content_segs[0].source, data[i].expected, expected_length),
|
||||
"i:%d content_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
|
||||
testUtilEscape((const char *) symbol->content_segs[0].source, symbol->content_segs[0].length,
|
||||
escaped, sizeof(escaped)),
|
||||
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
|
||||
expected_length);
|
||||
assert_equal(symbol->raw_segs[0].eci, data[i].expected_raw_eci,
|
||||
"i:%d raw_segs[0].eci %d != expected_raw_eci %d\n",
|
||||
i, symbol->raw_segs[0].eci, data[i].expected_raw_eci);
|
||||
assert_equal(symbol->content_segs[0].eci, data[i].expected_content_eci,
|
||||
"i:%d content_segs[0].eci %d != expected_content_eci %d\n",
|
||||
i, symbol->content_segs[0].eci, data[i].expected_content_eci);
|
||||
} else {
|
||||
assert_null(symbol->raw_segs, "i:%d raw_segs not NULL\n", i);
|
||||
assert_null(symbol->content_segs, "i:%d content_segs not NULL\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user