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();
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;
}
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