1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-01-26 05:15:57 +00:00

test suite: convert to use test context p_ctx instead of individual

args; new -x exclude option and ranges; no longer use getopt();
  make C89 compat
This commit is contained in:
gitlost
2022-09-12 19:26:04 +01:00
parent 0d4aa6cce3
commit 90dfbdb5d9
58 changed files with 2822 additions and 2340 deletions

View File

@@ -78,7 +78,8 @@ static int u_big5_int2(unsigned int u, unsigned int *dest) {
#define TEST_INT_PERF_ITERATIONS 100
#endif
static void test_u_big5_int(int debug) {
static void test_u_big5_int(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
unsigned int i;
int ret, ret2;
@@ -168,7 +169,7 @@ static int big5_utf8(struct zint_symbol *symbol, const unsigned char source[], i
return 0;
}
static void test_big5_utf8(int index) {
static void test_big5_utf8(const testCtx *const p_ctx) {
struct item {
char *data;
@@ -178,8 +179,10 @@ static void test_big5_utf8(int index) {
unsigned int expected_b5data[20];
char *comment;
};
/* _ U+FF3F fullwidth low line, not in ISO/Win, in Big5 0xA1C4, UTF-8 EFBCBF */
/* ╴ U+2574 drawings box light left, not in ISO/Win, not in original Big5 but in "Big5-2003" as 0xA15A, UTF-8 E295B4 */
/*
_ U+FF3F fullwidth low line, not in ISO/Win, in Big5 0xA1C4, UTF-8 EFBCBF
╴ U+2574 drawings box light left, not in ISO/Win, not in original Big5 but in "Big5-2003" as 0xA15A, UTF-8 E295B4
*/
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
/* 0*/ { "_", -1, 0, 1, { 0xA1C4 }, "" },
@@ -196,7 +199,7 @@ static void test_big5_utf8(int index) {
for (i = 0; i < data_size; i++) {
int ret_length;
if (index != -1 && i != index) continue;
if (testContinue(p_ctx, i)) continue;
length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
ret_length = length;
@@ -217,9 +220,9 @@ static void test_big5_utf8(int index) {
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
{ "test_u_big5_int", test_u_big5_int, 0, 0, 1 },
{ "test_big5_utf8", test_big5_utf8, 1, 0, 0 },
testFunction funcs[] = { /* name, func */
{ "test_u_big5_int", test_u_big5_int },
{ "test_big5_utf8", test_big5_utf8 },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));