static void assert_almighty_always_pipe (gboolean always_pipe_value, gboolean tree_start_expected, gboolean tree_stop_expected, gboolean was_init_called, gboolean was_deinit_called) { CfgTree tree; AlmightyAlwaysPipe *pipe; cfg_tree_init_instance (&tree, NULL); pipe = create_and_attach_almighty_pipe (&tree, always_pipe_value); assert_gboolean (cfg_tree_start (&tree), tree_start_expected, "cfg_tree_start() did not return the expected value"); assert_gboolean (cfg_tree_stop (&tree), tree_stop_expected, "cfg_tree_stop() did not return the epxected value"); assert_gboolean (pipe->init_called, was_init_called, "->init was called state"); assert_gboolean (pipe->deinit_called, was_deinit_called, "->deinit was called state"); cfg_tree_free_instance (&tree); }
void test_string_searched_for_is_not_in_the_list(const char *top_srcdir) { gchar *list_file_with_one_line = g_strdup_printf(LIST_FILE_DIR "test.list", top_srcdir); assert_gboolean(evaluate_testcase(MSG_2, filter_in_list_new(list_file_with_one_line, "PROGRAM")), FALSE, "in-list filter matches"); g_free(list_file_with_one_line); }
void test_given_macro_is_not_available_in_this_message(const char *top_srcdir) { gchar *list_file_with_one_line = g_strdup_printf(LIST_FILE_DIR "test.list", top_srcdir); assert_gboolean(evaluate_testcase(MSG_2, filter_in_list_new(list_file_with_one_line, "FOO_MACRO")), FALSE, "in-list filter matches"); g_free(list_file_with_one_line); }
void test_filter_with_long_line(const char *top_srcdir) { gchar *list_file_with_long_line = g_strdup_printf(LIST_FILE_DIR "long_line.list", top_srcdir); assert_gboolean(evaluate_testcase(MSG_LONG, filter_in_list_new(list_file_with_long_line, "HOST")), TRUE, "in-list filter matches"); g_free(list_file_with_long_line); }
void test_filter_with_ip_address(const char *top_srcdir) { gchar *list_file_with_ip_address = g_strdup_printf(LIST_FILE_DIR "ip.list", top_srcdir); assert_gboolean(evaluate_testcase(MSG_3, filter_in_list_new(list_file_with_ip_address, "HOST")), TRUE, "in-list filter matches"); g_free(list_file_with_ip_address); }
void test_list_file_contains_lot_of_lines(const char *top_srcdir) { gchar *list_file_which_has_a_lot_of_lines = g_strdup_printf(LIST_FILE_DIR "lot_of_lines.list", top_srcdir); assert_gboolean(evaluate_testcase(MSG_1, filter_in_list_new(list_file_which_has_a_lot_of_lines, "PROGRAM")), TRUE, "in-list filter matches"); g_free(list_file_which_has_a_lot_of_lines); }
void test_list_file_contains_only_one_line(const char *top_srcdir) { gchar *list_file_with_one_line = g_strdup_printf(LIST_FILE_DIR "test.list", top_srcdir); assert_gboolean(evaluate_testcase(MSG_1, filter_in_list_new(list_file_with_one_line, "PROGRAM")), TRUE, "in-list filter matches"); g_free(list_file_with_one_line); }
void test_filter_returns_false_when_list_is_empty(const char *top_srcdir) { gchar *list_file_with_zero_lines = g_strdup_printf(LIST_FILE_DIR "empty.list", top_srcdir); assert_gboolean(evaluate_testcase(MSG_1, filter_in_list_new(list_file_with_zero_lines, "PROGRAM")), FALSE, "in-list filter matches"); g_free(list_file_with_zero_lines); }