From: Robert Kessl Date: Wed, 30 Jul 2014 07:18:14 +0000 (+0200) Subject: tableprinter: update of tests of table_set_col_order_by_name X-Git-Tag: v6.1~3^2~23 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=75d3bf96ebeb20a90618a8937755136fb1219b41;p=libucw.git tableprinter: update of tests of table_set_col_order_by_name --- diff --git a/ucw/table-test-2.c b/ucw/table-test-2.c index 78df449b..cb56b14e 100644 --- a/ucw/table-test-2.c +++ b/ucw/table-test-2.c @@ -81,7 +81,7 @@ static void do_test2(void) out = bfdopen_shared(1, 4096); struct table *tbl = table_init(&test_tbl2); table_set_col_order_by_name(tbl, ""); - const char *err = table_set_option_value(tbl, "cols", "size[KB],size[MB],size[GB],size[TB],size[auto],ts[datetime],ts[timestamp]"); + const char *err = table_set_option_value(tbl, "cols", "size[MB,TB,KB],size[MB],size[GB],size[TB],size[auto],ts[datetime],ts[timestamp],size[MB,KB]"); if(err) { opt_failure("err in table_set_option_value: '%s'.", err); abort(); @@ -113,10 +113,46 @@ static void do_test2(void) bclose(out); } +static void do_test3(void) +{ + struct fastbuf *out; + out = bfdopen_shared(1, 4096); + + struct table *tbl = table_init(&test_tbl2); + table_set_col_order_by_name(tbl, ""); + const char *err = table_set_option_value(tbl, "cols", "size[MB,TB,KB],size[MB],size[GB],size[TB],size[auto],ts[datetime],ts[timestamp],size[MB,KB]"); + bprintf(out, "Error occured: %s\n", err); + table_cleanup(tbl); + + + tbl = table_init(&test_tbl2); + table_set_col_order_by_name(tbl, ""); + err = table_set_option_value(tbl, "cols", "size[MB,TB,KB],size[MB],size[GB],size[TB],size[auto],ts[datetime],ts[timestamp],size[MB,KB"); + bprintf(out, "Error occured: %s\n", err); + table_cleanup(tbl); + + + tbl = table_init(&test_tbl2); + table_set_col_order_by_name(tbl, ""); + err = table_set_option_value(tbl, "cols", "size[MB,TB,KB"); + bprintf(out, "Error occured: %s\n", err); + table_cleanup(tbl); + + + tbl = table_init(&test_tbl2); + table_set_col_order_by_name(tbl, ""); + err = table_set_option_value(tbl, "cols", "size[MB,TB,KB]"); + bprintf(out, "Error occured: %s\n", err); + table_cleanup(tbl); + + bclose(out); +} + int main(int argc UNUSED, char **argv UNUSED) { do_test(); do_test2(); + do_test3(); return 0; } diff --git a/ucw/table-test-2.t b/ucw/table-test-2.t index 21b60ec3..90d12137 100644 --- a/ucw/table-test-2.t +++ b/ucw/table-test-2.t @@ -6,8 +6,12 @@ Out <