2018-03-19 21:07:18 +01:00
|
|
|
#include "tests.h"
|
2018-05-06 13:11:03 +02:00
|
|
|
#include "fort.h"
|
2018-03-19 21:07:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_table_border_style(void)
|
|
|
|
{
|
2018-05-05 21:34:45 +02:00
|
|
|
ft_table_t *table = NULL;
|
2018-03-19 21:07:18 +01:00
|
|
|
|
|
|
|
set_test_options_as_default();
|
|
|
|
|
|
|
|
|
|
|
|
WHEN("Changing cell separators") {
|
|
|
|
|
|
|
|
struct ft_border_style brdr_style;
|
2018-05-02 20:16:41 +02:00
|
|
|
brdr_style.border_chs.top_border_ch = "|";
|
|
|
|
brdr_style.border_chs.separator_ch = "|";
|
|
|
|
brdr_style.border_chs.bottom_border_ch = "|";
|
|
|
|
brdr_style.border_chs.side_border_ch = "=";
|
|
|
|
brdr_style.border_chs.out_intersect_ch = "+";
|
|
|
|
brdr_style.border_chs.in_intersect_ch = "#";
|
|
|
|
|
|
|
|
brdr_style.header_border_chs.top_border_ch = "*";
|
|
|
|
brdr_style.header_border_chs.separator_ch = "*";
|
|
|
|
brdr_style.header_border_chs.bottom_border_ch = "*";
|
|
|
|
brdr_style.header_border_chs.side_border_ch = "v";
|
|
|
|
brdr_style.header_border_chs.out_intersect_ch = "+";
|
|
|
|
brdr_style.header_border_chs.in_intersect_ch = "#";
|
|
|
|
|
|
|
|
brdr_style.hor_separator_char = "|";
|
2018-03-19 21:07:18 +01:00
|
|
|
ft_set_default_border_style(&brdr_style);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table = create_test_int_table(0);
|
|
|
|
const char *table_str = ft_to_string(table);
|
2018-03-31 12:33:37 +02:00
|
|
|
assert_true(table_str != NULL);
|
2018-03-19 21:07:18 +01:00
|
|
|
const char *table_str_etalon =
|
2018-03-31 12:33:37 +02:00
|
|
|
"+***+***+****+****+\n"
|
|
|
|
"v v v v v\n"
|
|
|
|
"v 3 v 4 v 55 v 67 v\n"
|
|
|
|
"v v v v v\n"
|
|
|
|
"+***#***#****#****+\n"
|
|
|
|
"= = = = =\n"
|
|
|
|
"= 3 = 4 = 55 = 67 =\n"
|
|
|
|
"= = = = =\n"
|
|
|
|
"+|||#|||#||||#||||+\n"
|
|
|
|
"= = = = =\n"
|
|
|
|
"= 3 = 4 = 55 = 67 =\n"
|
|
|
|
"= = = = =\n"
|
|
|
|
"+|||+|||+||||+||||+\n";
|
2018-03-24 15:01:29 +01:00
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
2018-03-19 21:07:18 +01:00
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-02 20:16:41 +02:00
|
|
|
brdr_style.border_chs.top_border_ch = "|";
|
|
|
|
brdr_style.border_chs.separator_ch = "\0";
|
|
|
|
brdr_style.border_chs.bottom_border_ch = "|";
|
|
|
|
brdr_style.border_chs.side_border_ch = "=";
|
|
|
|
brdr_style.border_chs.out_intersect_ch = "+";
|
|
|
|
brdr_style.border_chs.in_intersect_ch = "\0";
|
2018-03-19 21:07:18 +01:00
|
|
|
|
2018-05-02 20:16:41 +02:00
|
|
|
brdr_style.header_border_chs.top_border_ch = "*";
|
|
|
|
brdr_style.header_border_chs.separator_ch = "*";
|
|
|
|
brdr_style.header_border_chs.bottom_border_ch = "*";
|
|
|
|
brdr_style.header_border_chs.side_border_ch = "v";
|
|
|
|
brdr_style.header_border_chs.out_intersect_ch = "+";
|
|
|
|
brdr_style.header_border_chs.in_intersect_ch = "#";
|
|
|
|
|
|
|
|
brdr_style.hor_separator_char = "";
|
2018-03-19 21:07:18 +01:00
|
|
|
|
|
|
|
ft_set_default_border_style(&brdr_style);
|
|
|
|
|
2018-03-25 10:11:08 +02:00
|
|
|
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);
|
2018-03-19 21:07:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
table = create_test_int_table(0);
|
|
|
|
table_str = ft_to_string(table);
|
2018-03-31 12:33:37 +02:00
|
|
|
assert_true(table_str != NULL);
|
2018-03-19 21:07:18 +01:00
|
|
|
table_str_etalon =
|
2018-03-31 12:33:37 +02:00
|
|
|
"+***+***+****+****+\n"
|
|
|
|
"v 3 v 4 v 55 v 67 v\n"
|
|
|
|
"+***#***#****#****+\n"
|
|
|
|
"= 3 = 4 = 55 = 67 =\n"
|
|
|
|
"= 3 = 4 = 55 = 67 =\n"
|
|
|
|
"+|||+|||+||||+||||+\n";
|
2018-03-24 15:01:29 +01:00
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
2018-03-19 21:07:18 +01:00
|
|
|
ft_destroy_table(table);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
WHEN("Separator testing") {
|
|
|
|
table = create_test_int_table(1);
|
|
|
|
ft_add_separator(table);
|
|
|
|
|
2018-04-01 12:27:02 +02:00
|
|
|
ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
2018-03-19 21:07:18 +01:00
|
|
|
int n = ft_printf_ln(table, "%d|%d|%d|%d", 3, 4, 55, 67);
|
|
|
|
|
2018-03-31 12:33:37 +02:00
|
|
|
assert_true(n == 4);
|
2018-03-19 21:07:18 +01:00
|
|
|
|
|
|
|
const char *table_str = ft_to_string(table);
|
2018-03-31 12:33:37 +02:00
|
|
|
assert_true(table_str != NULL);
|
2018-03-19 21:07:18 +01:00
|
|
|
const char *table_str_etalon =
|
2018-03-31 12:33:37 +02:00
|
|
|
"+---+---+----+----+\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"
|
|
|
|
"| | | | |\n"
|
|
|
|
"| 3 | 4 | 55 | 67 |\n"
|
|
|
|
"| | | | |\n"
|
|
|
|
"+---+---+----+----+\n";
|
2018-03-24 15:01:29 +01:00
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
2018-03-19 21:07:18 +01:00
|
|
|
ft_destroy_table(table);
|
|
|
|
}
|
|
|
|
}
|
2018-05-06 17:25:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
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_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
|
|
|
|
ft_write_ln(table, "Rank", "Title", "Year", "Rating");
|
|
|
|
|
|
|
|
ft_write_ln(table, "1", "The Shawshank Redemption", "1994", "9.5");
|
|
|
|
ft_write_ln(table, "2", "12 Angry Men", "1957", "8.8");
|
|
|
|
ft_write_ln(table, "3", "It's a Wonderful Life", "1946", "8.6");
|
|
|
|
ft_add_separator(table);
|
|
|
|
ft_write_ln(table, "4", "2001: A Space Odyssey", "1968", "8.5");
|
|
|
|
ft_write_ln(table, "5", "Blade Runner", "1982", "8.1");
|
|
|
|
return table;
|
|
|
|
}
|
|
|
|
|
|
|
|
void test_table_builtin_border_styles(void)
|
|
|
|
{
|
|
|
|
ft_table_t *table = NULL;
|
|
|
|
const char *table_str = NULL;
|
|
|
|
const char *table_str_etalon = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_BASIC_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
"+------+--------------------------+------+--------+\n"
|
|
|
|
"| Rank | Title | Year | Rating |\n"
|
|
|
|
"+------+--------------------------+------+--------+\n"
|
|
|
|
"| 1 | The Shawshank Redemption | 1994 | 9.5 |\n"
|
|
|
|
"| 2 | 12 Angry Men | 1957 | 8.8 |\n"
|
|
|
|
"| 3 | It's a Wonderful Life | 1946 | 8.6 |\n"
|
|
|
|
"+------+--------------------------+------+--------+\n"
|
|
|
|
"| 4 | 2001: A Space Odyssey | 1968 | 8.5 |\n"
|
|
|
|
"| 5 | Blade Runner | 1982 | 8.1 |\n"
|
|
|
|
"+------+--------------------------+------+--------+\n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_SIMPLE_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
" \n"
|
|
|
|
" Rank Title Year Rating \n"
|
|
|
|
" ------ -------------------------- ------ -------- \n"
|
|
|
|
" 1 The Shawshank Redemption 1994 9.5 \n"
|
|
|
|
" 2 12 Angry Men 1957 8.8 \n"
|
|
|
|
" 3 It's a Wonderful Life 1946 8.6 \n"
|
|
|
|
" ------ -------------------------- ------ -------- \n"
|
|
|
|
" 4 2001: A Space Odyssey 1968 8.5 \n"
|
|
|
|
" 5 Blade Runner 1982 8.1 \n"
|
|
|
|
" \n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_PLAIN_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
" ------------------------------------------------- \n"
|
|
|
|
" Rank Title Year Rating \n"
|
|
|
|
" ------------------------------------------------- \n"
|
|
|
|
" 1 The Shawshank Redemption 1994 9.5 \n"
|
|
|
|
" 2 12 Angry Men 1957 8.8 \n"
|
|
|
|
" 3 It's a Wonderful Life 1946 8.6 \n"
|
|
|
|
" ------------------------------------------------- \n"
|
|
|
|
" 4 2001: A Space Odyssey 1968 8.5 \n"
|
|
|
|
" 5 Blade Runner 1982 8.1 \n"
|
|
|
|
" \n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_DOT_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
"...................................................\n"
|
|
|
|
": Rank : Title : Year : Rating :\n"
|
|
|
|
":......:..........................:......:........:\n"
|
|
|
|
": 1 : The Shawshank Redemption : 1994 : 9.5 :\n"
|
|
|
|
": 2 : 12 Angry Men : 1957 : 8.8 :\n"
|
|
|
|
": 3 : It's a Wonderful Life : 1946 : 8.6 :\n"
|
|
|
|
":......:..........................:......:........:\n"
|
|
|
|
": 4 : 2001: A Space Odyssey : 1968 : 8.5 :\n"
|
|
|
|
": 5 : Blade Runner : 1982 : 8.1 :\n"
|
|
|
|
":......:..........................:......:........:\n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_EMPTY_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
" \n"
|
|
|
|
" Rank Title Year Rating \n"
|
|
|
|
" 1 The Shawshank Redemption 1994 9.5 \n"
|
|
|
|
" 2 12 Angry Men 1957 8.8 \n"
|
|
|
|
" 3 It's a Wonderful Life 1946 8.6 \n"
|
|
|
|
" \n"
|
|
|
|
" 4 2001: A Space Odyssey 1968 8.5 \n"
|
|
|
|
" 5 Blade Runner 1982 8.1 \n"
|
|
|
|
" \n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_SOLID_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
"┌──────┬──────────────────────────┬──────┬────────┐\n"
|
|
|
|
"│ Rank │ Title │ Year │ Rating │\n"
|
|
|
|
"├──────┼──────────────────────────┼──────┼────────┤\n"
|
|
|
|
"│ 1 │ The Shawshank Redemption │ 1994 │ 9.5 │\n"
|
|
|
|
"│ 2 │ 12 Angry Men │ 1957 │ 8.8 │\n"
|
|
|
|
"│ 3 │ It's a Wonderful Life │ 1946 │ 8.6 │\n"
|
|
|
|
"├──────┼──────────────────────────┼──────┼────────┤\n"
|
|
|
|
"│ 4 │ 2001: A Space Odyssey │ 1968 │ 8.5 │\n"
|
|
|
|
"│ 5 │ Blade Runner │ 1982 │ 8.1 │\n"
|
|
|
|
"└──────┴──────────────────────────┴──────┴────────╯\n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_SOLID_ROUND_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
"╭──────┬──────────────────────────┬──────┬────────╮\n"
|
|
|
|
"│ Rank │ Title │ Year │ Rating │\n"
|
|
|
|
"├──────┼──────────────────────────┼──────┼────────┤\n"
|
|
|
|
"│ 1 │ The Shawshank Redemption │ 1994 │ 9.5 │\n"
|
|
|
|
"│ 2 │ 12 Angry Men │ 1957 │ 8.8 │\n"
|
|
|
|
"│ 3 │ It's a Wonderful Life │ 1946 │ 8.6 │\n"
|
|
|
|
"├──────┼──────────────────────────┼──────┼────────┤\n"
|
|
|
|
"│ 4 │ 2001: A Space Odyssey │ 1968 │ 8.5 │\n"
|
|
|
|
"│ 5 │ Blade Runner │ 1982 │ 8.1 │\n"
|
|
|
|
"╰──────┴──────────────────────────┴──────┴────────╯\n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_DOUBLE_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
"╔══════╦══════════════════════════╦══════╦════════╗\n"
|
|
|
|
"║ Rank ║ Title ║ Year ║ Rating ║\n"
|
|
|
|
"╠══════╬══════════════════════════╬══════╬════════╣\n"
|
|
|
|
"║ 1 ║ The Shawshank Redemption ║ 1994 ║ 9.5 ║\n"
|
|
|
|
"║ 2 ║ 12 Angry Men ║ 1957 ║ 8.8 ║\n"
|
|
|
|
"║ 3 ║ It's a Wonderful Life ║ 1946 ║ 8.6 ║\n"
|
|
|
|
"╠══════╬══════════════════════════╬══════╬════════╣\n"
|
|
|
|
"║ 4 ║ 2001: A Space Odyssey ║ 1968 ║ 8.5 ║\n"
|
|
|
|
"║ 5 ║ Blade Runner ║ 1982 ║ 8.1 ║\n"
|
|
|
|
"╚══════╩══════════════════════════╩══════╩════════╝\n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_DOUBLE2_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
"╔══════╤══════════════════════════╤══════╤════════╗\n"
|
|
|
|
"║ Rank │ Title │ Year │ Rating ║\n"
|
|
|
|
"╠══════╪══════════════════════════╪══════╪════════╣\n"
|
|
|
|
"║ 1 │ The Shawshank Redemption │ 1994 │ 9.5 ║\n"
|
|
|
|
"╟──────┼──────────────────────────┼──────┼────────╢\n"
|
|
|
|
"║ 2 │ 12 Angry Men │ 1957 │ 8.8 ║\n"
|
|
|
|
"╟──────┼──────────────────────────┼──────┼────────╢\n"
|
|
|
|
"║ 3 │ It's a Wonderful Life │ 1946 │ 8.6 ║\n"
|
|
|
|
"╠══════╪══════════════════════════╪══════╪════════╣\n"
|
|
|
|
"║ 4 │ 2001: A Space Odyssey │ 1968 │ 8.5 ║\n"
|
|
|
|
"╟──────┼──────────────────────────┼──────┼────────╢\n"
|
|
|
|
"║ 5 │ Blade Runner │ 1982 │ 8.1 ║\n"
|
|
|
|
"╚══════╧══════════════════════════╧══════╧════════╝\n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_BOLD_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
"┏━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━┓\n"
|
|
|
|
"┃ Rank ┃ Title ┃ Year ┃ Rating ┃\n"
|
|
|
|
"┣━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━╋━━━━━━━━┫\n"
|
|
|
|
"┃ 1 ┃ The Shawshank Redemption ┃ 1994 ┃ 9.5 ┃\n"
|
|
|
|
"┃ 2 ┃ 12 Angry Men ┃ 1957 ┃ 8.8 ┃\n"
|
|
|
|
"┃ 3 ┃ It's a Wonderful Life ┃ 1946 ┃ 8.6 ┃\n"
|
|
|
|
"┣━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━╋━━━━━━━━┫\n"
|
|
|
|
"┃ 4 ┃ 2001: A Space Odyssey ┃ 1968 ┃ 8.5 ┃\n"
|
|
|
|
"┃ 5 ┃ Blade Runner ┃ 1982 ┃ 8.1 ┃\n"
|
|
|
|
"┗━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━┻━━━━━━━━┛\n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_BOLD2_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
"┏━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━━┓\n"
|
|
|
|
"┃ Rank │ Title │ Year │ Rating ┃\n"
|
|
|
|
"┣━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━┿━━━━━━━━┫\n"
|
|
|
|
"┃ 1 │ The Shawshank Redemption │ 1994 │ 9.5 ┃\n"
|
|
|
|
"┠──────┼──────────────────────────┼──────┼────────┨\n"
|
|
|
|
"┃ 2 │ 12 Angry Men │ 1957 │ 8.8 ┃\n"
|
|
|
|
"┠──────┼──────────────────────────┼──────┼────────┨\n"
|
|
|
|
"┃ 3 │ It's a Wonderful Life │ 1946 │ 8.6 ┃\n"
|
|
|
|
"┣━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━┿━━━━━━━━┫\n"
|
|
|
|
"┃ 4 │ 2001: A Space Odyssey │ 1968 │ 8.5 ┃\n"
|
|
|
|
"┠──────┼──────────────────────────┼──────┼────────┨\n"
|
|
|
|
"┃ 5 │ Blade Runner │ 1982 │ 8.1 ┃\n"
|
|
|
|
"┗━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━┛\n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
|
|
|
|
/* *************************************************************** */
|
|
|
|
|
|
|
|
ft_set_default_border_style(FT_FRAME_STYLE);
|
|
|
|
table = create_basic_table();
|
|
|
|
table_str = ft_to_string(table);
|
|
|
|
assert_true(table_str != NULL);
|
|
|
|
|
|
|
|
table_str_etalon =
|
|
|
|
"▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▜\n"
|
|
|
|
"▌ Rank ┃ Title ┃ Year ┃ Rating ▐\n"
|
|
|
|
"▌━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━╋━━━━━━━━▐\n"
|
|
|
|
"▌ 1 ┃ The Shawshank Redemption ┃ 1994 ┃ 9.5 ▐\n"
|
|
|
|
"▌ 2 ┃ 12 Angry Men ┃ 1957 ┃ 8.8 ▐\n"
|
|
|
|
"▌ 3 ┃ It's a Wonderful Life ┃ 1946 ┃ 8.6 ▐\n"
|
|
|
|
"▌━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━╋━━━━━━━━▐\n"
|
|
|
|
"▌ 4 ┃ 2001: A Space Odyssey ┃ 1968 ┃ 8.5 ▐\n"
|
|
|
|
"▌ 5 ┃ Blade Runner ┃ 1982 ┃ 8.1 ▐\n"
|
|
|
|
"▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▟\n";
|
|
|
|
assert_str_equal(table_str, table_str_etalon);
|
|
|
|
ft_destroy_table(table);
|
|
|
|
}
|