Filter: fix filter comparison test

This commit is contained in:
Maria Matejka 2019-12-12 15:42:29 +01:00
parent dfb3eb7716
commit d3aa4f2aed

View file

@ -49,12 +49,6 @@ run_function(const void *arg)
if (t->cmp) if (t->cmp)
return t->result == f_same(t->fn, t->cmp); return t->result == f_same(t->fn, t->cmp);
if (!f_same(t->fn, t->fn)) {
bt_result = bt_suite_result = 0;
bt_log_suite_case_result(0, "The function doesn't compare to itself as the same");
return 0;
}
linpool *tmp = lp_new_default(&root_pool); linpool *tmp = lp_new_default(&root_pool);
enum filter_return fret = f_eval(t->fn, tmp, NULL); enum filter_return fret = f_eval(t->fn, tmp, NULL);
rfree(tmp); rfree(tmp);
@ -81,23 +75,29 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
bt_init(argc, argv); bt_init(argc, argv);
bt_bird_init(); bt_bird_init();
bt_assert_hook = bt_assert_filter; bt_assert_hook = bt_assert_filter;
struct config *c = NULL; struct config *c = NULL;
struct parse_config_file_arg pcfa = { .cp = &c, .filename = BT_CONFIG_FILE }; struct parse_config_file_arg pcfa = { .cp = &c, .filename = BT_CONFIG_FILE };
bt_test_suite_base(parse_config_file, "conf", (const void *) &pcfa, 0, 0, "parse config file"); bt_test_suite_base(parse_config_file, "conf", (const void *) &pcfa, 0, 0, "parse config file");
bt_assert(c);
bt_test_suite_base(parse_config_file, "reconf", (const void *) &pcfa, 0, 0, "reconfigure with the same file"); bt_test_suite_base(parse_config_file, "reconf", (const void *) &pcfa, 0, 0, "reconfigure with the same file");
bt_assert(c);
bt_bird_cleanup(); struct symbol *s;
WALK_LIST(s, c->symbols)
if ((s->class == SYM_FUNCTION) || (s->class == SYM_FILTER))
bt_assert_msg((s->flags & SYM_FLAG_SAME), "Symbol %s same check", s->name);
if (c)
{
struct f_bt_test_suite *t; struct f_bt_test_suite *t;
WALK_LIST(t, c->tests) WALK_LIST(t, c->tests)
bt_test_suite_base(run_function, t->fn_name, t, BT_FORKING, BT_TIMEOUT, "%s", t->dsc); bt_test_suite_base(run_function, t->fn_name, t, BT_FORKING, BT_TIMEOUT, "%s", t->dsc);
}
bt_bird_cleanup();
return bt_exit_value(); return bt_exit_value();
} }