From 0f16476574ca6db732be739cea81ec6f9fdea491 Mon Sep 17 00:00:00 2001 From: seleznevae Date: Mon, 15 Jan 2018 21:33:48 +0300 Subject: [PATCH] [C] Changed default style --- src/fort.c | 15 ++++--- tests/test_table.c | 98 +++++++++++++++++++++++----------------------- 2 files changed, 56 insertions(+), 57 deletions(-) diff --git a/src/fort.c b/src/fort.c index 92a4fef..7e3ac64 100644 --- a/src/fort.c +++ b/src/fort.c @@ -163,22 +163,21 @@ static fort_table_options_t g_table_options = { /* border_chars */ { - '=', '=', '=', '=', + '+', '-', '+', '+', '|', '|', '|', - '=', '=', '=', '=', - '=', '=', '=', '=' + '+', '-', '+', '+', + '+', '-', '+', '+' }, /* header_border_chars */ { - '=', '=', '=', '=', - '|', '|', '|', - '=', '=', '=', '=', - '=', '=', '=', '=' + '+', '-', '+', '+', + '|', '|', '|', + '+', '-', '+', '+', + '+', '-', '+', '+' }, NULL, /* col_options */ - }; diff --git a/tests/test_table.c b/tests/test_table.c index 3116c74..803bc20 100644 --- a/tests/test_table.c +++ b/tests/test_table.c @@ -106,19 +106,19 @@ void test_table_basic(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "==========================\n" + "+---+---+-----+----------+\n" "| | | | |\n" "| 3 | c | 234 | 3.140000 |\n" "| | | | |\n" - "==========================\n" + "+---+---+-----+----------+\n" "| | | | |\n" "| 3 | c | 234 | 3.140000 |\n" "| | | | |\n" - "==========================\n" + "+---+---+-----+----------+\n" "| | | | |\n" "| 3 | c | 234 | 3.140000 |\n" "| | | | |\n" - "==========================\n"; + "+---+---+-----+----------+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -142,19 +142,19 @@ void test_table_basic(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "========================================\n" + "+-----+----------+----------+----------+\n" "| | | | |\n" "| 3 | c | 234 | 3.140000 |\n" "| | | | |\n" - "========================================\n" + "+-----+----------+----------+----------+\n" "| | | | |\n" "| c | 234 | 3.140000 | 3 |\n" "| | | | |\n" - "========================================\n" + "+-----+----------+----------+----------+\n" "| | | | |\n" "| 234 | 3.140000 | 3 | c |\n" "| | | | |\n" - "========================================\n"; + "+-----+----------+----------+----------+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -176,19 +176,19 @@ void test_table_basic(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "========================================\n" + "+-----+----------+----------+----------+\n" "| | | | |\n" "| | | 234 | 3.140000 |\n" "| | | | |\n" - "========================================\n" + "+-----+----------+----------+----------+\n" "| | | | |\n" "| c | 234 | 3.140000 | |\n" "| | | | |\n" - "========================================\n" + "+-----+----------+----------+----------+\n" "| | | | |\n" "| 234 | 3.140000 | | |\n" "| | | | |\n" - "========================================\n"; + "+-----+----------+----------+----------+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -210,19 +210,19 @@ void test_table_basic(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "=============\n" + "+--+--+--+--+\n" "| | | | |\n" "| | | | |\n" "| | | | |\n" - "=============\n" + "+--+--+--+--+\n" "| | | | |\n" "| | | | |\n" "| | | | |\n" - "=============\n" + "+--+--+--+--+\n" "| | | | |\n" "| | | | |\n" "| | | | |\n" - "=============\n"; + "+--+--+--+--+\n"; // fprintf(stderr, "content:\n%s", table_str); @@ -276,19 +276,19 @@ void test_table_options(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "===================\n" + "+---+---+----+----+\n" "| | | | |\n" "| 3 | 4 | 55 | 67 |\n" "| | | | |\n" - "===================\n" + "+---+---+----+----+\n" "| | | | |\n" "| 3 | 4 | 55 | 67 |\n" "| | | | |\n" - "===================\n" + "+---+---+----+----+\n" "| | | | |\n" "| 3 | 4 | 55 | 67 |\n" "| | | | |\n" - "===================\n"; + "+---+---+----+----+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -311,13 +311,13 @@ void test_table_options(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "===================\n" + "+---+---+----+----+\n" "| 3 | 4 | 55 | 67 |\n" - "===================\n" + "+---+---+----+----+\n" "| 3 | 4 | 55 | 67 |\n" - "===================\n" + "+---+---+----+----+\n" "| 3 | 4 | 55 | 67 |\n" - "===================\n"; + "+---+---+----+----+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -340,19 +340,19 @@ void test_table_options(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "===========\n" + "+-+-+--+--+\n" "| | | | |\n" "|3|4|55|67|\n" "| | | | |\n" - "===========\n" + "+-+-+--+--+\n" "| | | | |\n" "|3|4|55|67|\n" "| | | | |\n" - "===========\n" + "+-+-+--+--+\n" "| | | | |\n" "|3|4|55|67|\n" "| | | | |\n" - "===========\n"; + "+-+-+--+--+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -375,13 +375,13 @@ void test_table_options(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "===========\n" + "+-+-+--+--+\n" "|3|4|55|67|\n" - "===========\n" + "+-+-+--+--+\n" "|3|4|55|67|\n" - "===========\n" + "+-+-+--+--+\n" "|3|4|55|67|\n" - "===========\n"; + "+-+-+--+--+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -407,22 +407,22 @@ void test_table_options(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "===================\n" + "+---+---+----+----+\n" "| | | | |\n" "| 3 | 4 | 55 | 67 |\n" "| | | | |\n" - "===================\n" + "+---+---+----+----+\n" "| | | | |\n" "| 3 | 4 | 55 | 67 |\n" "| | | | |\n" - "===================\n" + "+---+---+----+----+\n" "| | | | |\n" "| 3 | 4 | 55 | 67 |\n" "| | | | |\n" - "===================\n" + "+---+---+----+----+\n" "| | | | |\n" "| | | | |\n" - "===================\n"; + "+---+---+----+----+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -495,13 +495,13 @@ void test_table_options(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "===========\n" + "+-+-+--+--+\n" "|3|4|55|67|\n" - "===========\n" + "+-+-+--+--+\n" "|3|4|55|67|\n" - "===========\n" + "+-+-+--+--+\n" "|3|4|55|67|\n" - "===========\n"; + "+-+-+--+--+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -515,19 +515,19 @@ void test_table_options(void **state) table_str = ft_to_string(table); assert_true( table_str != NULL ); table_str_etalon = - "===========\n" + "+-+-+--+--+\n" "| | | | |\n" "|3|4|55|67|\n" "| | | | |\n" - "===========\n" + "+-+-+--+--+\n" "| | | | |\n" "|3|4|55|67|\n" "| | | | |\n" - "===========\n" + "+-+-+--+--+\n" "| | | | |\n" "|3|4|55|67|\n" "| | | | |\n" - "===========\n"; + "+-+-+--+--+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0); @@ -554,19 +554,19 @@ void test_table_options(void **state) char *table_str = ft_to_string(table); assert_true( table_str != NULL ); const char *table_str_etalon = - "=======================\n" + "+---+-------+----+----+\n" "| | | | |\n" "| 3 | 4 | 55 | 67 |\n" "| | | | |\n" - "=======================\n" + "+---+-------+----+----+\n" "| | | | |\n" "| 3 | 4 | 55 | 67 |\n" "| | | | |\n" - "=======================\n" + "+---+-------+----+----+\n" "| | | | |\n" "| 3 | 4 | 55 | 67 |\n" "| | | | |\n" - "=======================\n"; + "+---+-------+----+----+\n"; // fprintf(stderr, "content:\n%s", table_str); assert_true( strcmp(table_str, table_str_etalon) == 0);