]> mj.ucw.cz Git - libucw.git/commitdiff
tableprinter: update of tests of table_set_col_order_by_name
authorRobert Kessl <kesslr@centrum.cz>
Wed, 30 Jul 2014 07:18:14 +0000 (09:18 +0200)
committerRobert Kessl <kesslr@centrum.cz>
Wed, 30 Jul 2014 07:18:14 +0000 (09:18 +0200)
ucw/table-test-2.c
ucw/table-test-2.t

index 78df449b28390571b6ed868b5e50255fee9841d1..cb56b14e9115a6f99e7371bc449f7c289b356396 100644 (file)
@@ -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;
 }
index 21b60ec3f459d9aac3130e2cc5e30248748b515b..90d121374031e5a850a6cfed839d664878426cce 100644 (file)
@@ -6,8 +6,12 @@ Out <<EOF
          4096MB           1403685533
             4GB  2014-06-25 08:38:53
             4TB  2014-06-25 08:38:53
-           size            size            size            size            size                   ts                   ts
-         4096KB             4MB             0GB             0TB             4MB  2014-06-25 08:38:53           1403685533
-      4194304KB          4096MB             4GB             0TB             4GB  2014-06-25 08:38:53           1403685533
-   4294967296KB       4194304MB          4096GB             4TB             4TB  2014-06-25 08:38:53           1403685533
+           size            size            size            size            size                   ts                   ts            size
+         4096KB             4MB             0GB             0TB             4MB  2014-06-25 08:38:53           1403685533          4096KB
+      4194304KB          4096MB             4GB             0TB             4GB  2014-06-25 08:38:53           1403685533       4194304KB
+   4294967296KB       4194304MB          4096GB             4TB             4TB  2014-06-25 08:38:53           1403685533    4294967296KB
+Error occured: (null)
+Error occured: Invalid column definition, missing ']'.
+Error occured: Invalid column definition, missing ']'.
+Error occured: (null)
 EOF