1
0
Fork 0

Merge pull request #39 from seleznevae/issues-37

Fix incorrect cell width evaluation in case of invisible symbols
This commit is contained in:
Seleznev Anton 2020-02-07 21:10:35 +03:00 committed by GitHub
commit bff48549de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 285 additions and 38 deletions

View File

@ -8,6 +8,10 @@
- Add new table property `adding_strategy` (2 strategies available - replace(default) and insert).
- Add function `ft_row_count` (`row_count` in C++ API) to get number of rows in the table.
### Bug fixes
- Fix incorrect cell width evaluation in case of invisible symbols
### Internal
- Refactoring of code that uses vectors.

View File

@ -2091,7 +2091,10 @@ FT_INTERNAL
f_cell_t *copy_cell(f_cell_t *cell);
FT_INTERNAL
size_t hint_width_cell(const f_cell_t *cell, const f_context_t *context, enum f_geometry_type geom);
size_t cell_vis_width(const f_cell_t *cell, const f_context_t *context);
FT_INTERNAL
size_t cell_invis_codes_width(const f_cell_t *cell, const f_context_t *context);
FT_INTERNAL
size_t hint_height_cell(const f_cell_t *cell, const f_context_t *context);
@ -2353,7 +2356,7 @@ enum f_cell_type get_cell_type(const f_cell_t *cell)
}
FT_INTERNAL
size_t hint_width_cell(const f_cell_t *cell, const f_context_t *context, enum f_geometry_type geom)
size_t cell_vis_width(const f_cell_t *cell, const f_context_t *context)
{
/* todo:
* At the moment min width includes paddings. Maybe it is better that min width weren't include
@ -2374,25 +2377,35 @@ size_t hint_width_cell(const f_cell_t *cell, const f_context_t *context, enum f_
result += buffer_text_visible_width(cell->str_buffer);
}
result = MAX(result, (size_t)get_cell_property_hierarchically(properties, row, column, FT_CPROP_MIN_WIDTH));
return result;
}
if (geom == INTERN_REPR_GEOMETRY) {
char cell_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_style_tag_for_cell(properties, row, column, cell_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(cell_style_tag);
FT_INTERNAL
size_t cell_invis_codes_width(const f_cell_t *cell, const f_context_t *context)
{
assert(cell);
assert(context);
char reset_cell_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_reset_style_tag_for_cell(properties, row, column, reset_cell_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(reset_cell_style_tag);
f_table_properties_t *properties = context->table_properties;
size_t row = context->row;
size_t column = context->column;
char content_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_style_tag_for_content(properties, row, column, content_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(content_style_tag);
size_t result = 0;
char cell_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_style_tag_for_cell(properties, row, column, cell_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(cell_style_tag);
char reset_content_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_reset_style_tag_for_content(properties, row, column, reset_content_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(reset_content_style_tag);
}
char reset_cell_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_reset_style_tag_for_cell(properties, row, column, reset_cell_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(reset_cell_style_tag);
char content_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_style_tag_for_content(properties, row, column, content_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(content_style_tag);
char reset_content_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_reset_style_tag_for_content(properties, row, column, reset_content_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(reset_content_style_tag);
return result;
}
@ -2424,7 +2437,7 @@ int cell_printf(f_cell_t *cell, size_t row, f_conv_context_t *cntx, size_t vis_w
const f_context_t *context = cntx->cntx;
size_t buf_len = vis_width;
if (cell == NULL || (vis_width < hint_width_cell(cell, context, VISIBLE_GEOMETRY))) {
if (cell == NULL || (vis_width < cell_vis_width(cell, context))) {
return -1;
}
@ -7001,6 +7014,7 @@ f_status table_rows_and_cols_geometry(const ft_table_t *table,
return FT_ERROR;
}
size_t max_invis_codepoints = 0;
size_t cols = 0;
size_t rows = 0;
int status = get_table_sizes(table, &rows, &cols);
@ -7030,7 +7044,7 @@ f_status table_rows_and_cols_geometry(const ft_table_t *table,
if (cell) {
switch (get_cell_type(cell)) {
case COMMON_CELL:
col_width_arr[col] = MAX(col_width_arr[col], hint_width_cell(cell, &context, geom));
col_width_arr[col] = MAX(col_width_arr[col], cell_vis_width(cell, &context));
break;
case GROUP_MASTER_CELL:
combined_cells_found = 1;
@ -7049,6 +7063,21 @@ f_status table_rows_and_cols_geometry(const ft_table_t *table,
}
}
}
if (geom == INTERN_REPR_GEOMETRY) {
max_invis_codepoints = 0;
for (row = 0; row < rows; ++row) {
const f_row_t *row_p = get_row_c(table, row);
const f_cell_t *cell = get_cell_c(row_p, col);
if (!cell)
continue;
context.column = col;
context.row = row;
size_t inv_codepoints = cell_invis_codes_width(cell, &context);
max_invis_codepoints = MAX(max_invis_codepoints, inv_codepoints);
}
col_width_arr[col] += max_invis_codepoints;
}
}
if (combined_cells_found) {
@ -7061,7 +7090,10 @@ f_status table_rows_and_cols_geometry(const ft_table_t *table,
context.row = row;
if (cell) {
if (get_cell_type(cell) == GROUP_MASTER_CELL) {
size_t hint_width = hint_width_cell(cell, &context, geom);
size_t hint_width = cell_vis_width(cell, &context);
if (geom == INTERN_REPR_GEOMETRY) {
hint_width += cell_invis_codes_width(cell, &context);
}
size_t slave_col = col + group_cell_number(row_p, col);
size_t cur_adj_col = col;
size_t group_width = col_width_arr[col];

View File

@ -65,7 +65,7 @@ enum f_cell_type get_cell_type(const f_cell_t *cell)
}
FT_INTERNAL
size_t hint_width_cell(const f_cell_t *cell, const f_context_t *context, enum f_geometry_type geom)
size_t cell_vis_width(const f_cell_t *cell, const f_context_t *context)
{
/* todo:
* At the moment min width includes paddings. Maybe it is better that min width weren't include
@ -86,25 +86,35 @@ size_t hint_width_cell(const f_cell_t *cell, const f_context_t *context, enum f_
result += buffer_text_visible_width(cell->str_buffer);
}
result = MAX(result, (size_t)get_cell_property_hierarchically(properties, row, column, FT_CPROP_MIN_WIDTH));
return result;
}
if (geom == INTERN_REPR_GEOMETRY) {
char cell_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_style_tag_for_cell(properties, row, column, cell_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(cell_style_tag);
FT_INTERNAL
size_t cell_invis_codes_width(const f_cell_t *cell, const f_context_t *context)
{
assert(cell);
assert(context);
char reset_cell_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_reset_style_tag_for_cell(properties, row, column, reset_cell_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(reset_cell_style_tag);
f_table_properties_t *properties = context->table_properties;
size_t row = context->row;
size_t column = context->column;
char content_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_style_tag_for_content(properties, row, column, content_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(content_style_tag);
size_t result = 0;
char cell_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_style_tag_for_cell(properties, row, column, cell_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(cell_style_tag);
char reset_content_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_reset_style_tag_for_content(properties, row, column, reset_content_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(reset_content_style_tag);
}
char reset_cell_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_reset_style_tag_for_cell(properties, row, column, reset_cell_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(reset_cell_style_tag);
char content_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_style_tag_for_content(properties, row, column, content_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(content_style_tag);
char reset_content_style_tag[TEXT_STYLE_TAG_MAX_SIZE];
get_reset_style_tag_for_content(properties, row, column, reset_content_style_tag, TEXT_STYLE_TAG_MAX_SIZE);
result += strlen(reset_content_style_tag);
return result;
}
@ -136,7 +146,7 @@ int cell_printf(f_cell_t *cell, size_t row, f_conv_context_t *cntx, size_t vis_w
const f_context_t *context = cntx->cntx;
size_t buf_len = vis_width;
if (cell == NULL || (vis_width < hint_width_cell(cell, context, VISIBLE_GEOMETRY))) {
if (cell == NULL || (vis_width < cell_vis_width(cell, context))) {
return -1;
}

View File

@ -13,7 +13,10 @@ FT_INTERNAL
f_cell_t *copy_cell(f_cell_t *cell);
FT_INTERNAL
size_t hint_width_cell(const f_cell_t *cell, const f_context_t *context, enum f_geometry_type geom);
size_t cell_vis_width(const f_cell_t *cell, const f_context_t *context);
FT_INTERNAL
size_t cell_invis_codes_width(const f_cell_t *cell, const f_context_t *context);
FT_INTERNAL
size_t hint_height_cell(const f_cell_t *cell, const f_context_t *context);

View File

@ -143,6 +143,7 @@ f_status table_rows_and_cols_geometry(const ft_table_t *table,
return FT_ERROR;
}
size_t max_invis_codepoints = 0;
size_t cols = 0;
size_t rows = 0;
int status = get_table_sizes(table, &rows, &cols);
@ -172,7 +173,7 @@ f_status table_rows_and_cols_geometry(const ft_table_t *table,
if (cell) {
switch (get_cell_type(cell)) {
case COMMON_CELL:
col_width_arr[col] = MAX(col_width_arr[col], hint_width_cell(cell, &context, geom));
col_width_arr[col] = MAX(col_width_arr[col], cell_vis_width(cell, &context));
break;
case GROUP_MASTER_CELL:
combined_cells_found = 1;
@ -191,6 +192,21 @@ f_status table_rows_and_cols_geometry(const ft_table_t *table,
}
}
}
if (geom == INTERN_REPR_GEOMETRY) {
max_invis_codepoints = 0;
for (row = 0; row < rows; ++row) {
const f_row_t *row_p = get_row_c(table, row);
const f_cell_t *cell = get_cell_c(row_p, col);
if (!cell)
continue;
context.column = col;
context.row = row;
size_t inv_codepoints = cell_invis_codes_width(cell, &context);
max_invis_codepoints = MAX(max_invis_codepoints, inv_codepoints);
}
col_width_arr[col] += max_invis_codepoints;
}
}
if (combined_cells_found) {
@ -203,7 +219,10 @@ f_status table_rows_and_cols_geometry(const ft_table_t *table,
context.row = row;
if (cell) {
if (get_cell_type(cell) == GROUP_MASTER_CELL) {
size_t hint_width = hint_width_cell(cell, &context, geom);
size_t hint_width = cell_vis_width(cell, &context);
if (geom == INTERN_REPR_GEOMETRY) {
hint_width += cell_invis_codes_width(cell, &context);
}
size_t slave_col = col + group_cell_number(row_p, col);
size_t cur_adj_col = col;
size_t group_width = col_width_arr[col];

View File

@ -188,6 +188,114 @@ void test_bug_fixes(void)
ft_destroy_table(table);
}
#endif /* FT_HAVE_UTF8 */
SCENARIO("Issue 37 - https://github.com/seleznevae/libfort/issues/37") {
ft_table_t *table = ft_create_table();
ft_set_border_style(table, FT_BASIC_STYLE);
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
ft_write_ln(table, "xxx");
ft_write_ln(table,
"1\n2\n3\n4\n5\n6\n7\n8\n9\n0\n1\n2\n3\n4\n5\n6\n7\n8");
ft_set_cell_prop(table, 1, 0, FT_CPROP_CONT_FG_COLOR, FT_COLOR_RED);
const char *table_str = ft_to_string(table);
assert_true(table_str != NULL);
const char *table_str_etalon =
"+-----+\n"
"| xxx |\n"
"+-----+\n"
"| \033[31m1\033[0m |\n"
"| \033[31m2\033[0m |\n"
"| \033[31m3\033[0m |\n"
"| \033[31m4\033[0m |\n"
"| \033[31m5\033[0m |\n"
"| \033[31m6\033[0m |\n"
"| \033[31m7\033[0m |\n"
"| \033[31m8\033[0m |\n"
"| \033[31m9\033[0m |\n"
"| \033[31m0\033[0m |\n"
"| \033[31m1\033[0m |\n"
"| \033[31m2\033[0m |\n"
"| \033[31m3\033[0m |\n"
"| \033[31m4\033[0m |\n"
"| \033[31m5\033[0m |\n"
"| \033[31m6\033[0m |\n"
"| \033[31m7\033[0m |\n"
"| \033[31m8\033[0m |\n"
"+-----+\n";
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
SCENARIO("Issue 37 - https://github.com/seleznevae/libfort/issues/37") {
ft_table_t *table = ft_create_table();
ft_set_border_style(table, FT_BASIC_STYLE);
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
ft_write_ln(table, "hdr1", "hdr2", "xxx");
ft_write_ln(table, "3", "",
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||");
ft_set_cell_prop(table, 1, FT_ANY_COLUMN, FT_CPROP_CONT_FG_COLOR, FT_COLOR_RED);
const char *table_str = ft_to_string(table);
assert_true(table_str != NULL);
const char *table_str_etalon =
"+------+------+--------------------------------+\n"
"| hdr1 | hdr2 | xxx |\n"
"+------+------+--------------------------------+\n"
"| \033[31m3\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||\033[0m |\n"
"+------+------+--------------------------------+\n";
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
}
void test_table_basic(void)

View File

@ -26,6 +26,77 @@ void test_cpp_bug_fixes(void)
" 3 4 \n";
assert_string_equal(table_str, table_str_etalon);
}
SCENARIO("Issue 37 - https://github.com/seleznevae/libfort/issues/37") {
fort::char_table table;
table.set_border_style(FT_BASIC_STYLE);
table.set_cell_bottom_padding(0);
table.set_cell_top_padding(0);
table.set_cell_left_padding(1);
table.set_cell_right_padding(1);
table.set_cell_text_align(fort::text_align::left);
table << fort::header
<< "hdr1" << "hdr2" << "xxx" << fort::endr
<< "3" << "" <<
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||||||||||||||||||||||||||\n"
"||||||";
table.row(1).set_cell_content_fg_color(fort::color::red);
std::string table_str = table.to_string();
std::string table_str_etalon =
"+------+------+--------------------------------+\n"
"| hdr1 | hdr2 | xxx |\n"
"+------+------+--------------------------------+\n"
"| \033[31m3\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||||||||||||||||||||||||||\033[0m |\n"
"|\033[31m\033[0m |\033[31m\033[0m | \033[31m||||||\033[0m |\n"
"+------+------+--------------------------------+\n";
assert_string_equal(table_str, table_str_etalon);
}
}
void test_cpp_table_basic(void)