[A] Added options for a particular table

This commit is contained in:
seleznevae
2018-01-04 10:58:41 +03:00
parent 1b91a26e4e
commit 64dc8f3fc2
3 changed files with 122 additions and 34 deletions

View File

@@ -468,5 +468,57 @@ void test_table_options(void **state)
ft_destroy_table(table);
}
WHEN("Setting options for a particular table") {
fort_table_options_t table_options;
memcpy(&table_options, &def_options, sizeof(fort_table_options_t));
table_options.cell_padding_bottom = 0;
table_options.cell_padding_top = 0;
table_options.cell_padding_left = 0;
table_options.cell_padding_right = 0;
ft_set_default_options(&table_options);
table = create_test_int_table();
char *table_str = ft_to_string(table);
assert_true( table_str != NULL );
const char *table_str_etalon =
"===========\n"
"|3|4|55|67|\n"
"===========\n"
"|3|4|55|67|\n"
"===========\n"
"|3|4|55|67|\n"
"===========\n";
// fprintf(stderr, "content:\n%s", table_str);
assert_true( strcmp(table_str, table_str_etalon) == 0);
free(table_str);
table_options.cell_padding_bottom = 1;
table_options.cell_padding_top = 1;
table_options.cell_padding_left = 0;
table_options.cell_padding_right = 0;
ft_set_table_options(table, &table_options);
table_str = ft_to_string(table);
assert_true( table_str != NULL );
table_str_etalon =
"===========\n"
"| | | | |\n"
"|3|4|55|67|\n"
"| | | | |\n"
"===========\n"
"| | | | |\n"
"|3|4|55|67|\n"
"| | | | |\n"
"===========\n"
"| | | | |\n"
"|3|4|55|67|\n"
"| | | | |\n"
"===========\n";
assert_true( strcmp(table_str, table_str_etalon) == 0);
free(table_str);
ft_destroy_table(table);
}
}