[C] Replaced old string cmp macros with the new one

This commit is contained in:
seleznevae 2018-03-24 17:01:29 +03:00
parent 4b667a5528
commit 1c94089001
4 changed files with 30 additions and 85 deletions

View File

@ -31,8 +31,7 @@ void test_table_basic(void)
"| 3 | c | 234 | 3.140000 |\n"
"| | | | |\n"
"+---+---+-----+----------+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -62,8 +61,7 @@ void test_table_basic(void)
L"| 3 | c | 234 | 3.140000 |\n"
L"| | | | |\n"
L"+---+---+-----+----------+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( wcscmp(table_str, table_str_etalon) == 0);
assert_wcs_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -95,8 +93,7 @@ void test_table_basic(void)
"| 234 | 3.140000 | 3 | c |\n"
"| | | | |\n"
"+-----+----------+----------+----------+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -126,8 +123,7 @@ void test_table_basic(void)
L"| 234 | 3.140000 | 3 | c |\n"
L"| | | | |\n"
L"+-----+----------+----------+----------+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( wcscmp(table_str, table_str_etalon) == 0);
assert_wcs_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -157,8 +153,7 @@ void test_table_basic(void)
"| 234 | 3.140000 | | |\n"
"| | | | |\n"
"+-----+----------+----------+----------+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -188,8 +183,7 @@ void test_table_basic(void)
L"| 234 | 3.140000 | | |\n"
L"| | | | |\n"
L"+-----+----------+----------+----------+\n";
// fwprintf(stdout, L"content:\n%ls", table_str);
assert_true( wcscmp(table_str, table_str_etalon) == 0);
assert_wcs_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -219,8 +213,7 @@ void test_table_basic(void)
"| | | | |\n"
"| | | | |\n"
"+--+--+--+--+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -250,8 +243,7 @@ void test_table_basic(void)
L"| | | | |\n"
L"| | | | |\n"
L"+--+--+--+--+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( wcscmp(table_str, table_str_etalon) == 0);
assert_wcs_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
}
@ -289,9 +281,7 @@ void test_wcs_table_boundaries(void)
L"| 234 | 123456789 | c |\n"
L"| | | |\n"
L"+-----+-----------+---+\n";
// setlocale(LC_CTYPE, "");
// fprintf(stdout, "content:\n%ls", table_str);
assert_wcs_equal( table_str, table_str_etalon );
assert_wcs_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
}

View File

@ -49,10 +49,7 @@ void test_table_border_style(void)
"= 3 = 4 = 55 = 67 =\n"
"= = = = =\n"
"+|||+|||+||||+||||+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
@ -90,10 +87,7 @@ void test_table_border_style(void)
"= 3 = 4 = 55 = 67 =\n"
"= 3 = 4 = 55 = 67 =\n"
"+|||+|||+||||+||||+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -127,18 +121,7 @@ void test_table_border_style(void)
"| 3 | 4 | 55 | 67 |\n"
"| | | | |\n"
"+---+---+----+----+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
}

View File

@ -43,10 +43,7 @@ void test_table_options(void)
"| 3 | 4 | 55 | 67 |\n"
"| | | | |\n"
"+---+---+----+----+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -71,10 +68,7 @@ void test_table_options(void)
"+---+---+----+----+\n"
"| 3 | 4 | 55 | 67 |\n"
"+---+---+----+----+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -103,10 +97,7 @@ void test_table_options(void)
"|3|4|55|67|\n"
"| | | | |\n"
"+-+-+--+--+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -129,10 +120,7 @@ void test_table_options(void)
"+-+-+--+--+\n"
"|3|4|55|67|\n"
"+-+-+--+--+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -167,10 +155,7 @@ void test_table_options(void)
"| | | | |\n"
"| | | | |\n"
"+---+---+----+----+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -195,9 +180,7 @@ void test_table_options(void)
"+-+-+--+--+\n"
"|3|4|55|67|\n"
"+-+-+--+--+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_set_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_OPT_BOTTOM_PADDING, 1);
@ -222,9 +205,7 @@ void test_table_options(void)
"|3|4|55|67|\n"
"| | | | |\n"
"+-+-+--+--+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -263,10 +244,7 @@ void test_table_options(void)
"| 3 | 4 | 55 | 67 |\n"
"| | | | |\n"
"+---+-------+--------+------+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -297,9 +275,7 @@ void test_table_options(void)
"| 3 | 4 | 55 | 67 |\n"
"| | | | |\n"
"+-----+-----+-----+-----+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
@ -334,11 +310,7 @@ void test_table_options(void)
"| 3 | c | 234 | 3.140000 |\n"
"| | | | |\n"
"+---+---+-----+----------+\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
}

View File

@ -37,11 +37,6 @@ struct test_case
#define assert_true(args) assert(args)
int set_test_options_for_table(FTABLE *table);
int set_test_options_as_default();
FTABLE *create_test_int_table(int set_test_opts);
#define assert_str_equal(str1, str2) \
if (strcmp(str1, str2) != 0) \
{ \
@ -51,8 +46,6 @@ FTABLE *create_test_int_table(int set_test_opts);
exit(EXIT_FAILURE); \
}
#define assert_wcs_equal(str1, str2) \
if (wcscmp(str1, str2) != 0) \
{ \
@ -61,7 +54,14 @@ FTABLE *create_test_int_table(int set_test_opts);
fwprintf(stdout, L"Left string:\n%ls\n", str1); \
fwprintf(stdout, L"Right string:\n%ls\n", str2); \
exit(EXIT_FAILURE); \
} \
}
int set_test_options_for_table(FTABLE *table);
int set_test_options_as_default();
FTABLE *create_test_int_table(int set_test_opts);