Commit d3aa4f2a authored by Maria Matejka's avatar Maria Matejka
Browse files

Filter: fix filter comparison test

parent dfb3eb77
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -49,12 +49,6 @@ run_function(const void *arg)
  if (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);
  enum filter_return fret = f_eval(t->fn, tmp, NULL);
  rfree(tmp);
@@ -81,23 +75,29 @@ int
main(int argc, char *argv[])
{
  bt_init(argc, argv);

  bt_bird_init();
  
  bt_assert_hook = bt_assert_filter;

  struct config *c = NULL;
  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_assert(c);

  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;
  WALK_LIST(t, c->tests)
    bt_test_suite_base(run_function, t->fn_name, t, BT_FORKING, BT_TIMEOUT, "%s", t->dsc);
  }

  bt_bird_cleanup();
  return bt_exit_value();
}