[R] Removed redundant code

This commit is contained in:
seleznevae
2018-01-21 12:53:26 +03:00
parent 859ff31b8a
commit 423ddb3ab8
4 changed files with 37 additions and 58 deletions

View File

@@ -33,7 +33,7 @@ void test_table_sizes(void **state)
}
WHEN("Insert two cells in the next row") {
int n = FT_PRINTF_LN(table, 1, "%c|%c", 'c', 'd');
int n = FT_PRINTF_LN(table, "%c|%c", 'c', 'd');
assert_true( n == 2 );
status = get_table_sizes(table, &rows, &cols);
assert_true( IS_SUCCESS(status) );
@@ -42,7 +42,7 @@ void test_table_sizes(void **state)
}
WHEN("Insert five cells in the next row") {
int n = FT_PRINTF_LN(table, 2, "%d|%d|%d|%d|%d", 1, 2, 3, 4, 5);
int n = FT_PRINTF_LN(table, "%d|%d|%d|%d|%d", 1, 2, 3, 4, 5);
assert_true( n == 5 );
status = get_table_sizes(table, &rows, &cols);
assert_true( IS_SUCCESS(status) );
@@ -80,7 +80,7 @@ void test_table_geometry(void **state)
}
WHEN("Inserting 3 cells in the next row") {
int n = FT_PRINTF_LN(table, 1, "%c|%s|%c", 'c', "as", 'e');
int n = FT_PRINTF_LN(table, "%c|%s|%c", 'c', "as", 'e');
assert_true( n == 3 );
status = table_geometry(table, &height, &width);
assert_true( IS_SUCCESS(status) );
@@ -102,9 +102,9 @@ void test_table_basic(void **state)
int n = FT_HDR_PRINTF_LN(table, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
assert_true( n == 4 );
n = FT_PRINTF_LN(table, 1, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
n = FT_PRINTF_LN(table, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
assert_true( n == 4 );
n = FT_PRINTF_LN(table, 2, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
n = FT_PRINTF_LN(table, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
assert_true( n == 4 );
const char *table_str = ft_to_string(table);
@@ -137,9 +137,9 @@ void test_table_basic(void **state)
int n = FT_HDR_PRINTF_LN(table, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
assert_true( n == 4 );
n = FT_PRINTF_LN(table, 1, "%c|%s|%f|%d", 'c', "234", 3.14, 3);
n = FT_PRINTF_LN(table, "%c|%s|%f|%d", 'c', "234", 3.14, 3);
assert_true( n == 4 );
n = FT_PRINTF_LN(table, 2, "%s|%f|%d|%c", "234", 3.14, 3, 'c');
n = FT_PRINTF_LN(table, "%s|%f|%d|%c", "234", 3.14, 3, 'c');
assert_true( n == 4 );
const char *table_str = ft_to_string(table);
@@ -170,9 +170,9 @@ void test_table_basic(void **state)
int n = FT_HDR_PRINTF_LN(table, "||%s|%f", "234", 3.14);
assert_true( n == 4 );
n = FT_PRINTF_LN(table, 1, "%c|%s|%f", 'c', "234", 3.14);
n = FT_PRINTF_LN(table, "%c|%s|%f", 'c', "234", 3.14);
assert_true( n == 3 );
n = FT_PRINTF_LN(table, 2, "%s|%f||", "234", 3.14);
n = FT_PRINTF_LN(table, "%s|%f||", "234", 3.14);
assert_true( n == 4 );
const char *table_str = ft_to_string(table);
@@ -203,9 +203,9 @@ void test_table_basic(void **state)
int n = FT_HDR_PRINTF_LN(table, "|||");
assert_true( n == 4 );
n = FT_PRINTF_LN(table, 1, "|||");
n = FT_PRINTF_LN(table, "|||");
assert_true( n == 4 );
n = FT_PRINTF_LN(table, 2, "|||");
n = FT_PRINTF_LN(table, "|||");
assert_true( n == 4 );
const char *table_str = ft_to_string(table);
@@ -403,7 +403,7 @@ void test_table_options(void **state)
ft_set_default_options(&table_options);
table = create_test_int_table();
int n = ft_printf_ln(table, 3, "|||");
int n = ft_printf_ln(table, "|||");
assert_true( n == 4 );
const char *table_str = ft_to_string(table);
@@ -618,13 +618,11 @@ void test_table_options(void **state)
WHEN("All columns are equal and not empty") {
table = ft_create_table();
int n = FT_HDR_PRINTF_LN(table, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
int n = FT_HDR_PRINTF_LN(table, "%d|%c|%s|%f", 4, 'c', "234", 3.14);
assert_true( n == 4 );
// n = FT_PRINTF_LN(table, 1, "%d|%c|%s|%f", 3, 'c', "234\n123", 3.14);
// assert_true( n == 4 );
// FT_NWRITE_LN(table, "3", "c", "234", "3.140000");
FT_NWRITE_LN(table, "3", "c", "234\n12", "3.140000");
n = FT_PRINTF_LN(table, 2, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
n = FT_NWRITE_LN(table, "5", "c", "234\n12", "3.140000");
assert_true( n == F_SUCCESS );
n = FT_PRINTF_LN(table, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
assert_true( n == 4 );
const char *table_str = ft_to_string(table);
@@ -632,11 +630,11 @@ void test_table_options(void **state)
const char *table_str_etalon =
"+---+---+-----+----------+\n"
"| | | | |\n"
"| 3 | c | 234 | 3.140000 |\n"
"| 4 | c | 234 | 3.140000 |\n"
"| | | | |\n"
"+---+---+-----+----------+\n"
"| | | | |\n"
"| 3 | c | 234 | 3.140000 |\n"
"| 5 | c | 234 | 3.140000 |\n"
"| | | 12 | |\n"
"| | | | |\n"
"+---+---+-----+----------+\n"