[C] Renames options to properties
This commit is contained in:
@@ -35,11 +35,11 @@ static int create_simple_table_and_show(void)
|
||||
goto exit;
|
||||
}
|
||||
/*
|
||||
if (set_test_options_for_table(table) != FT_SUCCESS)
|
||||
if (set_test_props_for_table(table) != FT_SUCCESS)
|
||||
return 2;
|
||||
*/
|
||||
|
||||
if (ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER) != FT_SUCCESS) {
|
||||
if (ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER) != FT_SUCCESS) {
|
||||
result = 3;
|
||||
goto exit;
|
||||
}
|
||||
|
@@ -9,9 +9,9 @@ void test_table_basic(void)
|
||||
WHEN("All columns are equal and not empty") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_write_ln(table, "3", "c", "234", "3.140000") == FT_SUCCESS);
|
||||
assert_true(ft_write_ln(table, "3", "c", "234", "3.140000") == FT_SUCCESS);
|
||||
assert_true(ft_write_ln(table, "3", "c", "234", "3.140000") == FT_SUCCESS);
|
||||
@@ -40,9 +40,9 @@ void test_table_basic(void)
|
||||
WHEN("All columns are equal and not empty (wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_wwrite_ln(table, L"3", L"c", L"234", L"3.140000") == FT_SUCCESS);
|
||||
assert_true(ft_wwrite_ln(table, L"3", L"c", L"234", L"3.140000") == FT_SUCCESS);
|
||||
assert_true(ft_wwrite_ln(table, L"3", L"c", L"234", L"3.140000") == FT_SUCCESS);
|
||||
@@ -71,9 +71,9 @@ void test_table_basic(void)
|
||||
WHEN("All columns are not equal and not empty") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_write_ln(table, "3", "c", "234", "3.140000") == FT_SUCCESS);
|
||||
assert_true(ft_write_ln(table, "c", "234", "3.140000", "3") == FT_SUCCESS);
|
||||
assert_true(ft_write_ln(table, "234", "3.140000", "3", "c") == FT_SUCCESS);
|
||||
@@ -102,9 +102,9 @@ void test_table_basic(void)
|
||||
WHEN("All columns are not equal and not empty (wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_wwrite_ln(table, L"3", L"c", L"234", L"3.140000") == FT_SUCCESS);
|
||||
assert_true(ft_wwrite_ln(table, L"c", L"234", L"3.140000", L"3") == FT_SUCCESS);
|
||||
assert_true(ft_wwrite_ln(table, L"234", L"3.140000", L"3", L"c") == FT_SUCCESS);
|
||||
@@ -133,9 +133,9 @@ void test_table_basic(void)
|
||||
WHEN("All columns are not equal and some cells are empty") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_write_ln(table, "", "", "234", "3.140000") == FT_SUCCESS);
|
||||
assert_true(ft_write_ln(table, "c", "234", "3.140000", "") == FT_SUCCESS);
|
||||
assert_true(ft_write_ln(table, "234", "3.140000", "", "") == FT_SUCCESS);
|
||||
@@ -164,9 +164,9 @@ void test_table_basic(void)
|
||||
WHEN("All columns are not equal and some cells are empty (wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_wwrite_ln(table, L"", L"", L"234", L"3.140000") == FT_SUCCESS);
|
||||
assert_true(ft_wwrite_ln(table, L"c", L"234", L"3.140000", L"") == FT_SUCCESS);
|
||||
assert_true(ft_wwrite_ln(table, L"234", L"3.140000", L"", L"") == FT_SUCCESS);
|
||||
@@ -195,9 +195,9 @@ void test_table_basic(void)
|
||||
WHEN("All cells are empty") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_write_ln(table, "", "", "", "") == FT_SUCCESS);
|
||||
assert_true(ft_write_ln(table, "", "", "", "") == FT_SUCCESS);
|
||||
assert_true(ft_write_ln(table, "", "", "", "") == FT_SUCCESS);
|
||||
@@ -226,9 +226,9 @@ void test_table_basic(void)
|
||||
WHEN("All cells are empty (wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_wwrite_ln(table, L"", L"", L"", L"") == FT_SUCCESS);
|
||||
assert_true(ft_wwrite_ln(table, L"", L"", L"", L"") == FT_SUCCESS);
|
||||
assert_true(ft_wwrite_ln(table, L"", L"", L"", L"") == FT_SUCCESS);
|
||||
@@ -265,9 +265,9 @@ void test_wcs_table_boundaries(void)
|
||||
WHEN("All columns are not equal and not empty (wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_wwrite_ln(table, L"3", L"12345\x8888\x8888", L"c") == FT_SUCCESS); /* \x8888,\x8888 - occupy 2 columns each */
|
||||
assert_true(ft_wwrite_ln(table, L"c", L"12345678\x500", L"c") == FT_SUCCESS); /* \x500 - occupies 1 column */
|
||||
assert_true(ft_wwrite_ln(table, L"234", L"123456789", L"c") == FT_SUCCESS);
|
||||
@@ -302,9 +302,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test write functions") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(FT_IS_SUCCESS(ft_write(table, "3")));
|
||||
assert_true(FT_IS_SUCCESS(ft_write(table, "c")));
|
||||
assert_true(FT_IS_SUCCESS(ft_write(table, "234")));
|
||||
@@ -350,9 +350,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test wwrite functions(wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(FT_IS_SUCCESS(ft_wwrite(table, L"3")));
|
||||
assert_true(FT_IS_SUCCESS(ft_wwrite(table, L"c")));
|
||||
assert_true(FT_IS_SUCCESS(ft_wwrite(table, L"234")));
|
||||
@@ -398,9 +398,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test nwrite functions") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_nwrite(table, 4, "3", "c", "234", "3.140000") == FT_SUCCESS);
|
||||
ft_ln(table);
|
||||
assert_true(ft_nwrite_ln(table, 4, "c", "235", "3.150000", "5") == FT_SUCCESS);
|
||||
@@ -434,9 +434,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test nwwrite functions(wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(ft_nwwrite(table, 4, L"3", L"c", L"234", L"3.140000") == FT_SUCCESS);
|
||||
ft_ln(table);
|
||||
assert_true(ft_nwwrite_ln(table, 4, L"c", L"235", L"3.150000", L"5") == FT_SUCCESS);
|
||||
@@ -471,9 +471,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test row_write functions") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
const char *row_0[4] = {"3", "c", "234", "3.140000"};
|
||||
const char *row_1[4] = {"c", "235", "3.150000", "5"};
|
||||
const char *row_2[4] = {"234", "3.140000", "3", "c"};
|
||||
@@ -512,9 +512,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test row_write functions(wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
const wchar_t *row_0[4] = {L"3", L"c", L"234", L"3.140000"};
|
||||
const wchar_t *row_1[4] = {L"c", L"235", L"3.150000", L"5"};
|
||||
const wchar_t *row_2[4] = {L"234", L"3.140000", L"3", L"c"};
|
||||
@@ -553,9 +553,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test table_write functions") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
const char *table_cont[3][4] = {
|
||||
{"3", "c", "234", "3.140000"},
|
||||
{"c", "234", "3.140000", "3"},
|
||||
@@ -587,9 +587,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test table_write functions(wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
const wchar_t *table_cont[3][4] = {
|
||||
{L"3", L"c", L"234", L"3.140000"},
|
||||
{L"c", L"234", L"3.140000", L"3"},
|
||||
@@ -621,9 +621,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test printf functions") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
int n = ft_printf_ln(table, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
|
||||
assert_true(n == 4);
|
||||
n = ft_printf(table, "%c|%s|%f|%d", 'c', "235", 3.15, 5);
|
||||
@@ -661,9 +661,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test printf functions(wide strings)") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
int n = ft_wprintf_ln(table, L"%d|%c|%ls|%f", 3, 'c', L"234", 3.14);
|
||||
assert_true(n == 4);
|
||||
n = ft_wprintf(table, L"%c|%ls|%f|%d", 'c', L"235", 3.15, 5);
|
||||
@@ -701,9 +701,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test printf functions with strings with separators inside them") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
int n = ft_printf_ln(table, "%d|%c|%s|%f", 3, 'c', "234", 3.14);
|
||||
assert_true(n == 4);
|
||||
n = ft_printf(table, "%c", 'c');
|
||||
@@ -742,9 +742,9 @@ void test_table_write(void)
|
||||
SCENARIO("Test printf functions with strings with separators inside them") {
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
int n = ft_wprintf_ln(table, L"%d|%c|%ls|%f", 3, 'c', L"234", 3.14);
|
||||
assert_true(n == 4);
|
||||
n = ft_wprintf(table, L"%c", 'c');
|
||||
@@ -791,16 +791,16 @@ void test_table_copy(void)
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
|
||||
assert_true(ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_BOTTOM_PADDING, 1) == FT_SUCCESS);
|
||||
assert_true(ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_TOP_PADDING, 1) == FT_SUCCESS);
|
||||
assert_true(ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_LEFT_PADDING, 2) == FT_SUCCESS);
|
||||
assert_true(ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_RIGHT_PADDING, 2) == FT_SUCCESS);
|
||||
assert_true(ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_BOTTOM_PADDING, 1) == FT_SUCCESS);
|
||||
assert_true(ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_TOP_PADDING, 1) == FT_SUCCESS);
|
||||
assert_true(ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_LEFT_PADDING, 2) == FT_SUCCESS);
|
||||
assert_true(ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_RIGHT_PADDING, 2) == FT_SUCCESS);
|
||||
|
||||
|
||||
ft_set_border_style(table, FT_DOUBLE2_STYLE);
|
||||
|
||||
/* Set "header" type for the first row */
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_write_ln(table, "Movie title", "Director", "Year", "Rating");
|
||||
|
||||
ft_write_ln(table, "The Shawshank Redemption", "Frank Darabont", "1994", "9.5");
|
||||
@@ -810,8 +810,8 @@ void test_table_copy(void)
|
||||
ft_write_ln(table, "2001: A Space Odyssey", "Stanley Kubrick", "1968", "8.5");
|
||||
|
||||
/* Set center alignment for the 1st and 3rd columns */
|
||||
ft_set_cell_option(table, FT_ANY_ROW, 1, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
ft_set_cell_option(table, FT_ANY_ROW, 3, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, 1, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, 3, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
|
||||
|
||||
ft_table_t *table_copy = ft_copy_table(table);
|
||||
|
@@ -9,7 +9,7 @@ void test_table_border_style(void)
|
||||
{
|
||||
ft_table_t *table = NULL;
|
||||
|
||||
set_test_options_as_default();
|
||||
set_test_properties_as_default();
|
||||
|
||||
|
||||
WHEN("Changing cell separators") {
|
||||
@@ -74,11 +74,11 @@ void test_table_border_style(void)
|
||||
|
||||
ft_set_default_border_style(&brdr_style);
|
||||
|
||||
ft_set_default_cell_option(FT_COPT_BOTTOM_PADDING, 0);
|
||||
ft_set_default_cell_option(FT_COPT_TOP_PADDING, 0);
|
||||
ft_set_default_cell_option(FT_COPT_LEFT_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_RIGHT_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_EMPTY_STR_HEIGHT, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_BOTTOM_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_TOP_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_LEFT_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_RIGHT_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_EMPTY_STR_HEIGHT, 0);
|
||||
|
||||
|
||||
table = create_test_int_table(0);
|
||||
@@ -100,7 +100,7 @@ void test_table_border_style(void)
|
||||
table = create_test_int_table(1);
|
||||
ft_add_separator(table);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
int n = ft_printf_ln(table, "%d|%d|%d|%d", 3, 4, 55, 67);
|
||||
|
||||
assert_true(n == 4);
|
||||
@@ -134,10 +134,10 @@ void test_table_border_style(void)
|
||||
static ft_table_t *create_basic_table(void)
|
||||
{
|
||||
ft_table_t *table = ft_create_table();
|
||||
ft_set_cell_option(table, FT_ANY_ROW, 0, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
ft_set_cell_option(table, FT_ANY_ROW, 1, FT_COPT_TEXT_ALIGN, FT_ALIGNED_LEFT);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, 0, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, 1, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_LEFT);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_write_ln(table, "Rank", "Title", "Year", "Rating");
|
||||
|
||||
ft_write_ln(table, "1", "The Shawshank Redemption", "1994", "9.5");
|
||||
|
@@ -3,17 +3,17 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "options.h"
|
||||
#include "properties.h"
|
||||
#include "vector.h"
|
||||
|
||||
|
||||
|
||||
void test_table_tbl_options(void)
|
||||
void test_table_tbl_properties(void)
|
||||
{
|
||||
ft_table_t *table = NULL;
|
||||
|
||||
WHEN("Test setting entire table options") {
|
||||
set_test_options_as_default();
|
||||
WHEN("Test setting entire table properties") {
|
||||
set_test_properties_as_default();
|
||||
|
||||
table = create_test_int_table(0);
|
||||
|
||||
@@ -35,11 +35,11 @@ void test_table_tbl_options(void)
|
||||
"+---+---+----+----+\n";
|
||||
assert_str_equal(table_str, table_str_etalon);
|
||||
|
||||
/* Now set table options */
|
||||
ft_set_tbl_option(table, FT_TOPT_TOP_MARGIN, 3);
|
||||
ft_set_tbl_option(table, FT_TOPT_BOTTOM_MARGIN, 4);
|
||||
ft_set_tbl_option(table, FT_TOPT_LEFT_MARGIN, 1);
|
||||
ft_set_tbl_option(table, FT_TOPT_RIGHT_MARGIN, 2);
|
||||
/* Now set table properties */
|
||||
ft_set_tbl_prop(table, FT_TPROP_TOP_MARGIN, 3);
|
||||
ft_set_tbl_prop(table, FT_TPROP_BOTTOM_MARGIN, 4);
|
||||
ft_set_tbl_prop(table, FT_TPROP_LEFT_MARGIN, 1);
|
||||
ft_set_tbl_prop(table, FT_TPROP_RIGHT_MARGIN, 2);
|
||||
table_str = ft_to_string(table);
|
||||
assert_true(table_str != NULL);
|
||||
table_str_etalon =
|
||||
@@ -72,8 +72,8 @@ void test_table_tbl_options(void)
|
||||
|
||||
|
||||
#ifdef FT_HAVE_WCHAR
|
||||
WHEN("Test setting entire table options(wide strings case)") {
|
||||
set_test_options_as_default();
|
||||
WHEN("Test setting entire table properties(wide strings case)") {
|
||||
set_test_properties_as_default();
|
||||
|
||||
table = create_test_int_wtable(0);
|
||||
|
||||
@@ -95,11 +95,11 @@ void test_table_tbl_options(void)
|
||||
L"+---+---+----+----+\n";
|
||||
assert_wcs_equal(table_str, table_str_etalon);
|
||||
|
||||
/* Now set table options */
|
||||
ft_set_tbl_option(table, FT_TOPT_TOP_MARGIN, 3);
|
||||
ft_set_tbl_option(table, FT_TOPT_BOTTOM_MARGIN, 4);
|
||||
ft_set_tbl_option(table, FT_TOPT_LEFT_MARGIN, 1);
|
||||
ft_set_tbl_option(table, FT_TOPT_RIGHT_MARGIN, 2);
|
||||
/* Now set table properties */
|
||||
ft_set_tbl_prop(table, FT_TPROP_TOP_MARGIN, 3);
|
||||
ft_set_tbl_prop(table, FT_TPROP_BOTTOM_MARGIN, 4);
|
||||
ft_set_tbl_prop(table, FT_TPROP_LEFT_MARGIN, 1);
|
||||
ft_set_tbl_prop(table, FT_TPROP_RIGHT_MARGIN, 2);
|
||||
table_str = ft_to_wstring(table);
|
||||
assert_true(table_str != NULL);
|
||||
table_str_etalon =
|
||||
@@ -132,18 +132,18 @@ void test_table_tbl_options(void)
|
||||
|
||||
|
||||
|
||||
void test_table_cell_options(void)
|
||||
void test_table_cell_properties(void)
|
||||
{
|
||||
ft_table_t *table = NULL;
|
||||
|
||||
|
||||
WHEN("All paddings = 1") {
|
||||
set_test_options_as_default();
|
||||
set_test_properties_as_default();
|
||||
|
||||
ft_set_default_cell_option(FT_COPT_BOTTOM_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_TOP_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_LEFT_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_RIGHT_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_BOTTOM_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_TOP_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_LEFT_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_RIGHT_PADDING, 1);
|
||||
|
||||
table = create_test_int_table(0);
|
||||
|
||||
@@ -171,10 +171,10 @@ void test_table_cell_options(void)
|
||||
|
||||
WHEN("Top and bottom padding = 0") {
|
||||
|
||||
ft_set_default_cell_option(FT_COPT_BOTTOM_PADDING, 0);
|
||||
ft_set_default_cell_option(FT_COPT_TOP_PADDING, 0);
|
||||
ft_set_default_cell_option(FT_COPT_LEFT_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_RIGHT_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_BOTTOM_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_TOP_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_LEFT_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_RIGHT_PADDING, 1);
|
||||
|
||||
table = create_test_int_table(0);
|
||||
|
||||
@@ -194,10 +194,10 @@ void test_table_cell_options(void)
|
||||
|
||||
WHEN("Left and right padding = 0") {
|
||||
|
||||
ft_set_default_cell_option(FT_COPT_BOTTOM_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_TOP_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_LEFT_PADDING, 0);
|
||||
ft_set_default_cell_option(FT_COPT_RIGHT_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_BOTTOM_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_TOP_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_LEFT_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_RIGHT_PADDING, 0);
|
||||
|
||||
table = create_test_int_table(0);
|
||||
|
||||
@@ -223,10 +223,10 @@ void test_table_cell_options(void)
|
||||
|
||||
WHEN("All paddings = 0") {
|
||||
|
||||
ft_set_default_cell_option(FT_COPT_BOTTOM_PADDING, 0);
|
||||
ft_set_default_cell_option(FT_COPT_TOP_PADDING, 0);
|
||||
ft_set_default_cell_option(FT_COPT_LEFT_PADDING, 0);
|
||||
ft_set_default_cell_option(FT_COPT_RIGHT_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_BOTTOM_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_TOP_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_LEFT_PADDING, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_RIGHT_PADDING, 0);
|
||||
|
||||
table = create_test_int_table(0);
|
||||
|
||||
@@ -246,11 +246,11 @@ void test_table_cell_options(void)
|
||||
|
||||
WHEN("Empty string has 0 heigt") {
|
||||
|
||||
ft_set_default_cell_option(FT_COPT_BOTTOM_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_TOP_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_LEFT_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_RIGHT_PADDING, 1);
|
||||
ft_set_default_cell_option(FT_COPT_EMPTY_STR_HEIGHT, 0);
|
||||
ft_set_default_cell_prop(FT_CPROP_BOTTOM_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_TOP_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_LEFT_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_RIGHT_PADDING, 1);
|
||||
ft_set_default_cell_prop(FT_CPROP_EMPTY_STR_HEIGHT, 0);
|
||||
|
||||
table = create_test_int_table(0);
|
||||
int n = ft_printf_ln(table, "|||");
|
||||
@@ -280,15 +280,15 @@ void test_table_cell_options(void)
|
||||
}
|
||||
|
||||
|
||||
WHEN("Setting options for a particular table") {
|
||||
WHEN("Setting properties for a particular table") {
|
||||
|
||||
table = create_test_int_table(0);
|
||||
set_test_options_for_table(table);
|
||||
set_test_props_for_table(table);
|
||||
|
||||
ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_BOTTOM_PADDING, 0);
|
||||
ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_TOP_PADDING, 0);
|
||||
ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_LEFT_PADDING, 0);
|
||||
ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_RIGHT_PADDING, 0);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_BOTTOM_PADDING, 0);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_TOP_PADDING, 0);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_LEFT_PADDING, 0);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_RIGHT_PADDING, 0);
|
||||
|
||||
const char *table_str = ft_to_string(table);
|
||||
assert_true(table_str != NULL);
|
||||
@@ -303,11 +303,11 @@ void test_table_cell_options(void)
|
||||
assert_str_equal(table_str, table_str_etalon);
|
||||
|
||||
|
||||
ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_BOTTOM_PADDING, 1);
|
||||
ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_TOP_PADDING, 1);
|
||||
ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_LEFT_PADDING, 0);
|
||||
ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_RIGHT_PADDING, 0);
|
||||
ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_EMPTY_STR_HEIGHT, 0);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_BOTTOM_PADDING, 1);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_TOP_PADDING, 1);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_LEFT_PADDING, 0);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_RIGHT_PADDING, 0);
|
||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_EMPTY_STR_HEIGHT, 0);
|
||||
|
||||
table_str = ft_to_string(table);
|
||||
assert_true(table_str != NULL);
|
||||
@@ -333,18 +333,18 @@ void test_table_cell_options(void)
|
||||
|
||||
WHEN("Set table width and column alignment") {
|
||||
|
||||
set_test_options_as_default();
|
||||
set_test_properties_as_default();
|
||||
|
||||
table = create_test_int_table(0);
|
||||
int status = FT_SUCCESS;
|
||||
|
||||
status |= ft_set_cell_option(table, FT_ANY_ROW, 1, FT_COPT_MIN_WIDTH, 7);
|
||||
status |= ft_set_cell_option(table, FT_ANY_ROW, 1, FT_COPT_TEXT_ALIGN, FT_ALIGNED_LEFT);
|
||||
status |= ft_set_cell_option(table, FT_ANY_ROW, 2, FT_COPT_MIN_WIDTH, 8);
|
||||
status |= ft_set_cell_option(table, FT_ANY_ROW, 2, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
status |= ft_set_cell_prop(table, FT_ANY_ROW, 1, FT_CPROP_MIN_WIDTH, 7);
|
||||
status |= ft_set_cell_prop(table, FT_ANY_ROW, 1, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_LEFT);
|
||||
status |= ft_set_cell_prop(table, FT_ANY_ROW, 2, FT_CPROP_MIN_WIDTH, 8);
|
||||
status |= ft_set_cell_prop(table, FT_ANY_ROW, 2, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
|
||||
status |= ft_set_cell_option(table, 2, 3, FT_COPT_MIN_WIDTH, 6);
|
||||
status |= ft_set_cell_option(table, 2, 3, FT_COPT_TEXT_ALIGN, FT_ALIGNED_LEFT);
|
||||
status |= ft_set_cell_prop(table, 2, 3, FT_CPROP_MIN_WIDTH, 6);
|
||||
status |= ft_set_cell_prop(table, 2, 3, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_LEFT);
|
||||
assert_true(status == FT_SUCCESS);
|
||||
|
||||
|
||||
@@ -370,11 +370,11 @@ void test_table_cell_options(void)
|
||||
|
||||
WHEN("Set table width and column alignment as default") {
|
||||
|
||||
set_test_options_as_default();
|
||||
set_test_properties_as_default();
|
||||
|
||||
int status = FT_SUCCESS;
|
||||
status |= ft_set_default_cell_option(FT_COPT_MIN_WIDTH, 5);
|
||||
status |= ft_set_default_cell_option(FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
status |= ft_set_default_cell_prop(FT_CPROP_MIN_WIDTH, 5);
|
||||
status |= ft_set_default_cell_prop(FT_CPROP_TEXT_ALIGN, FT_ALIGNED_CENTER);
|
||||
assert_true(status == FT_SUCCESS);
|
||||
|
||||
table = create_test_int_table(0);
|
||||
@@ -400,11 +400,11 @@ void test_table_cell_options(void)
|
||||
}
|
||||
|
||||
WHEN("Multiline cell") {
|
||||
set_test_options_as_default();
|
||||
set_test_properties_as_default();
|
||||
|
||||
table = ft_create_table();
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
int n = ft_printf_ln(table, "%d|%c|%s|%f", 4, 'c', "234", 3.14);
|
||||
|
||||
assert_true(n == 4);
|
||||
@@ -436,7 +436,7 @@ void test_table_cell_options(void)
|
||||
|
||||
|
||||
WHEN("Cells with spans") {
|
||||
set_test_options_as_default();
|
||||
set_test_properties_as_default();
|
||||
|
||||
table = ft_create_table();
|
||||
int n = ft_set_cell_span(table, 0, 0, 5);
|
||||
@@ -444,9 +444,9 @@ void test_table_cell_options(void)
|
||||
n = ft_set_cell_span(table, 1, 1, 3);
|
||||
assert_true(n == FT_SUCCESS);
|
||||
|
||||
n = ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
n = ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(n == FT_SUCCESS);
|
||||
n = ft_set_cell_option(table, 1, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
n = ft_set_cell_prop(table, 1, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(n == FT_SUCCESS);
|
||||
|
||||
n = ft_write_ln(table, "111", "2222", "33333", "444444", "55555555");
|
||||
@@ -494,7 +494,7 @@ void test_table_cell_options(void)
|
||||
}
|
||||
|
||||
WHEN("Cells with spans in common and header cells") {
|
||||
set_test_options_as_default();
|
||||
set_test_properties_as_default();
|
||||
|
||||
table = ft_create_table();
|
||||
ft_set_border_style(table, FT_DOUBLE2_STYLE);
|
||||
@@ -506,7 +506,7 @@ void test_table_cell_options(void)
|
||||
n = ft_set_cell_span(table, 1, 1, 3);
|
||||
assert_true(n == FT_SUCCESS);
|
||||
|
||||
n = ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
n = ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
assert_true(n == FT_SUCCESS);
|
||||
|
||||
n = ft_write_ln(table, "111", "2222", "33333", "444444", "55555555");
|
@@ -3,7 +3,7 @@
|
||||
|
||||
#define assert_string_equal(str1, str2) assert_str_equal(str1.c_str(), str2.c_str())
|
||||
|
||||
bool set_test_options_for_table(fort::Table *table)
|
||||
bool set_test_props_for_table(fort::Table *table)
|
||||
{
|
||||
assert_true(table->set_cell_bottom_padding(FT_ANY_ROW, FT_ANY_COLUMN, 1));
|
||||
assert_true(table->set_cell_top_padding(FT_ANY_ROW, FT_ANY_COLUMN, 1));
|
||||
@@ -36,7 +36,7 @@ void test_cpp_table_basic(void)
|
||||
{
|
||||
WHEN("All columns are equal and not empty.") {
|
||||
fort::Table table;
|
||||
assert_true(set_test_options_for_table(&table));
|
||||
assert_true(set_test_props_for_table(&table));
|
||||
|
||||
table << fort::header
|
||||
<< "3" << "c" << "234" << "3.140000" << fort::endr
|
||||
@@ -63,7 +63,7 @@ void test_cpp_table_basic(void)
|
||||
|
||||
WHEN("Checking basic constructors and assignmets.") {
|
||||
fort::Table table;
|
||||
assert_true(set_test_options_for_table(&table));
|
||||
assert_true(set_test_props_for_table(&table));
|
||||
|
||||
table << fort::header
|
||||
<< "3" << "c" << "234" << "3.140000" << fort::endr
|
||||
@@ -98,7 +98,7 @@ void test_cpp_table_basic(void)
|
||||
|
||||
WHEN("All columns are not equal and not empty") {
|
||||
fort::Table table;
|
||||
assert_true(set_test_options_for_table(&table));
|
||||
assert_true(set_test_props_for_table(&table));
|
||||
|
||||
table << fort::header
|
||||
<< "3" << "c" << "234" << "3.140000" << fort::endr
|
||||
@@ -125,7 +125,7 @@ void test_cpp_table_basic(void)
|
||||
|
||||
WHEN("All columns are not equal and some cells are empty") {
|
||||
fort::Table table;
|
||||
assert_true(set_test_options_for_table(&table));
|
||||
assert_true(set_test_props_for_table(&table));
|
||||
|
||||
table << fort::header
|
||||
<< "" << "" << "234" << "3.140000" << fort::endr
|
||||
@@ -152,7 +152,7 @@ void test_cpp_table_basic(void)
|
||||
|
||||
WHEN("All cells are empty") {
|
||||
fort::Table table;
|
||||
assert_true(set_test_options_for_table(&table));
|
||||
assert_true(set_test_props_for_table(&table));
|
||||
|
||||
table << fort::header
|
||||
<< "" << "" << "" << "" << fort::endr
|
||||
@@ -183,7 +183,7 @@ void test_cpp_table_write(void)
|
||||
{
|
||||
SCENARIO("Test write functions") {
|
||||
fort::Table table;
|
||||
assert_true(set_test_options_for_table(&table));
|
||||
assert_true(set_test_props_for_table(&table));
|
||||
table << fort::header;
|
||||
assert_true(table.write("3"));
|
||||
assert_true(table.write("c"));
|
||||
@@ -225,7 +225,7 @@ void test_cpp_table_write(void)
|
||||
|
||||
SCENARIO("Test n write functions") {
|
||||
fort::Table table;
|
||||
assert_true(set_test_options_for_table(&table));
|
||||
assert_true(set_test_props_for_table(&table));
|
||||
table << fort::header;
|
||||
assert_true(table.write("3", "c", "234", "3.140000"));
|
||||
table << fort::endr;
|
||||
@@ -257,7 +257,7 @@ void test_cpp_table_write(void)
|
||||
|
||||
SCENARIO("Test row_write functions") {
|
||||
fort::Table table;
|
||||
assert_true(set_test_options_for_table(&table));
|
||||
assert_true(set_test_props_for_table(&table));
|
||||
|
||||
table << fort::header;
|
||||
const char *row_0[4] = {"3", "c", "234", "3.140000"};
|
||||
|
@@ -22,8 +22,8 @@ struct test_case bb_test_suit [] = {
|
||||
{"test_table_write", test_table_write},
|
||||
{"test_table_border_style", test_table_border_style},
|
||||
{"test_table_builtin_border_styles", test_table_builtin_border_styles},
|
||||
{"test_table_cell_options", test_table_cell_options},
|
||||
{"test_table_tbl_options", test_table_tbl_options},
|
||||
{"test_table_cell_properties", test_table_cell_properties},
|
||||
{"test_table_tbl_properties", test_table_tbl_properties},
|
||||
{"test_memory_errors", test_memory_errors},
|
||||
};
|
||||
|
||||
|
@@ -1,15 +1,15 @@
|
||||
#include "tests.h"
|
||||
#include "fort.h"
|
||||
|
||||
int set_test_options_for_table(struct ft_table *table)
|
||||
int set_test_props_for_table(struct ft_table *table)
|
||||
{
|
||||
assert(table);
|
||||
int status = FT_SUCCESS;
|
||||
status |= ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_BOTTOM_PADDING, 1);
|
||||
status |= ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_TOP_PADDING, 1);
|
||||
status |= ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_LEFT_PADDING, 1);
|
||||
status |= ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_RIGHT_PADDING, 1);
|
||||
status |= ft_set_cell_option(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_COPT_EMPTY_STR_HEIGHT, 1);
|
||||
status |= ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_BOTTOM_PADDING, 1);
|
||||
status |= ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_TOP_PADDING, 1);
|
||||
status |= ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_LEFT_PADDING, 1);
|
||||
status |= ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_RIGHT_PADDING, 1);
|
||||
status |= ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_EMPTY_STR_HEIGHT, 1);
|
||||
|
||||
assert_true(status == FT_SUCCESS);
|
||||
|
||||
@@ -33,18 +33,18 @@ int set_test_options_for_table(struct ft_table *table)
|
||||
return ft_set_border_style(table, &brdr_style);
|
||||
}
|
||||
|
||||
int set_test_options_as_default(void)
|
||||
int set_test_properties_as_default(void)
|
||||
{
|
||||
int status = FT_SUCCESS;
|
||||
|
||||
status |= ft_set_default_cell_option(FT_COPT_MIN_WIDTH, 0);
|
||||
status |= ft_set_default_cell_option(FT_COPT_TEXT_ALIGN, FT_ALIGNED_RIGHT);
|
||||
status |= ft_set_default_cell_prop(FT_CPROP_MIN_WIDTH, 0);
|
||||
status |= ft_set_default_cell_prop(FT_CPROP_TEXT_ALIGN, FT_ALIGNED_RIGHT);
|
||||
|
||||
status |= ft_set_default_cell_option(FT_COPT_BOTTOM_PADDING, 1);
|
||||
status |= ft_set_default_cell_option(FT_COPT_TOP_PADDING, 1);
|
||||
status |= ft_set_default_cell_option(FT_COPT_LEFT_PADDING, 1);
|
||||
status |= ft_set_default_cell_option(FT_COPT_RIGHT_PADDING, 1);
|
||||
status |= ft_set_default_cell_option(FT_COPT_EMPTY_STR_HEIGHT, 1);
|
||||
status |= ft_set_default_cell_prop(FT_CPROP_BOTTOM_PADDING, 1);
|
||||
status |= ft_set_default_cell_prop(FT_CPROP_TOP_PADDING, 1);
|
||||
status |= ft_set_default_cell_prop(FT_CPROP_LEFT_PADDING, 1);
|
||||
status |= ft_set_default_cell_prop(FT_CPROP_RIGHT_PADDING, 1);
|
||||
status |= ft_set_default_cell_prop(FT_CPROP_EMPTY_STR_HEIGHT, 1);
|
||||
|
||||
assert_true(status == FT_SUCCESS);
|
||||
|
||||
@@ -78,12 +78,12 @@ struct ft_table *create_test_int_table(int set_test_opts)
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
if (set_test_opts) {
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
}
|
||||
|
||||
assert_true(table != NULL);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
int n = ft_write_ln(table, "3", "4", "55", "67");
|
||||
assert(n == FT_SUCCESS);
|
||||
|
||||
@@ -108,12 +108,12 @@ struct ft_table *create_test_int_wtable(int set_test_opts)
|
||||
table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
if (set_test_opts) {
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
}
|
||||
|
||||
assert_true(table != NULL);
|
||||
|
||||
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||
int n = ft_wwrite_ln(table, L"3", L"4", L"55", L"67");
|
||||
assert(n == FT_SUCCESS);
|
||||
|
||||
|
@@ -32,8 +32,8 @@ void test_wcs_table_boundaries(void);
|
||||
void test_table_write(void);
|
||||
void test_table_border_style(void);
|
||||
void test_table_builtin_border_styles(void);
|
||||
void test_table_cell_options(void);
|
||||
void test_table_tbl_options(void);
|
||||
void test_table_cell_properties(void);
|
||||
void test_table_tbl_properties(void);
|
||||
void test_memory_errors(void);
|
||||
|
||||
struct test_case {
|
||||
@@ -73,8 +73,8 @@ struct ft_table;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int set_test_options_for_table(struct ft_table *table);
|
||||
int set_test_options_as_default(void);
|
||||
int set_test_props_for_table(struct ft_table *table);
|
||||
int set_test_properties_as_default(void);
|
||||
struct ft_table *create_test_int_table(int set_test_opts);
|
||||
struct ft_table *create_test_int_wtable(int set_test_opts);
|
||||
void run_test_suit(const char *test_suit_name, int n_tests, struct test_case test_suit[]);
|
||||
|
@@ -5,7 +5,7 @@ void test_table_sizes(void)
|
||||
{
|
||||
ft_table_t *table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
|
||||
size_t rows = 0;
|
||||
@@ -54,7 +54,7 @@ void test_table_geometry(void)
|
||||
{
|
||||
ft_table_t *table = ft_create_table();
|
||||
assert_true(table != NULL);
|
||||
assert_true(set_test_options_for_table(table) == FT_SUCCESS);
|
||||
assert_true(set_test_props_for_table(table) == FT_SUCCESS);
|
||||
|
||||
size_t height = 0;
|
||||
size_t width = 0;
|
||||
|
Reference in New Issue
Block a user