diff --git a/tests/tests.h b/tests/tests.h index 223bc142d..c1f39b59f 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -22,14 +22,7 @@ #define WEE_TEST_STR(__result, __test) \ str = __test; \ - if (__result == NULL) \ - { \ - POINTERS_EQUAL(NULL, str); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result, str); \ - } \ + STRCMP_EQUAL(__result, str); \ free (str); extern void run_cmd (const char *command); diff --git a/tests/unit/core/hook/test-hook-modifier.cpp b/tests/unit/core/hook/test-hook-modifier.cpp index 72e080c8f..8cd9a42f5 100644 --- a/tests/unit/core/hook/test-hook-modifier.cpp +++ b/tests/unit/core/hook/test-hook-modifier.cpp @@ -178,7 +178,7 @@ TEST(HookModifier, Modifier) /* check hook contents */ CHECK(hook); POINTERS_EQUAL(NULL, hook->plugin); - POINTERS_EQUAL(NULL, hook->subplugin); + STRCMP_EQUAL(NULL, hook->subplugin); LONGS_EQUAL(HOOK_TYPE_MODIFIER, hook->type); LONGS_EQUAL(0, hook->deleted); LONGS_EQUAL(0, hook->running); @@ -207,7 +207,7 @@ TEST(HookModifier, Modifier) gui_chat_printf_date_tags (test_buffer, 0, NULL, "\t\tmessage"); ptr_line = test_buffer->own_lines->last_line; LONGS_EQUAL(0, ptr_line->data->date); - POINTERS_EQUAL(NULL, ptr_line->data->prefix); + STRCMP_EQUAL(NULL, ptr_line->data->prefix); STRCMP_EQUAL("message (modified)", ptr_line->data->message); /* message without date: add a date/prefix */ @@ -246,7 +246,7 @@ TEST(HookModifier, Modifier) "prefix\tmessage"); ptr_line = test_buffer->own_lines->last_line; LONGS_EQUAL(0, ptr_line->data->date); - POINTERS_EQUAL(NULL, ptr_line->data->prefix); + STRCMP_EQUAL(NULL, ptr_line->data->prefix); STRCMP_EQUAL("message (modified)", ptr_line->data->message); /* close the test buffer */ diff --git a/tests/unit/core/test-core-arraylist.cpp b/tests/unit/core/test-core-arraylist.cpp index 2f8d1ceb2..a6db5db56 100644 --- a/tests/unit/core/test-core-arraylist.cpp +++ b/tests/unit/core/test-core-arraylist.cpp @@ -180,7 +180,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) { if (allow_duplicates) { - POINTERS_EQUAL(NULL, arraylist->data[0]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[0]); STRCMP_EQUAL(item_abc, (const char *)arraylist->data[1]); STRCMP_EQUAL(item_DEF, (const char *)arraylist->data[2]); STRCMP_EQUAL(item_def, (const char *)arraylist->data[3]); @@ -189,19 +189,19 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) STRCMP_EQUAL(item_zzz, (const char *)arraylist->data[6]); for (i = 7; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } else { - POINTERS_EQUAL(NULL, arraylist->data[0]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[0]); STRCMP_EQUAL(item_abc, (const char *)arraylist->data[1]); STRCMP_EQUAL(item_Def, (const char *)arraylist->data[2]); STRCMP_EQUAL(item_xxx, (const char *)arraylist->data[3]); STRCMP_EQUAL(item_zzz, (const char *)arraylist->data[4]); for (i = 5; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } } @@ -211,26 +211,26 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) { STRCMP_EQUAL(item_zzz, (const char *)arraylist->data[0]); STRCMP_EQUAL(item_xxx, (const char *)arraylist->data[1]); - POINTERS_EQUAL(NULL, arraylist->data[2]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[2]); STRCMP_EQUAL(item_DEF, (const char *)arraylist->data[3]); STRCMP_EQUAL(item_def, (const char *)arraylist->data[4]); STRCMP_EQUAL(item_Def, (const char *)arraylist->data[5]); STRCMP_EQUAL(item_abc, (const char *)arraylist->data[6]); for (i = 7; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } else { STRCMP_EQUAL(item_zzz, (const char *)arraylist->data[0]); STRCMP_EQUAL(item_xxx, (const char *)arraylist->data[1]); - POINTERS_EQUAL(NULL, arraylist->data[2]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[2]); STRCMP_EQUAL(item_Def, (const char *)arraylist->data[3]); STRCMP_EQUAL(item_abc, (const char *)arraylist->data[4]); for (i = 5; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } } @@ -329,7 +329,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) STRCMP_EQUAL(item_zzz, (const char *)arraylist->data[3]); for (i = 4; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } else @@ -338,7 +338,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) STRCMP_EQUAL(item_zzz, (const char *)arraylist->data[1]); for (i = 2; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } } @@ -352,7 +352,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) STRCMP_EQUAL(item_abc, (const char *)arraylist->data[3]); for (i = 4; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } else @@ -361,7 +361,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) STRCMP_EQUAL(item_abc, (const char *)arraylist->data[1]); for (i = 2; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } } @@ -399,7 +399,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) STRCMP_EQUAL(item_zzz, (const char *)arraylist->data[4]); for (i = 5; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } else @@ -409,7 +409,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) STRCMP_EQUAL(item_zzz, (const char *)arraylist->data[2]); for (i = 3; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } } @@ -424,7 +424,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) STRCMP_EQUAL(item_abc, (const char *)arraylist->data[4]); for (i = 5; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } else @@ -434,7 +434,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) STRCMP_EQUAL(item_abc, (const char *)arraylist->data[2]); for (i = 3; i < arraylist->size_alloc; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } } @@ -452,7 +452,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) CHECK(arraylist->data); for (i = 0; i < initial_size; i++) { - POINTERS_EQUAL(NULL, arraylist->data[i]); + STRCMP_EQUAL(NULL, (const char *)arraylist->data[i]); } } else diff --git a/tests/unit/core/test-core-config-file.cpp b/tests/unit/core/test-core-config-file.cpp index ecda87467..d78b5912d 100644 --- a/tests/unit/core/test-core-config-file.cpp +++ b/tests/unit/core/test-core-config-file.cpp @@ -346,7 +346,7 @@ TEST(CoreConfigFile, OptionFullName) { char *str; - POINTERS_EQUAL(NULL, config_file_option_full_name (NULL)); + STRCMP_EQUAL(NULL, config_file_option_full_name (NULL)); WEE_TEST_STR("weechat.look.buffer_time_format", config_file_option_full_name (config_look_buffer_time_format)); @@ -1283,8 +1283,8 @@ TEST(CoreConfigFileWithNewOptions, OptionIntegerInherited) TEST(CoreConfigFileWithNewOptions, OptionString) { - POINTERS_EQUAL(0, config_file_option_string (NULL)); - POINTERS_EQUAL(0, config_file_option_string_default (NULL)); + STRCMP_EQUAL(NULL, config_file_option_string (NULL)); + STRCMP_EQUAL(NULL, config_file_option_string_default (NULL)); STRCMP_EQUAL("v2", config_file_option_string (ptr_option_int_str)); STRCMP_EQUAL("v2", config_file_option_string_default (ptr_option_int_str)); @@ -1308,8 +1308,8 @@ TEST(CoreConfigFileWithNewOptions, OptionString) STRCMP_EQUAL("off", config_file_option_string (ptr_option_bool)); STRCMP_EQUAL("off", config_file_option_string_default (ptr_option_bool)); - POINTERS_EQUAL(NULL, config_file_option_string (ptr_option_int)); - POINTERS_EQUAL(NULL, config_file_option_string_default (ptr_option_int)); + STRCMP_EQUAL(NULL, config_file_option_string (ptr_option_int)); + STRCMP_EQUAL(NULL, config_file_option_string_default (ptr_option_int)); STRCMP_EQUAL("v2", config_file_option_string (ptr_option_int_str)); STRCMP_EQUAL("v2", config_file_option_string_default (ptr_option_int_str)); STRCMP_EQUAL("blue", config_file_option_string (ptr_option_col)); @@ -1325,7 +1325,7 @@ TEST(CoreConfigFileWithNewOptions, OptionString) TEST(CoreConfigFileWithNewOptions, OptionStringInherited) { - POINTERS_EQUAL(NULL, config_file_option_string_inherited (NULL)); + STRCMP_EQUAL(NULL, config_file_option_string_inherited (NULL)); STRCMP_EQUAL("v2", config_file_option_string_inherited (ptr_option_int_str_child)); config_file_option_set (ptr_option_int_str, "v3", 1); @@ -1348,8 +1348,8 @@ TEST(CoreConfigFileWithNewOptions, OptionStringInherited) TEST(CoreConfigFileWithNewOptions, OptionColor) { - POINTERS_EQUAL(0, config_file_option_color (NULL)); - POINTERS_EQUAL(0, config_file_option_color_default (NULL)); + STRCMP_EQUAL(NULL, config_file_option_color (NULL)); + STRCMP_EQUAL(NULL, config_file_option_color_default (NULL)); STRCMP_EQUAL("blue", config_file_option_color (ptr_option_col)); STRCMP_EQUAL("blue", config_file_option_color_default (ptr_option_col)); @@ -1361,16 +1361,16 @@ TEST(CoreConfigFileWithNewOptions, OptionColor) STRCMP_EQUAL("blue", config_file_option_color (ptr_option_col)); STRCMP_EQUAL("blue", config_file_option_color_default (ptr_option_col)); - POINTERS_EQUAL(NULL, config_file_option_color (ptr_option_bool)); - POINTERS_EQUAL(NULL, config_file_option_color_default (ptr_option_bool)); - POINTERS_EQUAL(NULL, config_file_option_color (ptr_option_int)); - POINTERS_EQUAL(NULL, config_file_option_color_default (ptr_option_int)); - POINTERS_EQUAL(NULL, config_file_option_color (ptr_option_int_str)); - POINTERS_EQUAL(NULL, config_file_option_color_default (ptr_option_int_str)); - POINTERS_EQUAL(NULL, config_file_option_color (ptr_option_str)); - POINTERS_EQUAL(NULL, config_file_option_color_default (ptr_option_str)); - POINTERS_EQUAL(NULL, config_file_option_color (ptr_option_enum)); - POINTERS_EQUAL(NULL, config_file_option_color_default (ptr_option_enum)); + STRCMP_EQUAL(NULL, config_file_option_color (ptr_option_bool)); + STRCMP_EQUAL(NULL, config_file_option_color_default (ptr_option_bool)); + STRCMP_EQUAL(NULL, config_file_option_color (ptr_option_int)); + STRCMP_EQUAL(NULL, config_file_option_color_default (ptr_option_int)); + STRCMP_EQUAL(NULL, config_file_option_color (ptr_option_int_str)); + STRCMP_EQUAL(NULL, config_file_option_color_default (ptr_option_int_str)); + STRCMP_EQUAL(NULL, config_file_option_color (ptr_option_str)); + STRCMP_EQUAL(NULL, config_file_option_color_default (ptr_option_str)); + STRCMP_EQUAL(NULL, config_file_option_color (ptr_option_enum)); + STRCMP_EQUAL(NULL, config_file_option_color_default (ptr_option_enum)); } /* @@ -1380,7 +1380,7 @@ TEST(CoreConfigFileWithNewOptions, OptionColor) TEST(CoreConfigFileWithNewOptions, OptionColorInherited) { - POINTERS_EQUAL(NULL, config_file_option_color_inherited (NULL)); + STRCMP_EQUAL(NULL, config_file_option_color_inherited (NULL)); STRCMP_EQUAL("blue", config_file_option_color_inherited (ptr_option_col_child)); config_file_option_set (ptr_option_col, "red", 1); diff --git a/tests/unit/core/test-core-crypto.cpp b/tests/unit/core/test-core-crypto.cpp index 9871cc6a1..51123b409 100644 --- a/tests/unit/core/test-core-crypto.cpp +++ b/tests/unit/core/test-core-crypto.cpp @@ -208,16 +208,8 @@ extern "C" #define WEE_CHECK_TOTP_GENERATE(__result, __secret, __time, __digits) \ totp = weecrypto_totp_generate (__secret, __time, __digits); \ - if (__result == NULL) \ - { \ - POINTERS_EQUAL(NULL, totp); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result, totp); \ - } \ - if (totp) \ - free (totp); + STRCMP_EQUAL(__result, totp); \ + free (totp); #define WEE_CHECK_TOTP_VALIDATE(__result, __secret, __time, __window, \ __otp) \ diff --git a/tests/unit/core/test-core-eval.cpp b/tests/unit/core/test-core-eval.cpp index 200244498..829ac6fb7 100644 --- a/tests/unit/core/test-core-eval.cpp +++ b/tests/unit/core/test-core-eval.cpp @@ -98,7 +98,7 @@ TEST(CoreEval, EvalCondition) CHECK(options); hashtable_set (options, "type", "condition"); - POINTERS_EQUAL(NULL, eval_expression (NULL, NULL, NULL, options)); + STRCMP_EQUAL(NULL, eval_expression (NULL, NULL, NULL, options)); /* conditions evaluated as false */ WEE_CHECK_EVAL("0", ""); @@ -482,7 +482,7 @@ TEST(CoreEval, EvalExpression) NULL, NULL); CHECK(options); - POINTERS_EQUAL(NULL, eval_expression (NULL, NULL, NULL, NULL)); + STRCMP_EQUAL(NULL, eval_expression (NULL, NULL, NULL, NULL)); /* test with simple strings */ WEE_CHECK_EVAL("", ""); diff --git a/tests/unit/core/test-core-hashtable.cpp b/tests/unit/core/test-core-hashtable.cpp index f44df41e2..0957f3bb3 100644 --- a/tests/unit/core/test-core-hashtable.cpp +++ b/tests/unit/core/test-core-hashtable.cpp @@ -531,7 +531,7 @@ TEST(CoreHashtable, SetGetRemove) value_time = 1718036808; hashtable_set (hashtable, &value_time, "test_1718036808"); value_time = 1; - POINTERS_EQUAL(NULL, (const char *)hashtable_get (hashtable, &value_time)); + STRCMP_EQUAL(NULL, (const char *)hashtable_get (hashtable, &value_time)); value_time = 0; STRCMP_EQUAL("test_0", (const char *)hashtable_get (hashtable, &value_time)); value_time = 1718036808; @@ -549,7 +549,7 @@ TEST(CoreHashtable, SetGetRemove) value_longlong = 123; hashtable_set (hashtable, &value_longlong, "test_123"); value_longlong = 0; - POINTERS_EQUAL(NULL, (const char *)hashtable_get (hashtable, &value_longlong)); + STRCMP_EQUAL(NULL, (const char *)hashtable_get (hashtable, &value_longlong)); value_longlong = -1; STRCMP_EQUAL("test_-1", (const char *)hashtable_get (hashtable, &value_longlong)); value_longlong = 123; @@ -729,10 +729,10 @@ TEST(CoreHashtable, GetString) hashtable = get_weechat_hashtable (); - POINTERS_EQUAL(NULL, hashtable_get_string (NULL, NULL)); - POINTERS_EQUAL(NULL, hashtable_get_string (hashtable, NULL)); - POINTERS_EQUAL(NULL, hashtable_get_string (hashtable, "")); - POINTERS_EQUAL(NULL, hashtable_get_string (hashtable, "unknown")); + STRCMP_EQUAL(NULL, hashtable_get_string (NULL, NULL)); + STRCMP_EQUAL(NULL, hashtable_get_string (hashtable, NULL)); + STRCMP_EQUAL(NULL, hashtable_get_string (hashtable, "")); + STRCMP_EQUAL(NULL, hashtable_get_string (hashtable, "unknown")); STRCMP_EQUAL("string", hashtable_get_string (hashtable, "type_keys")); STRCMP_EQUAL("string", hashtable_get_string (hashtable, "type_values")); diff --git a/tests/unit/core/test-core-hdata.cpp b/tests/unit/core/test-core-hdata.cpp index 597f50748..2004fe1ed 100644 --- a/tests/unit/core/test-core-hdata.cpp +++ b/tests/unit/core/test-core-hdata.cpp @@ -892,10 +892,10 @@ TEST(CoreHdataWithList, GetVarType) TEST(CoreHdataWithList, GetVarTypeString) { - POINTERS_EQUAL(NULL, hdata_get_var_type_string (NULL, NULL)); - POINTERS_EQUAL(NULL, hdata_get_var_type_string (ptr_hdata, NULL)); - POINTERS_EQUAL(NULL, hdata_get_var_type_string (NULL, "test_char")); - POINTERS_EQUAL(NULL, hdata_get_var_type_string (ptr_hdata, "zzz")); + STRCMP_EQUAL(NULL, hdata_get_var_type_string (NULL, NULL)); + STRCMP_EQUAL(NULL, hdata_get_var_type_string (ptr_hdata, NULL)); + STRCMP_EQUAL(NULL, hdata_get_var_type_string (NULL, "test_char")); + STRCMP_EQUAL(NULL, hdata_get_var_type_string (ptr_hdata, "zzz")); STRCMP_EQUAL("char", hdata_get_var_type_string (ptr_hdata, "test_char")); @@ -1047,20 +1047,14 @@ TEST(CoreHdataWithList, GetVarArraySize) TEST(CoreHdataWithList, GetVarArraySizeString) { - POINTERS_EQUAL(NULL, hdata_get_var_array_size_string (NULL, NULL, - NULL)); - POINTERS_EQUAL(NULL, hdata_get_var_array_size_string (ptr_hdata, NULL, - NULL)); - POINTERS_EQUAL(NULL, hdata_get_var_array_size_string (NULL, NULL, - "test_char")); - POINTERS_EQUAL(NULL, hdata_get_var_array_size_string (ptr_hdata, NULL, - "zzz")); - POINTERS_EQUAL(NULL, hdata_get_var_array_size_string (ptr_hdata, ptr_item1, - "zzz")); + STRCMP_EQUAL(NULL, hdata_get_var_array_size_string (NULL, NULL, NULL)); + STRCMP_EQUAL(NULL, hdata_get_var_array_size_string (ptr_hdata, NULL, NULL)); + STRCMP_EQUAL(NULL, hdata_get_var_array_size_string (NULL, NULL, "test_char")); + STRCMP_EQUAL(NULL, hdata_get_var_array_size_string (ptr_hdata, NULL, "zzz")); + STRCMP_EQUAL(NULL, hdata_get_var_array_size_string (ptr_hdata, ptr_item1, "zzz")); /* not an array */ - POINTERS_EQUAL(NULL, hdata_get_var_array_size_string (ptr_hdata, ptr_item1, - "test_char")); + STRCMP_EQUAL(NULL, hdata_get_var_array_size_string (ptr_hdata, ptr_item1, "test_char")); /* item 1 */ STRCMP_EQUAL("2", @@ -1210,13 +1204,13 @@ TEST(CoreHdataWithList, GetVarArraySizeString) TEST(CoreHdataWithList, GetVarHdata) { - POINTERS_EQUAL(NULL, hdata_get_var_hdata (NULL, NULL)); - POINTERS_EQUAL(NULL, hdata_get_var_hdata (ptr_hdata, NULL)); - POINTERS_EQUAL(NULL, hdata_get_var_hdata (NULL, "test_char")); - POINTERS_EQUAL(NULL, hdata_get_var_hdata (ptr_hdata, "zzz")); + STRCMP_EQUAL(NULL, hdata_get_var_hdata (NULL, NULL)); + STRCMP_EQUAL(NULL, hdata_get_var_hdata (ptr_hdata, NULL)); + STRCMP_EQUAL(NULL, hdata_get_var_hdata (NULL, "test_char")); + STRCMP_EQUAL(NULL, hdata_get_var_hdata (ptr_hdata, "zzz")); /* no reference to hdata */ - POINTERS_EQUAL(NULL, hdata_get_var_hdata (ptr_hdata, "test_char")); + STRCMP_EQUAL(NULL, hdata_get_var_hdata (ptr_hdata, "test_char")); /* check prev/next item variables */ STRCMP_EQUAL("test_item", hdata_get_var_hdata (ptr_hdata, "prev_item")); @@ -1761,7 +1755,7 @@ TEST(CoreHdataWithList, GetIndexAndName) ptr_name = (const char *)0x1; hdata_get_index_and_name (NULL, &index, &ptr_name); LONGS_EQUAL(-1, index); - POINTERS_EQUAL(NULL, ptr_name); + STRCMP_EQUAL(NULL, ptr_name); index = -999; ptr_name = (const char *)0x1; @@ -1957,17 +1951,17 @@ TEST(CoreHdataWithList, LongLong) TEST(CoreHdataWithList, String) { - POINTERS_EQUAL(NULL, hdata_string (NULL, NULL, NULL)); - POINTERS_EQUAL(NULL, hdata_string (ptr_hdata, NULL, NULL)); - POINTERS_EQUAL(NULL, hdata_string (NULL, ptr_item1, NULL)); - POINTERS_EQUAL(NULL, hdata_string (NULL, NULL, "test_string")); - POINTERS_EQUAL(NULL, hdata_string (ptr_hdata, ptr_item1, NULL)); - POINTERS_EQUAL(NULL, hdata_string (ptr_hdata, NULL, "test_string")); - POINTERS_EQUAL(NULL, hdata_string (NULL, ptr_item1, "test_string")); + STRCMP_EQUAL(NULL, hdata_string (NULL, NULL, NULL)); + STRCMP_EQUAL(NULL, hdata_string (ptr_hdata, NULL, NULL)); + STRCMP_EQUAL(NULL, hdata_string (NULL, ptr_item1, NULL)); + STRCMP_EQUAL(NULL, hdata_string (NULL, NULL, "test_string")); + STRCMP_EQUAL(NULL, hdata_string (ptr_hdata, ptr_item1, NULL)); + STRCMP_EQUAL(NULL, hdata_string (ptr_hdata, NULL, "test_string")); + STRCMP_EQUAL(NULL, hdata_string (NULL, ptr_item1, "test_string")); /* variable not found */ - POINTERS_EQUAL(NULL, hdata_string (ptr_hdata, ptr_item1, "zzz")); - POINTERS_EQUAL(NULL, hdata_string (ptr_hdata, ptr_item1, "1|zzz")); + STRCMP_EQUAL(NULL, hdata_string (ptr_hdata, ptr_item1, "zzz")); + STRCMP_EQUAL(NULL, hdata_string (ptr_hdata, ptr_item1, "1|zzz")); /* item 1 */ STRCMP_EQUAL("item1", hdata_string (ptr_hdata, ptr_item1, "test_string")); @@ -2456,7 +2450,7 @@ TEST(CoreHdataWithList, Update) hashtable_remove_all (hashtable); hashtable_set (hashtable, "test_string", NULL); LONGS_EQUAL(1, hdata_update (ptr_hdata, ptr_item1, hashtable)); - POINTERS_EQUAL(NULL, ptr_item1->test_string); + STRCMP_EQUAL(NULL, ptr_item1->test_string); /* set string to empty string */ hashtable_remove_all (hashtable); @@ -2474,7 +2468,7 @@ TEST(CoreHdataWithList, Update) hashtable_remove_all (hashtable); hashtable_set (hashtable, "test_shared_string", NULL); LONGS_EQUAL(1, hdata_update (ptr_hdata, ptr_item1, hashtable)); - POINTERS_EQUAL(NULL, ptr_item1->test_shared_string); + STRCMP_EQUAL(NULL, ptr_item1->test_shared_string); /* set shared string to empty string */ hashtable_remove_all (hashtable); @@ -2610,11 +2604,11 @@ TEST(CoreHdataWithList, GetString) char **items; int num_items; - POINTERS_EQUAL(NULL, hdata_get_string (NULL, NULL)); - POINTERS_EQUAL(NULL, hdata_get_string (ptr_hdata, NULL)); - POINTERS_EQUAL(NULL, hdata_get_string (NULL, "var_keys")); + STRCMP_EQUAL(NULL, hdata_get_string (NULL, NULL)); + STRCMP_EQUAL(NULL, hdata_get_string (ptr_hdata, NULL)); + STRCMP_EQUAL(NULL, hdata_get_string (NULL, "var_keys")); - POINTERS_EQUAL(NULL, hdata_get_string (ptr_hdata, "zzz")); + STRCMP_EQUAL(NULL, hdata_get_string (ptr_hdata, "zzz")); STRCMP_EQUAL( "test_char,test_count_char,test_array_2_char_fixed_size," diff --git a/tests/unit/core/test-core-infolist.cpp b/tests/unit/core/test-core-infolist.cpp index 8347dff9f..cdcbf637b 100644 --- a/tests/unit/core/test-core-infolist.cpp +++ b/tests/unit/core/test-core-infolist.cpp @@ -140,7 +140,7 @@ TEST(CoreInfolist, New) /* check initial item values */ POINTERS_EQUAL(NULL, item->vars); POINTERS_EQUAL(NULL, item->last_var); - POINTERS_EQUAL(NULL, item->fields); + STRCMP_EQUAL(NULL, item->fields); POINTERS_EQUAL(NULL, item->prev_item); POINTERS_EQUAL(NULL, item->next_item); diff --git a/tests/unit/core/test-core-list.cpp b/tests/unit/core/test-core-list.cpp index 69c79c557..13b01dda8 100644 --- a/tests/unit/core/test-core-list.cpp +++ b/tests/unit/core/test-core-list.cpp @@ -273,7 +273,7 @@ TEST(CoreList, Get) /* get string value of an element */ - POINTERS_EQUAL(NULL, weelist_string (NULL)); + STRCMP_EQUAL(NULL, weelist_string (NULL)); ptr_item = weelist_get(list, 0); STRCMP_EQUAL(LIST_VALUE_TEST, weelist_string (ptr_item)); diff --git a/tests/unit/core/test-core-string.cpp b/tests/unit/core/test-core-string.cpp index 73d9cd639..25cda6c62 100644 --- a/tests/unit/core/test-core-string.cpp +++ b/tests/unit/core/test-core-string.cpp @@ -70,15 +70,8 @@ extern "C" REG_EXTENDED | REG_ICASE)); \ result = string_replace_regex (__str, ®ex, __replace, \ __ref_char, __callback, NULL); \ - if (__result_replace == NULL) \ - { \ - POINTERS_EQUAL(NULL, result); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result_replace, result); \ - free (result); \ - } \ + STRCMP_EQUAL(__result_replace, result); \ + free (result); \ if (__result_regex == 0) \ regfree(®ex); @@ -91,15 +84,8 @@ extern "C" __str, __prefix, __suffix, __allow_escape, \ __list_prefix_no_replace, __callback, __callback_data, \ __errors); \ - if (__result_replace == NULL) \ - { \ - POINTERS_EQUAL(NULL, result); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result_replace, result); \ - free (result); \ - } \ + STRCMP_EQUAL(__result_replace, result); \ + free (result); \ if (__result_errors >= 0) \ { \ LONGS_EQUAL(__result_errors, errors); \ @@ -142,7 +128,7 @@ TEST(CoreString, Asprintf) test = (char *)0x1; LONGS_EQUAL(-1, string_asprintf (&test, NULL)); - POINTERS_EQUAL(NULL, test); + STRCMP_EQUAL(NULL, test); test = (char *)0x1; LONGS_EQUAL(0, string_asprintf (&test, "")); @@ -170,9 +156,9 @@ TEST(CoreString, Strndup) const char *str_test = "test"; char *str; - POINTERS_EQUAL(NULL, string_strndup (NULL, 0)); + STRCMP_EQUAL(NULL, string_strndup (NULL, 0)); - POINTERS_EQUAL(NULL, string_strndup (str_test, -1)); + STRCMP_EQUAL(NULL, string_strndup (str_test, -1)); str = string_strndup (str_test, 0); CHECK(str); @@ -304,7 +290,7 @@ TEST(CoreString, Cut) { char suffix[128], string[128]; - POINTERS_EQUAL(NULL, string_cut (NULL, 0, 0, 0, NULL)); + STRCMP_EQUAL(NULL, string_cut (NULL, 0, 0, 0, NULL)); STRCMP_EQUAL("", string_cut ("", 0, 0, 0, NULL)); /* cut with length == 0 */ @@ -429,7 +415,7 @@ TEST(CoreString, Reverse) { char string[128]; - POINTERS_EQUAL(NULL, string_reverse (NULL)); + STRCMP_EQUAL(NULL, string_reverse (NULL)); STRCMP_EQUAL("", string_reverse ("")); /* reverse of UTF-8 string */ @@ -471,7 +457,7 @@ TEST(CoreString, ReverseScreen) { char string[128], result[128]; - POINTERS_EQUAL(NULL, string_reverse_screen (NULL)); + STRCMP_EQUAL(NULL, string_reverse_screen (NULL)); STRCMP_EQUAL("", string_reverse_screen ("")); /* reverse of UTF-8 string */ @@ -520,8 +506,8 @@ TEST(CoreString, ReverseScreen) TEST(CoreString, Repeat) { - POINTERS_EQUAL(NULL, string_repeat (NULL, 1)); - POINTERS_EQUAL(NULL, string_repeat ("----", INT_MAX / 4)); + STRCMP_EQUAL(NULL, string_repeat (NULL, 1)); + STRCMP_EQUAL(NULL, string_repeat ("----", INT_MAX / 4)); STRCMP_EQUAL("", string_repeat ("", 1)); @@ -822,13 +808,13 @@ TEST(CoreString, Search) const char *str = "test"; /* case-insensitive search of string in a string */ - POINTERS_EQUAL(NULL, string_strcasestr (NULL, NULL)); - POINTERS_EQUAL(NULL, string_strcasestr (NULL, str)); - POINTERS_EQUAL(NULL, string_strcasestr (str, NULL)); - POINTERS_EQUAL(NULL, string_strcasestr (str, "")); - POINTERS_EQUAL(NULL, string_strcasestr (str, "zz")); - POINTERS_EQUAL(str + 1, string_strcasestr (str, "est")); - POINTERS_EQUAL(str + 1, string_strcasestr (str, "EST")); + STRCMP_EQUAL(NULL, string_strcasestr (NULL, NULL)); + STRCMP_EQUAL(NULL, string_strcasestr (NULL, str)); + STRCMP_EQUAL(NULL, string_strcasestr (str, NULL)); + STRCMP_EQUAL(NULL, string_strcasestr (str, "")); + STRCMP_EQUAL(NULL, string_strcasestr (str, "zz")); + STRCMP_EQUAL(str + 1, string_strcasestr (str, "est")); + STRCMP_EQUAL(str + 1, string_strcasestr (str, "EST")); } /* @@ -972,7 +958,7 @@ TEST(CoreString, ExpandHome) CHECK(home); length_home = strlen (home); - POINTERS_EQUAL(NULL, string_expand_home (NULL)); + STRCMP_EQUAL(NULL, string_expand_home (NULL)); result = string_expand_home ("~/abc.txt"); CHECK(strncmp (result, home, length_home) == 0); @@ -1004,7 +990,7 @@ TEST(CoreString, EvalPathHome) length_weechat_cache_dir = strlen (weechat_cache_dir); length_weechat_runtime_dir = strlen (weechat_runtime_dir); - POINTERS_EQUAL(NULL, string_eval_path_home (NULL, NULL, NULL, NULL)); + STRCMP_EQUAL(NULL, string_eval_path_home (NULL, NULL, NULL, NULL)); result = string_eval_path_home ("/tmp/test", NULL, NULL, NULL); STRCMP_EQUAL(result, "/tmp/test"); @@ -1473,9 +1459,9 @@ TEST(CoreString, TranslateChars) { char *str; - POINTERS_EQUAL(NULL, string_translate_chars (NULL, NULL, NULL)); - POINTERS_EQUAL(NULL, string_translate_chars (NULL, "abc", NULL)); - POINTERS_EQUAL(NULL, string_translate_chars (NULL, "abc", "ABC")); + STRCMP_EQUAL(NULL, string_translate_chars (NULL, NULL, NULL)); + STRCMP_EQUAL(NULL, string_translate_chars (NULL, "abc", NULL)); + STRCMP_EQUAL(NULL, string_translate_chars (NULL, "abc", "ABC")); STRCMP_EQUAL("", string_translate_chars ("", "abc", "ABCDEF")); STRCMP_EQUAL("test", string_translate_chars ("test", "abc", "ABCDEF")); WEE_TEST_STR("", string_translate_chars ("", "abc", "ABC")); @@ -1619,7 +1605,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("de", argv[1]); STRCMP_EQUAL("fghi", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* standard split */ @@ -1633,7 +1619,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("de", argv[1]); STRCMP_EQUAL("fghi", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* max 2 items */ @@ -1646,7 +1632,7 @@ TEST(CoreString, Split) CHECK(argv); STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("de", argv[1]); - POINTERS_EQUAL(NULL, argv[2]); + STRCMP_EQUAL(NULL, argv[2]); string_free_split (argv); /* strip left/right, keep eol for each value */ @@ -1661,7 +1647,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("abc de fghi", argv[0]); STRCMP_EQUAL("de fghi", argv[1]); STRCMP_EQUAL("fghi", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* strip left/right, keep eol for each value, max 2 items */ @@ -1675,7 +1661,7 @@ TEST(CoreString, Split) CHECK(argv); STRCMP_EQUAL("abc de fghi", argv[0]); STRCMP_EQUAL("de fghi", argv[1]); - POINTERS_EQUAL(NULL, argv[2]); + STRCMP_EQUAL(NULL, argv[2]); string_free_split (argv); /* strip left, keep eol for each value */ @@ -1689,7 +1675,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("abc de fghi ", argv[0]); STRCMP_EQUAL("de fghi ", argv[1]); STRCMP_EQUAL("fghi ", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* strip left, keep eol for each value, max 2 items */ @@ -1702,7 +1688,7 @@ TEST(CoreString, Split) CHECK(argv); STRCMP_EQUAL("abc de fghi ", argv[0]); STRCMP_EQUAL("de fghi ", argv[1]); - POINTERS_EQUAL(NULL, argv[2]); + STRCMP_EQUAL(NULL, argv[2]); string_free_split (argv); /* standard split with comma separator */ @@ -1716,7 +1702,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("de", argv[1]); STRCMP_EQUAL("fghi", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* @@ -1733,7 +1719,7 @@ TEST(CoreString, Split) STRCMP_EQUAL(" abc ", argv[0]); STRCMP_EQUAL(" de ", argv[1]); STRCMP_EQUAL("fghi ", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* @@ -1750,7 +1736,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("de", argv[1]); STRCMP_EQUAL("fghi", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* @@ -1768,7 +1754,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("de", argv[1]); STRCMP_EQUAL("f(g)hi", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* standard split with comma separator and empty item (ignore this item) */ @@ -1781,7 +1767,7 @@ TEST(CoreString, Split) CHECK(argv); STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("fghi", argv[1]); - POINTERS_EQUAL(NULL, argv[2]); + STRCMP_EQUAL(NULL, argv[2]); string_free_split (argv); /* standard split with comma separtor and empty item (keep this item) */ @@ -1793,7 +1779,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("", argv[1]); STRCMP_EQUAL("fghi", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* standard split with comma separtor and empty items (keep them) */ @@ -1807,7 +1793,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("", argv[2]); STRCMP_EQUAL("fghi", argv[3]); STRCMP_EQUAL("", argv[4]); - POINTERS_EQUAL(NULL, argv[5]); + STRCMP_EQUAL(NULL, argv[5]); string_free_split (argv); /* @@ -1821,7 +1807,7 @@ TEST(CoreString, Split) CHECK(argv); STRCMP_EQUAL("", argv[0]); STRCMP_EQUAL("abc", argv[1]); - POINTERS_EQUAL(NULL, argv[2]); + STRCMP_EQUAL(NULL, argv[2]); string_free_split (argv); /* @@ -1836,7 +1822,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("", argv[0]); STRCMP_EQUAL("abc", argv[1]); STRCMP_EQUAL("", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* @@ -1852,7 +1838,7 @@ TEST(CoreString, Split) STRCMP_EQUAL("abc", argv[1]); STRCMP_EQUAL("", argv[2]); STRCMP_EQUAL("fghi", argv[3]); - POINTERS_EQUAL(NULL, argv[4]); + STRCMP_EQUAL(NULL, argv[4]); string_free_split (argv); } @@ -1889,7 +1875,7 @@ TEST(CoreString, SplitShared) STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("de", argv[1]); STRCMP_EQUAL("abc", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); /* same content == same pointer for shared strings */ POINTERS_EQUAL(argv[0], argv[2]); @@ -1918,7 +1904,7 @@ TEST(CoreString, SplitShell) argv = string_split_shell ("", &argc); LONGS_EQUAL(0, argc); CHECK(argv); - POINTERS_EQUAL(NULL, argv[0]); + STRCMP_EQUAL(NULL, argv[0]); string_free_split (argv); /* test with a real string (command + arguments) */ @@ -1930,7 +1916,7 @@ TEST(CoreString, SplitShell) STRCMP_EQUAL("arg1", argv[1]); STRCMP_EQUAL("arg2 here", argv[2]); STRCMP_EQUAL("arg3 here", argv[3]); - POINTERS_EQUAL(NULL, argv[4]); + STRCMP_EQUAL(NULL, argv[4]); string_free_split (argv); /* test with quote characters inside words: they are stripped */ @@ -1938,7 +1924,7 @@ TEST(CoreString, SplitShell) LONGS_EQUAL(1, argc); CHECK(argv); STRCMP_EQUAL("testsingleword", argv[0]); - POINTERS_EQUAL(NULL, argv[1]); + STRCMP_EQUAL(NULL, argv[1]); string_free_split (argv); /* test with enclosing characters in quotes */ @@ -1947,7 +1933,7 @@ TEST(CoreString, SplitShell) CHECK(argv); STRCMP_EQUAL("test", argv[0]); STRCMP_EQUAL("'", argv[1]); - POINTERS_EQUAL(NULL, argv[2]); + STRCMP_EQUAL(NULL, argv[2]); string_free_split (argv); /* test with quoted empty strings */ @@ -1957,7 +1943,7 @@ TEST(CoreString, SplitShell) STRCMP_EQUAL("test", argv[0]); STRCMP_EQUAL("", argv[1]); STRCMP_EQUAL("", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* test with many quotes */ @@ -1967,7 +1953,7 @@ TEST(CoreString, SplitShell) STRCMP_EQUAL("test", argv[0]); STRCMP_EQUAL("", argv[1]); STRCMP_EQUAL("", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split (argv); /* test with escaped chars in and outside quotes */ @@ -1978,7 +1964,7 @@ TEST(CoreString, SplitShell) STRCMP_EQUAL("n", argv[1]); STRCMP_EQUAL("\\n", argv[2]); STRCMP_EQUAL("\\n", argv[3]); - POINTERS_EQUAL(NULL, argv[4]); + STRCMP_EQUAL(NULL, argv[4]); string_free_split (argv); /* test with escaped quotes */ @@ -1989,7 +1975,7 @@ TEST(CoreString, SplitShell) STRCMP_EQUAL("\"", argv[1]); STRCMP_EQUAL("4", argv[2]); STRCMP_EQUAL("arguments\"", argv[3]); - POINTERS_EQUAL(NULL, argv[4]); + STRCMP_EQUAL(NULL, argv[4]); string_free_split (argv); /* free split with NULL */ @@ -2014,7 +2000,7 @@ TEST(CoreString, SplitCommand) argv = string_split_command ("abc", ';'); CHECK(argv); STRCMP_EQUAL("abc", argv[0]); - POINTERS_EQUAL(NULL, argv[1]); + STRCMP_EQUAL(NULL, argv[1]); string_free_split_command (argv); /* string with 3 commands */ @@ -2023,7 +2009,7 @@ TEST(CoreString, SplitCommand) STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("de", argv[1]); STRCMP_EQUAL("fghi", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split_command (argv); /* string with 3 commands (containing spaces) */ @@ -2032,7 +2018,7 @@ TEST(CoreString, SplitCommand) STRCMP_EQUAL("abc ", argv[0]); STRCMP_EQUAL("de ", argv[1]); STRCMP_EQUAL("fghi ", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split_command (argv); /* separator other than ';' */ @@ -2041,7 +2027,7 @@ TEST(CoreString, SplitCommand) STRCMP_EQUAL("abc", argv[0]); STRCMP_EQUAL("de", argv[1]); STRCMP_EQUAL("fghi", argv[2]); - POINTERS_EQUAL(NULL, argv[3]); + STRCMP_EQUAL(NULL, argv[3]); string_free_split_command (argv); /* free split with NULL */ @@ -2075,7 +2061,7 @@ TEST(CoreString, SplitTags) CHECK(tags); LONGS_EQUAL(1, num_tags); STRCMP_EQUAL("irc_join", tags[0][0]); - POINTERS_EQUAL(NULL, tags[0][1]); + STRCMP_EQUAL(NULL, tags[0][1]); string_free_split_tags (tags); /* string with OR on 2 tags */ @@ -2084,9 +2070,9 @@ TEST(CoreString, SplitTags) CHECK(tags); LONGS_EQUAL(2, num_tags); STRCMP_EQUAL("irc_join", tags[0][0]); - POINTERS_EQUAL(NULL, tags[0][1]); + STRCMP_EQUAL(NULL, tags[0][1]); STRCMP_EQUAL("irc_quit", tags[1][0]); - POINTERS_EQUAL(NULL, tags[1][1]); + STRCMP_EQUAL(NULL, tags[1][1]); string_free_split_tags (tags); /* @@ -2099,10 +2085,10 @@ TEST(CoreString, SplitTags) CHECK(tags); LONGS_EQUAL(2, num_tags); STRCMP_EQUAL("irc_join", tags[0][0]); - POINTERS_EQUAL(NULL, tags[0][1]); + STRCMP_EQUAL(NULL, tags[0][1]); STRCMP_EQUAL("irc_quit", tags[1][0]); STRCMP_EQUAL("nick_test", tags[1][1]); - POINTERS_EQUAL(NULL, tags[1][2]); + STRCMP_EQUAL(NULL, tags[1][2]); string_free_split_tags (tags); /* free split with NULL */ @@ -2120,7 +2106,7 @@ TEST(CoreString, RebuildSplitString) int argc, flags; str = string_rebuild_split_string (NULL, NULL, 0, -1); - POINTERS_EQUAL(NULL, str); + STRCMP_EQUAL(NULL, str); flags = WEECHAT_STRING_SPLIT_STRIP_LEFT | WEECHAT_STRING_SPLIT_STRIP_RIGHT @@ -2130,9 +2116,9 @@ TEST(CoreString, RebuildSplitString) /* invalid index_end, which is < index_start */ str = string_rebuild_split_string ((const char **)argv, NULL, 1, 0); - POINTERS_EQUAL(NULL, str); + STRCMP_EQUAL(NULL, str); str = string_rebuild_split_string ((const char **)argv, NULL, 2, 1); - POINTERS_EQUAL(NULL, str); + STRCMP_EQUAL(NULL, str); str = string_rebuild_split_string ((const char **)argv, NULL, 0, -1); STRCMP_EQUAL("abcdefghi", str); @@ -2699,10 +2685,10 @@ TEST(CoreString, Hex_dump) const char *noel_iso = "no\xebl"; char *str; - POINTERS_EQUAL(NULL, string_hex_dump (NULL, 0, 0, NULL, NULL)); - POINTERS_EQUAL(NULL, string_hex_dump ("abc", 0, 0, NULL, NULL)); - POINTERS_EQUAL(NULL, string_hex_dump ("abc", 3, 0, NULL, NULL)); - POINTERS_EQUAL(NULL, string_hex_dump ("abc", 0, 5, NULL, NULL)); + STRCMP_EQUAL(NULL, string_hex_dump (NULL, 0, 0, NULL, NULL)); + STRCMP_EQUAL(NULL, string_hex_dump ("abc", 0, 0, NULL, NULL)); + STRCMP_EQUAL(NULL, string_hex_dump ("abc", 3, 0, NULL, NULL)); + STRCMP_EQUAL(NULL, string_hex_dump ("abc", 0, 5, NULL, NULL)); WEE_HEX_DUMP("61 62 63 a b c ", "abc", 3, 3, NULL, NULL); WEE_HEX_DUMP("61 62 63 a b c ", "abc", 3, 3, "", ""); @@ -2777,9 +2763,9 @@ TEST(CoreString, InputForBuffer) { char *str; - POINTERS_EQUAL(NULL, string_input_for_buffer (NULL)); - POINTERS_EQUAL(NULL, string_input_for_buffer ("/")); - POINTERS_EQUAL(NULL, string_input_for_buffer ("/abc")); + STRCMP_EQUAL(NULL, string_input_for_buffer (NULL)); + STRCMP_EQUAL(NULL, string_input_for_buffer ("/")); + STRCMP_EQUAL(NULL, string_input_for_buffer ("/abc")); /* not commands */ str = strdup (""); @@ -2811,18 +2797,18 @@ TEST(CoreString, InputForBuffer) free (str); /* commands */ - POINTERS_EQUAL(NULL, string_input_for_buffer (NULL)); + STRCMP_EQUAL(NULL, string_input_for_buffer (NULL)); str = strdup ("/"); - POINTERS_EQUAL(NULL, string_input_for_buffer (str)); + STRCMP_EQUAL(NULL, string_input_for_buffer (str)); free (str); str = strdup ("/abc"); - POINTERS_EQUAL(NULL, string_input_for_buffer (str)); + STRCMP_EQUAL(NULL, string_input_for_buffer (str)); free (str); str = strdup ("/abc /def"); - POINTERS_EQUAL(NULL, string_input_for_buffer (str)); + STRCMP_EQUAL(NULL, string_input_for_buffer (str)); free (str); str = strdup ("/abc\n/def"); - POINTERS_EQUAL(NULL, string_input_for_buffer (str)); + STRCMP_EQUAL(NULL, string_input_for_buffer (str)); free (str); /* test with custom command chars */ @@ -2832,7 +2818,7 @@ TEST(CoreString, InputForBuffer) STRCMP_EQUAL(str, string_input_for_buffer (str)); free (str); str = strdup ("ö_abc"); - POINTERS_EQUAL(NULL, string_input_for_buffer (str)); + STRCMP_EQUAL(NULL, string_input_for_buffer (str)); free (str); str = strdup ("ö abc"); STRCMP_EQUAL(str, string_input_for_buffer (str)); @@ -2841,7 +2827,7 @@ TEST(CoreString, InputForBuffer) STRCMP_EQUAL(str + 2, string_input_for_buffer (str)); free (str); str = strdup ("ï_abc"); - POINTERS_EQUAL(NULL, string_input_for_buffer (str)); + STRCMP_EQUAL(NULL, string_input_for_buffer (str)); free (str); str = strdup ("ï abc"); STRCMP_EQUAL(str, string_input_for_buffer (str)); @@ -2952,7 +2938,7 @@ TEST(CoreString, GetPriorityAndName) ptr_name = NULL; string_get_priority_and_name (NULL, &priority, &ptr_name, 500); LONGS_EQUAL(500, priority); - POINTERS_EQUAL(NULL, ptr_name); + STRCMP_EQUAL(NULL, ptr_name); /* "" => (default_priority, "") */ priority = -1; @@ -3004,7 +2990,7 @@ TEST(CoreString, Shared) count = (string_hashtable_shared) ? string_hashtable_shared->items_count : 0; - POINTERS_EQUAL(NULL, string_shared_get (NULL)); + STRCMP_EQUAL(NULL, string_shared_get (NULL)); str1 = string_shared_get ("this is a test"); CHECK(str1); diff --git a/tests/unit/core/test-core-utf8.cpp b/tests/unit/core/test-core-utf8.cpp index e87a679a7..8e162a254 100644 --- a/tests/unit/core/test-core-utf8.cpp +++ b/tests/unit/core/test-core-utf8.cpp @@ -158,17 +158,17 @@ TEST(CoreUtf8, Validity) LONGS_EQUAL(1, utf8_is_valid ("", 0, &error)); LONGS_EQUAL(1, utf8_is_valid ("", 1, &error)); LONGS_EQUAL(1, utf8_is_valid ("abc", -1, &error)); - POINTERS_EQUAL(NULL, error); + STRCMP_EQUAL(NULL, error); LONGS_EQUAL(1, utf8_is_valid ("abc", 0, &error)); - POINTERS_EQUAL(NULL, error); + STRCMP_EQUAL(NULL, error); LONGS_EQUAL(1, utf8_is_valid ("abc", 1, &error)); - POINTERS_EQUAL(NULL, error); + STRCMP_EQUAL(NULL, error); LONGS_EQUAL(1, utf8_is_valid (noel_valid, -1, &error)); - POINTERS_EQUAL(NULL, error); + STRCMP_EQUAL(NULL, error); LONGS_EQUAL(1, utf8_is_valid (noel_valid, 0, &error)); - POINTERS_EQUAL(NULL, error); + STRCMP_EQUAL(NULL, error); LONGS_EQUAL(1, utf8_is_valid (noel_valid, 1, &error)); - POINTERS_EQUAL(NULL, error); + STRCMP_EQUAL(NULL, error); LONGS_EQUAL(0, utf8_is_valid (utf8_4bytes_invalid, -1, &error)); POINTERS_EQUAL(utf8_4bytes_invalid, error); LONGS_EQUAL(0, utf8_is_valid (utf8_4bytes_invalid, 0, &error)); @@ -186,9 +186,9 @@ TEST(CoreUtf8, Validity) LONGS_EQUAL(0, utf8_is_valid (noel_invalid, 0, &error)); POINTERS_EQUAL(noel_invalid + 2, error); LONGS_EQUAL(1, utf8_is_valid (noel_invalid, 1, &error)); - POINTERS_EQUAL(NULL, error); + STRCMP_EQUAL(NULL, error); LONGS_EQUAL(1, utf8_is_valid (noel_invalid, 2, &error)); - POINTERS_EQUAL(NULL, error); + STRCMP_EQUAL(NULL, error); LONGS_EQUAL(0, utf8_is_valid (noel_invalid, 3, &error)); POINTERS_EQUAL(noel_invalid + 2, error); LONGS_EQUAL(0, utf8_is_valid (noel_invalid, 4, &error)); @@ -346,11 +346,11 @@ TEST(CoreUtf8, Move) const char *han_char = UNICODE_HAN_CHAR; /* previous/next char */ - POINTERS_EQUAL(NULL, utf8_prev_char (NULL, NULL)); - POINTERS_EQUAL(NULL, utf8_next_char (NULL)); - POINTERS_EQUAL(NULL, utf8_prev_char (empty_string, empty_string)); - POINTERS_EQUAL(empty_string + 1, utf8_next_char (empty_string)); - POINTERS_EQUAL(NULL, utf8_prev_char (noel_valid + 1, noel_valid)); + STRCMP_EQUAL(NULL, utf8_prev_char (NULL, NULL)); + STRCMP_EQUAL(NULL, utf8_next_char (NULL)); + STRCMP_EQUAL(NULL, utf8_prev_char (empty_string, empty_string)); + STRCMP_EQUAL(empty_string + 1, utf8_next_char (empty_string)); + STRCMP_EQUAL(NULL, utf8_prev_char (noel_valid + 1, noel_valid)); ptr = utf8_next_char (noel_valid); STRCMP_EQUAL("oël", ptr); ptr = utf8_next_char (ptr); @@ -382,8 +382,8 @@ TEST(CoreUtf8, Move) utf8_next_char (utf8_4bytes_truncated_3)); /* beginning/end of line */ - POINTERS_EQUAL(NULL, utf8_beginning_of_line (NULL, NULL)); - POINTERS_EQUAL(NULL, utf8_end_of_line (NULL)); + STRCMP_EQUAL(NULL, utf8_beginning_of_line (NULL, NULL)); + STRCMP_EQUAL(NULL, utf8_end_of_line (NULL)); ptr = utf8_end_of_line (noel_valid_multiline); STRCMP_EQUAL("\nnoël", ptr); ptr = utf8_end_of_line (ptr); @@ -404,7 +404,7 @@ TEST(CoreUtf8, Move) STRCMP_EQUAL(noel_valid_multiline, ptr); /* add offset */ - POINTERS_EQUAL(NULL, utf8_add_offset (NULL, 0)); + STRCMP_EQUAL(NULL, utf8_add_offset (NULL, 0)); ptr = utf8_add_offset (noel_valid, 0); STRCMP_EQUAL(noel_valid, ptr); ptr = utf8_add_offset (noel_valid, 1); diff --git a/tests/unit/gui/test-gui-bar-item-custom.cpp b/tests/unit/gui/test-gui-bar-item-custom.cpp index 4250b750b..1082e9eb8 100644 --- a/tests/unit/gui/test-gui-bar-item-custom.cpp +++ b/tests/unit/gui/test-gui-bar-item-custom.cpp @@ -266,11 +266,11 @@ TEST(GuiBarItemCustom, Callback) /* change conditions so that it becomes false on first buffer */ config_file_option_set (new_item->options[GUI_BAR_ITEM_CUSTOM_OPTION_CONDITIONS], "${buffer.number} == 2", 1); - POINTERS_EQUAL(NULL, - gui_bar_item_custom_callback (new_item, NULL, - new_item->bar_item, - gui_windows, gui_buffers, - NULL)); + STRCMP_EQUAL(NULL, + gui_bar_item_custom_callback (new_item, NULL, + new_item->bar_item, + gui_windows, gui_buffers, + NULL)); gui_bar_item_custom_free (new_item); } diff --git a/tests/unit/gui/test-gui-buffer.cpp b/tests/unit/gui/test-gui-buffer.cpp index d70d502ec..5b10dcbac 100644 --- a/tests/unit/gui/test-gui-buffer.cpp +++ b/tests/unit/gui/test-gui-buffer.cpp @@ -161,7 +161,7 @@ TEST(GuiBuffer, GetPluginName) NULL, NULL, NULL); CHECK(buffer); - POINTERS_EQUAL(NULL, gui_buffer_get_plugin_name (NULL)); + STRCMP_EQUAL(NULL, gui_buffer_get_plugin_name (NULL)); STRCMP_EQUAL("core", gui_buffer_get_plugin_name (buffer)); @@ -271,8 +271,8 @@ TEST(GuiBuffer, LocalVarAddRemove) gui_buffer_local_var_remove_all (NULL); gui_buffer_local_var_remove_all (buffer); - POINTERS_EQUAL(NULL, - hashtable_get_string (buffer->local_variables, "keys_values")); + STRCMP_EQUAL(NULL, + hashtable_get_string (buffer->local_variables, "keys_values")); gui_buffer_close (buffer); } @@ -520,13 +520,13 @@ TEST(GuiBuffer, NewProps) &test_buffer_close_cb, NULL, NULL); CHECK(buffer); POINTERS_EQUAL(NULL, buffer->plugin); - POINTERS_EQUAL(NULL, buffer->plugin_name_for_upgrade); + STRCMP_EQUAL(NULL, buffer->plugin_name_for_upgrade); LONGS_EQUAL(2, buffer->number); LONGS_EQUAL(0, buffer->layout_number); LONGS_EQUAL(0, buffer->layout_number_merge_order); STRCMP_EQUAL(TEST_BUFFER_NAME, buffer->name); STRCMP_EQUAL("core." TEST_BUFFER_NAME, buffer->full_name); - POINTERS_EQUAL(NULL, buffer->old_full_name); + STRCMP_EQUAL(NULL, buffer->old_full_name); STRCMP_EQUAL(TEST_BUFFER_NAME, buffer->short_name); LONGS_EQUAL(GUI_BUFFER_TYPE_FREE, buffer->type); LONGS_EQUAL(GUI_BUFFER_NOTIFY_ALL, buffer->notify); @@ -542,8 +542,8 @@ TEST(GuiBuffer, NewProps) POINTERS_EQUAL(NULL, buffer->close_callback_pointer); POINTERS_EQUAL(NULL, buffer->close_callback_data); LONGS_EQUAL(0, buffer->closing); - POINTERS_EQUAL(NULL, buffer->title); - POINTERS_EQUAL(NULL, buffer->modes); + STRCMP_EQUAL(NULL, buffer->title); + STRCMP_EQUAL(NULL, buffer->modes); CHECK(buffer->own_lines); POINTERS_EQUAL(NULL, buffer->own_lines->first_line); POINTERS_EQUAL(NULL, buffer->own_lines->last_line); @@ -573,7 +573,7 @@ TEST(GuiBuffer, NewProps) LONGS_EQUAL(0, buffer->input_get_unknown_commands); LONGS_EQUAL(0, buffer->input_get_empty); LONGS_EQUAL(0, buffer->input_multiline); - POINTERS_EQUAL(NULL, buffer->input_prompt); + STRCMP_EQUAL(NULL, buffer->input_prompt); STRCMP_EQUAL("", buffer->input_buffer); CHECK(buffer->input_buffer_alloc > 0); LONGS_EQUAL(0, buffer->input_buffer_size); @@ -581,7 +581,7 @@ TEST(GuiBuffer, NewProps) LONGS_EQUAL(0, buffer->input_buffer_pos); LONGS_EQUAL(0, buffer->input_buffer_1st_display); CHECK(buffer->input_undo_snap); - POINTERS_EQUAL(NULL, buffer->input_undo_snap->data); + STRCMP_EQUAL(NULL, buffer->input_undo_snap->data); LONGS_EQUAL(0, buffer->input_undo_snap->pos); POINTERS_EQUAL(NULL, buffer->input_undo_snap->prev_undo); POINTERS_EQUAL(NULL, buffer->input_undo_snap->next_undo); @@ -603,14 +603,14 @@ TEST(GuiBuffer, NewProps) LONGS_EQUAL(0, buffer->text_search_history); LONGS_EQUAL(0, buffer->text_search_found); POINTERS_EQUAL(NULL, buffer->text_search_ptr_history); - POINTERS_EQUAL(NULL, buffer->text_search_input); - POINTERS_EQUAL(NULL, buffer->highlight_words); - POINTERS_EQUAL(NULL, buffer->highlight_regex); + STRCMP_EQUAL(NULL, buffer->text_search_input); + STRCMP_EQUAL(NULL, buffer->highlight_words); + STRCMP_EQUAL(NULL, buffer->highlight_regex); POINTERS_EQUAL(NULL, buffer->highlight_regex_compiled); - POINTERS_EQUAL(NULL, buffer->highlight_tags_restrict); + STRCMP_EQUAL(NULL, buffer->highlight_tags_restrict); LONGS_EQUAL(0, buffer->highlight_tags_restrict_count); POINTERS_EQUAL(NULL, buffer->highlight_tags_restrict_array); - POINTERS_EQUAL(NULL, buffer->highlight_tags); + STRCMP_EQUAL(NULL, buffer->highlight_tags); LONGS_EQUAL(0, buffer->highlight_tags_count); POINTERS_EQUAL(NULL, buffer->highlight_tags_array); POINTERS_EQUAL(NULL, buffer->hotlist); @@ -674,13 +674,13 @@ TEST(GuiBuffer, New) &test_buffer_close_cb, NULL, NULL); CHECK(buffer); POINTERS_EQUAL(NULL, buffer->plugin); - POINTERS_EQUAL(NULL, buffer->plugin_name_for_upgrade); + STRCMP_EQUAL(NULL, buffer->plugin_name_for_upgrade); LONGS_EQUAL(2, buffer->number); LONGS_EQUAL(0, buffer->layout_number); LONGS_EQUAL(0, buffer->layout_number_merge_order); STRCMP_EQUAL(TEST_BUFFER_NAME, buffer->name); STRCMP_EQUAL("core." TEST_BUFFER_NAME, buffer->full_name); - POINTERS_EQUAL(NULL, buffer->old_full_name); + STRCMP_EQUAL(NULL, buffer->old_full_name); STRCMP_EQUAL(TEST_BUFFER_NAME, buffer->short_name); gui_buffer_close (buffer); } @@ -916,27 +916,27 @@ TEST(GuiBuffer, GetInteger) TEST(GuiBuffer, GetString) { - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, NULL)); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "zzz")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, NULL)); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "zzz")); STRCMP_EQUAL("core", gui_buffer_get_string (gui_buffers, "plugin")); STRCMP_EQUAL("weechat", gui_buffer_get_string (gui_buffers, "name")); STRCMP_EQUAL("core.weechat", gui_buffer_get_string (gui_buffers, "full_name")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "old_full_name")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "old_full_name")); STRCMP_EQUAL("weechat", gui_buffer_get_string (gui_buffers, "short_name")); STRCMP_EQUAL("formatted", gui_buffer_get_string (gui_buffers, "type")); STRNCMP_EQUAL("WeeChat ", gui_buffer_get_string (gui_buffers, "title"), 8); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "modes")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "input_prompt")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "modes")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "input_prompt")); STRCMP_EQUAL("", gui_buffer_get_string (gui_buffers, "input")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "text_search_input")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_words")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_disable_regex")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_regex")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_tags_restrict")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_tags")); - POINTERS_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "hotlist_max_level_nicks")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "text_search_input")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_words")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_disable_regex")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_regex")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_tags_restrict")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "highlight_tags")); + STRCMP_EQUAL(NULL, gui_buffer_get_string (gui_buffers, "hotlist_max_level_nicks")); } /* @@ -1094,10 +1094,10 @@ TEST(GuiBuffer, SetHighlightWords) gui_buffer_set_highlight_words (NULL, NULL); gui_buffer_set_highlight_words (buffer, NULL); - POINTERS_EQUAL(NULL, buffer->highlight_words); + STRCMP_EQUAL(NULL, buffer->highlight_words); gui_buffer_set_highlight_words (buffer, ""); - POINTERS_EQUAL(NULL, buffer->highlight_words); + STRCMP_EQUAL(NULL, buffer->highlight_words); gui_buffer_set_highlight_words (buffer, "test"); STRCMP_EQUAL("test", buffer->highlight_words); @@ -1121,12 +1121,12 @@ TEST(GuiBuffer, SetHighlightWordsList) CHECK(buffer); gui_buffer_set_highlight_words_list (buffer, NULL); - POINTERS_EQUAL(NULL, buffer->highlight_words); + STRCMP_EQUAL(NULL, buffer->highlight_words); list = weelist_new (); gui_buffer_set_highlight_words_list (buffer, list); - POINTERS_EQUAL(NULL, buffer->highlight_words); + STRCMP_EQUAL(NULL, buffer->highlight_words); /* add "word1" */ weelist_add (list, "word1", WEECHAT_LIST_POS_END, NULL); @@ -1230,13 +1230,13 @@ TEST(GuiBuffer, RemoveHotlistMaxLevelNicks) TEST(GuiBuffer, SetInputPrompt) { - POINTERS_EQUAL(NULL, gui_buffers->input_prompt); + STRCMP_EQUAL(NULL, gui_buffers->input_prompt); gui_buffer_set_input_prompt (gui_buffers, "test"); STRCMP_EQUAL("test", gui_buffers->input_prompt); gui_buffer_set_input_prompt (gui_buffers, ""); - POINTERS_EQUAL(NULL, gui_buffers->input_prompt); + STRCMP_EQUAL(NULL, gui_buffers->input_prompt); } /* diff --git a/tests/unit/gui/test-gui-chat.cpp b/tests/unit/gui/test-gui-chat.cpp index 27dcee4b4..21004eb0d 100644 --- a/tests/unit/gui/test-gui-chat.cpp +++ b/tests/unit/gui/test-gui-chat.cpp @@ -157,43 +157,43 @@ TEST(GuiChat, StringAddOffset) const char *str_soft_hyphen = "A" "\u00ad" "Z"; const char *str_zero_width_space = "A" "\u200b" "Z"; - POINTERS_EQUAL(NULL, gui_chat_string_add_offset (NULL, -1)); - POINTERS_EQUAL(NULL, gui_chat_string_add_offset (NULL, 0)); - POINTERS_EQUAL(NULL, gui_chat_string_add_offset (NULL, 1)); + STRCMP_EQUAL(NULL, gui_chat_string_add_offset (NULL, -1)); + STRCMP_EQUAL(NULL, gui_chat_string_add_offset (NULL, 0)); + STRCMP_EQUAL(NULL, gui_chat_string_add_offset (NULL, 1)); - POINTERS_EQUAL(str_empty, gui_chat_string_add_offset (str_empty, -1)); - POINTERS_EQUAL(str_empty, gui_chat_string_add_offset (str_empty, 0)); - POINTERS_EQUAL(str_empty, gui_chat_string_add_offset (str_empty, 1)); + STRCMP_EQUAL(str_empty, gui_chat_string_add_offset (str_empty, -1)); + STRCMP_EQUAL(str_empty, gui_chat_string_add_offset (str_empty, 0)); + STRCMP_EQUAL(str_empty, gui_chat_string_add_offset (str_empty, 1)); - POINTERS_EQUAL(str_noel, gui_chat_string_add_offset (str_noel, -1)); - POINTERS_EQUAL(str_noel, gui_chat_string_add_offset (str_noel, 0)); - POINTERS_EQUAL(str_noel + 1, gui_chat_string_add_offset (str_noel, 1)); - POINTERS_EQUAL(str_noel + 2, gui_chat_string_add_offset (str_noel, 2)); - POINTERS_EQUAL(str_noel + 4, gui_chat_string_add_offset (str_noel, 3)); - POINTERS_EQUAL(str_noel + 5, gui_chat_string_add_offset (str_noel, 4)); - POINTERS_EQUAL(str_noel + 5, gui_chat_string_add_offset (str_noel, 5)); + STRCMP_EQUAL(str_noel, gui_chat_string_add_offset (str_noel, -1)); + STRCMP_EQUAL(str_noel, gui_chat_string_add_offset (str_noel, 0)); + STRCMP_EQUAL(str_noel + 1, gui_chat_string_add_offset (str_noel, 1)); + STRCMP_EQUAL(str_noel + 2, gui_chat_string_add_offset (str_noel, 2)); + STRCMP_EQUAL(str_noel + 4, gui_chat_string_add_offset (str_noel, 3)); + STRCMP_EQUAL(str_noel + 5, gui_chat_string_add_offset (str_noel, 4)); + STRCMP_EQUAL(str_noel + 5, gui_chat_string_add_offset (str_noel, 5)); - POINTERS_EQUAL(str_other, gui_chat_string_add_offset (str_other, -1)); - POINTERS_EQUAL(str_other, gui_chat_string_add_offset (str_other, 0)); - POINTERS_EQUAL(str_other + 1, gui_chat_string_add_offset (str_other, 1)); - POINTERS_EQUAL(str_other + 4, gui_chat_string_add_offset (str_other, 2)); - POINTERS_EQUAL(str_other + 5, gui_chat_string_add_offset (str_other, 3)); - POINTERS_EQUAL(str_other + 5, gui_chat_string_add_offset (str_other, 4)); - POINTERS_EQUAL(str_other + 5, gui_chat_string_add_offset (str_other, 5)); + STRCMP_EQUAL(str_other, gui_chat_string_add_offset (str_other, -1)); + STRCMP_EQUAL(str_other, gui_chat_string_add_offset (str_other, 0)); + STRCMP_EQUAL(str_other + 1, gui_chat_string_add_offset (str_other, 1)); + STRCMP_EQUAL(str_other + 4, gui_chat_string_add_offset (str_other, 2)); + STRCMP_EQUAL(str_other + 5, gui_chat_string_add_offset (str_other, 3)); + STRCMP_EQUAL(str_other + 5, gui_chat_string_add_offset (str_other, 4)); + STRCMP_EQUAL(str_other + 5, gui_chat_string_add_offset (str_other, 5)); - POINTERS_EQUAL(str_soft_hyphen, gui_chat_string_add_offset (str_soft_hyphen, -1)); - POINTERS_EQUAL(str_soft_hyphen, gui_chat_string_add_offset (str_soft_hyphen, 0)); - POINTERS_EQUAL(str_soft_hyphen + 1, gui_chat_string_add_offset (str_soft_hyphen, 1)); - POINTERS_EQUAL(str_soft_hyphen + 3, gui_chat_string_add_offset (str_soft_hyphen, 2)); - POINTERS_EQUAL(str_soft_hyphen + 4, gui_chat_string_add_offset (str_soft_hyphen, 3)); - POINTERS_EQUAL(str_soft_hyphen + 4, gui_chat_string_add_offset (str_soft_hyphen, 4)); + STRCMP_EQUAL(str_soft_hyphen, gui_chat_string_add_offset (str_soft_hyphen, -1)); + STRCMP_EQUAL(str_soft_hyphen, gui_chat_string_add_offset (str_soft_hyphen, 0)); + STRCMP_EQUAL(str_soft_hyphen + 1, gui_chat_string_add_offset (str_soft_hyphen, 1)); + STRCMP_EQUAL(str_soft_hyphen + 3, gui_chat_string_add_offset (str_soft_hyphen, 2)); + STRCMP_EQUAL(str_soft_hyphen + 4, gui_chat_string_add_offset (str_soft_hyphen, 3)); + STRCMP_EQUAL(str_soft_hyphen + 4, gui_chat_string_add_offset (str_soft_hyphen, 4)); - POINTERS_EQUAL(str_zero_width_space, gui_chat_string_add_offset (str_zero_width_space, -1)); - POINTERS_EQUAL(str_zero_width_space, gui_chat_string_add_offset (str_zero_width_space, 0)); - POINTERS_EQUAL(str_zero_width_space + 1, gui_chat_string_add_offset (str_zero_width_space, 1)); - POINTERS_EQUAL(str_zero_width_space + 4, gui_chat_string_add_offset (str_zero_width_space, 2)); - POINTERS_EQUAL(str_zero_width_space + 5, gui_chat_string_add_offset (str_zero_width_space, 3)); - POINTERS_EQUAL(str_zero_width_space + 5, gui_chat_string_add_offset (str_zero_width_space, 4)); + STRCMP_EQUAL(str_zero_width_space, gui_chat_string_add_offset (str_zero_width_space, -1)); + STRCMP_EQUAL(str_zero_width_space, gui_chat_string_add_offset (str_zero_width_space, 0)); + STRCMP_EQUAL(str_zero_width_space + 1, gui_chat_string_add_offset (str_zero_width_space, 1)); + STRCMP_EQUAL(str_zero_width_space + 4, gui_chat_string_add_offset (str_zero_width_space, 2)); + STRCMP_EQUAL(str_zero_width_space + 5, gui_chat_string_add_offset (str_zero_width_space, 3)); + STRCMP_EQUAL(str_zero_width_space + 5, gui_chat_string_add_offset (str_zero_width_space, 4)); } /* @@ -209,41 +209,41 @@ TEST(GuiChat, StringAddOffsetScreen) const char *str_soft_hyphen = "A" "\u00ad" "Z"; const char *str_zero_width_space = "A" "\u200b" "Z"; - POINTERS_EQUAL(NULL, gui_chat_string_add_offset_screen (NULL, -1)); - POINTERS_EQUAL(NULL, gui_chat_string_add_offset_screen (NULL, 0)); - POINTERS_EQUAL(NULL, gui_chat_string_add_offset_screen (NULL, 1)); + STRCMP_EQUAL(NULL, gui_chat_string_add_offset_screen (NULL, -1)); + STRCMP_EQUAL(NULL, gui_chat_string_add_offset_screen (NULL, 0)); + STRCMP_EQUAL(NULL, gui_chat_string_add_offset_screen (NULL, 1)); - POINTERS_EQUAL(str_empty, gui_chat_string_add_offset_screen (str_empty, -1)); - POINTERS_EQUAL(str_empty, gui_chat_string_add_offset_screen (str_empty, 0)); - POINTERS_EQUAL(str_empty, gui_chat_string_add_offset_screen (str_empty, 1)); + STRCMP_EQUAL(str_empty, gui_chat_string_add_offset_screen (str_empty, -1)); + STRCMP_EQUAL(str_empty, gui_chat_string_add_offset_screen (str_empty, 0)); + STRCMP_EQUAL(str_empty, gui_chat_string_add_offset_screen (str_empty, 1)); - POINTERS_EQUAL(str_noel, gui_chat_string_add_offset_screen (str_noel, -1)); - POINTERS_EQUAL(str_noel, gui_chat_string_add_offset_screen (str_noel, 0)); - POINTERS_EQUAL(str_noel + 1, gui_chat_string_add_offset_screen (str_noel, 1)); - POINTERS_EQUAL(str_noel + 2, gui_chat_string_add_offset_screen (str_noel, 2)); - POINTERS_EQUAL(str_noel + 4, gui_chat_string_add_offset_screen (str_noel, 3)); - POINTERS_EQUAL(str_noel + 5, gui_chat_string_add_offset_screen (str_noel, 4)); - POINTERS_EQUAL(str_noel + 5, gui_chat_string_add_offset_screen (str_noel, 5)); + STRCMP_EQUAL(str_noel, gui_chat_string_add_offset_screen (str_noel, -1)); + STRCMP_EQUAL(str_noel, gui_chat_string_add_offset_screen (str_noel, 0)); + STRCMP_EQUAL(str_noel + 1, gui_chat_string_add_offset_screen (str_noel, 1)); + STRCMP_EQUAL(str_noel + 2, gui_chat_string_add_offset_screen (str_noel, 2)); + STRCMP_EQUAL(str_noel + 4, gui_chat_string_add_offset_screen (str_noel, 3)); + STRCMP_EQUAL(str_noel + 5, gui_chat_string_add_offset_screen (str_noel, 4)); + STRCMP_EQUAL(str_noel + 5, gui_chat_string_add_offset_screen (str_noel, 5)); - POINTERS_EQUAL(str_other, gui_chat_string_add_offset_screen (str_other, -1)); - POINTERS_EQUAL(str_other, gui_chat_string_add_offset_screen (str_other, 0)); - POINTERS_EQUAL(str_other + 1, gui_chat_string_add_offset_screen (str_other, 1)); - POINTERS_EQUAL(str_other + 1, gui_chat_string_add_offset_screen (str_other, 2)); - POINTERS_EQUAL(str_other + 4, gui_chat_string_add_offset_screen (str_other, 3)); - POINTERS_EQUAL(str_other + 5, gui_chat_string_add_offset_screen (str_other, 4)); - POINTERS_EQUAL(str_other + 5, gui_chat_string_add_offset_screen (str_other, 5)); + STRCMP_EQUAL(str_other, gui_chat_string_add_offset_screen (str_other, -1)); + STRCMP_EQUAL(str_other, gui_chat_string_add_offset_screen (str_other, 0)); + STRCMP_EQUAL(str_other + 1, gui_chat_string_add_offset_screen (str_other, 1)); + STRCMP_EQUAL(str_other + 1, gui_chat_string_add_offset_screen (str_other, 2)); + STRCMP_EQUAL(str_other + 4, gui_chat_string_add_offset_screen (str_other, 3)); + STRCMP_EQUAL(str_other + 5, gui_chat_string_add_offset_screen (str_other, 4)); + STRCMP_EQUAL(str_other + 5, gui_chat_string_add_offset_screen (str_other, 5)); - POINTERS_EQUAL(str_soft_hyphen, gui_chat_string_add_offset_screen (str_soft_hyphen, -1)); - POINTERS_EQUAL(str_soft_hyphen, gui_chat_string_add_offset_screen (str_soft_hyphen, 0)); - POINTERS_EQUAL(str_soft_hyphen + 3, gui_chat_string_add_offset_screen (str_soft_hyphen, 1)); - POINTERS_EQUAL(str_soft_hyphen + 4, gui_chat_string_add_offset_screen (str_soft_hyphen, 2)); - POINTERS_EQUAL(str_soft_hyphen + 4, gui_chat_string_add_offset_screen (str_soft_hyphen, 3)); + STRCMP_EQUAL(str_soft_hyphen, gui_chat_string_add_offset_screen (str_soft_hyphen, -1)); + STRCMP_EQUAL(str_soft_hyphen, gui_chat_string_add_offset_screen (str_soft_hyphen, 0)); + STRCMP_EQUAL(str_soft_hyphen + 3, gui_chat_string_add_offset_screen (str_soft_hyphen, 1)); + STRCMP_EQUAL(str_soft_hyphen + 4, gui_chat_string_add_offset_screen (str_soft_hyphen, 2)); + STRCMP_EQUAL(str_soft_hyphen + 4, gui_chat_string_add_offset_screen (str_soft_hyphen, 3)); - POINTERS_EQUAL(str_zero_width_space, gui_chat_string_add_offset_screen (str_zero_width_space, -1)); - POINTERS_EQUAL(str_zero_width_space, gui_chat_string_add_offset_screen (str_zero_width_space, 0)); - POINTERS_EQUAL(str_zero_width_space + 4, gui_chat_string_add_offset_screen (str_zero_width_space, 1)); - POINTERS_EQUAL(str_zero_width_space + 5, gui_chat_string_add_offset_screen (str_zero_width_space, 2)); - POINTERS_EQUAL(str_zero_width_space + 5, gui_chat_string_add_offset_screen (str_zero_width_space, 3)); + STRCMP_EQUAL(str_zero_width_space, gui_chat_string_add_offset_screen (str_zero_width_space, -1)); + STRCMP_EQUAL(str_zero_width_space, gui_chat_string_add_offset_screen (str_zero_width_space, 0)); + STRCMP_EQUAL(str_zero_width_space + 4, gui_chat_string_add_offset_screen (str_zero_width_space, 1)); + STRCMP_EQUAL(str_zero_width_space + 5, gui_chat_string_add_offset_screen (str_zero_width_space, 2)); + STRCMP_EQUAL(str_zero_width_space + 5, gui_chat_string_add_offset_screen (str_zero_width_space, 3)); } /* @@ -574,14 +574,14 @@ TEST(GuiChat, PrintDatetimeTags) LONGS_EQUAL(0, ptr_data->date_usec); CHECK(ptr_data->date_printed > 0); CHECK((ptr_data->date_usec_printed >= 0) && (ptr_data->date_usec_printed <= 999999)); - POINTERS_EQUAL(NULL, ptr_data->str_time); + STRCMP_EQUAL(NULL, ptr_data->str_time); LONGS_EQUAL(0, ptr_data->tags_count); POINTERS_EQUAL(NULL, ptr_data->tags_array); LONGS_EQUAL(1, ptr_data->displayed); LONGS_EQUAL(0, ptr_data->notify_level); LONGS_EQUAL(0, ptr_data->highlight); LONGS_EQUAL(0, ptr_data->refresh_needed); - POINTERS_EQUAL(NULL, ptr_data->prefix); + STRCMP_EQUAL(NULL, ptr_data->prefix); LONGS_EQUAL(0, ptr_data->prefix_length); STRCMP_EQUAL("this is a test", ptr_data->message); @@ -703,14 +703,14 @@ TEST(GuiChat, PrintYDatetimeTags) CHECK((ptr_data->date_usec >= 0) && (ptr_data->date_usec <= 999999)); CHECK(ptr_data->date == ptr_data->date_printed); CHECK(ptr_data->date_usec == ptr_data->date_usec_printed); - POINTERS_EQUAL(NULL, ptr_data->str_time); + STRCMP_EQUAL(NULL, ptr_data->str_time); LONGS_EQUAL(0, ptr_data->tags_count); POINTERS_EQUAL(NULL, ptr_data->tags_array); LONGS_EQUAL(1, ptr_data->displayed); LONGS_EQUAL(0, ptr_data->notify_level); LONGS_EQUAL(0, ptr_data->highlight); LONGS_EQUAL(1, ptr_data->refresh_needed); - POINTERS_EQUAL(NULL, ptr_data->prefix); + STRCMP_EQUAL(NULL, ptr_data->prefix); LONGS_EQUAL(0, ptr_data->prefix_length); STRCMP_EQUAL("this is a test on line 1", ptr_data->message); @@ -726,14 +726,14 @@ TEST(GuiChat, PrintYDatetimeTags) LONGS_EQUAL(123456, ptr_data->date_usec); CHECK(ptr_data->date < ptr_data->date_printed); CHECK((ptr_data->date_usec_printed >= 0) && (ptr_data->date_usec_printed <= 999999)); - POINTERS_EQUAL(NULL, ptr_data->str_time); + STRCMP_EQUAL(NULL, ptr_data->str_time); LONGS_EQUAL(0, ptr_data->tags_count); POINTERS_EQUAL(NULL, ptr_data->tags_array); LONGS_EQUAL(1, ptr_data->displayed); LONGS_EQUAL(0, ptr_data->notify_level); LONGS_EQUAL(0, ptr_data->highlight); LONGS_EQUAL(1, ptr_data->refresh_needed); - POINTERS_EQUAL(NULL, ptr_data->prefix); + STRCMP_EQUAL(NULL, ptr_data->prefix); LONGS_EQUAL(0, ptr_data->prefix_length); STRCMP_EQUAL("this is a test on line 1", ptr_data->message); @@ -749,14 +749,14 @@ TEST(GuiChat, PrintYDatetimeTags) CHECK((ptr_data->date_usec >= 0) && (ptr_data->date_usec <= 999999)); CHECK(ptr_data->date == ptr_data->date_printed); CHECK(ptr_data->date_usec == ptr_data->date_usec_printed); - POINTERS_EQUAL(NULL, ptr_data->str_time); + STRCMP_EQUAL(NULL, ptr_data->str_time); LONGS_EQUAL(0, ptr_data->tags_count); POINTERS_EQUAL(NULL, ptr_data->tags_array); LONGS_EQUAL(1, ptr_data->displayed); LONGS_EQUAL(0, ptr_data->notify_level); LONGS_EQUAL(0, ptr_data->highlight); LONGS_EQUAL(1, ptr_data->refresh_needed); - POINTERS_EQUAL(NULL, ptr_data->prefix); + STRCMP_EQUAL(NULL, ptr_data->prefix); LONGS_EQUAL(0, ptr_data->prefix_length); STRCMP_EQUAL("this is a test on line 1", ptr_data->message); @@ -772,7 +772,7 @@ TEST(GuiChat, PrintYDatetimeTags) CHECK((ptr_data->date_usec >= 0) && (ptr_data->date_usec <= 999999)); CHECK(ptr_data->date == ptr_data->date_printed); CHECK(ptr_data->date_usec == ptr_data->date_usec_printed); - POINTERS_EQUAL(NULL, ptr_data->str_time); + STRCMP_EQUAL(NULL, ptr_data->str_time); LONGS_EQUAL(3, ptr_data->tags_count); CHECK(ptr_data->tags_array); STRCMP_EQUAL("tag1", ptr_data->tags_array[0]); @@ -782,7 +782,7 @@ TEST(GuiChat, PrintYDatetimeTags) LONGS_EQUAL(0, ptr_data->notify_level); LONGS_EQUAL(0, ptr_data->highlight); LONGS_EQUAL(1, ptr_data->refresh_needed); - POINTERS_EQUAL(NULL, ptr_data->prefix); + STRCMP_EQUAL(NULL, ptr_data->prefix); LONGS_EQUAL(0, ptr_data->prefix_length); STRCMP_EQUAL("this is a test on line 1", ptr_data->message); @@ -798,14 +798,14 @@ TEST(GuiChat, PrintYDatetimeTags) CHECK((ptr_data->date_usec >= 0) && (ptr_data->date_usec <= 999999)); CHECK(ptr_data->date == ptr_data->date_printed); CHECK(ptr_data->date_usec == ptr_data->date_usec_printed); - POINTERS_EQUAL(NULL, ptr_data->str_time); + STRCMP_EQUAL(NULL, ptr_data->str_time); LONGS_EQUAL(0, ptr_data->tags_count); POINTERS_EQUAL(NULL, ptr_data->tags_array); LONGS_EQUAL(1, ptr_data->displayed); LONGS_EQUAL(0, ptr_data->notify_level); LONGS_EQUAL(0, ptr_data->highlight); LONGS_EQUAL(1, ptr_data->refresh_needed); - POINTERS_EQUAL(NULL, ptr_data->prefix); + STRCMP_EQUAL(NULL, ptr_data->prefix); LONGS_EQUAL(0, ptr_data->prefix_length); STRCMP_EQUAL("this is a test on line 3", ptr_data->message); @@ -819,14 +819,14 @@ TEST(GuiChat, PrintYDatetimeTags) LONGS_EQUAL(0, ptr_data->date_usec); LONGS_EQUAL(0, ptr_data->date_printed); LONGS_EQUAL(0, ptr_data->date_usec_printed); - POINTERS_EQUAL(NULL, ptr_data->str_time); + STRCMP_EQUAL(NULL, ptr_data->str_time); LONGS_EQUAL(0, ptr_data->tags_count); POINTERS_EQUAL(NULL, ptr_data->tags_array); LONGS_EQUAL(1, ptr_data->displayed); LONGS_EQUAL(0, ptr_data->notify_level); LONGS_EQUAL(0, ptr_data->highlight); LONGS_EQUAL(1, ptr_data->refresh_needed); - POINTERS_EQUAL(NULL, ptr_data->prefix); + STRCMP_EQUAL(NULL, ptr_data->prefix); LONGS_EQUAL(0, ptr_data->prefix_length); STRCMP_EQUAL("", ptr_data->message); diff --git a/tests/unit/gui/test-gui-color.cpp b/tests/unit/gui/test-gui-color.cpp index 15fbf0f17..7355501b3 100644 --- a/tests/unit/gui/test-gui-color.cpp +++ b/tests/unit/gui/test-gui-color.cpp @@ -380,9 +380,9 @@ TEST(GuiColor, Decode) char string[256], *decoded; /* NULL/empty string */ - POINTERS_EQUAL(NULL, gui_color_decode (NULL, NULL)); - POINTERS_EQUAL(NULL, gui_color_decode (NULL, "")); - POINTERS_EQUAL(NULL, gui_color_decode (NULL, "?")); + STRCMP_EQUAL(NULL, gui_color_decode (NULL, NULL)); + STRCMP_EQUAL(NULL, gui_color_decode (NULL, "")); + STRCMP_EQUAL(NULL, gui_color_decode (NULL, "?")); WEE_CHECK_DECODE("", "", NULL); WEE_CHECK_DECODE("", "", ""); WEE_CHECK_DECODE("", "", "?"); @@ -569,8 +569,8 @@ TEST(GuiColor, DecodeAnsi) char string[256], *decoded; /* NULL/empty string */ - POINTERS_EQUAL(NULL, gui_color_decode_ansi (NULL, 0)); - POINTERS_EQUAL(NULL, gui_color_decode_ansi (NULL, 1)); + STRCMP_EQUAL(NULL, gui_color_decode_ansi (NULL, 0)); + STRCMP_EQUAL(NULL, gui_color_decode_ansi (NULL, 1)); WEE_CHECK_DECODE_ANSI("", "", 0); WEE_CHECK_DECODE_ANSI("", "", 1); @@ -741,7 +741,7 @@ TEST(GuiColor, EncodeAnsi) char string[256], *encoded; /* NULL/empty string */ - POINTERS_EQUAL(NULL, gui_color_encode_ansi (NULL)); + STRCMP_EQUAL(NULL, gui_color_encode_ansi (NULL)); WEE_CHECK_ENCODE_ANSI("", ""); /* reset */ @@ -918,9 +918,9 @@ TEST(GuiColor, Emphasize) regex_t regex; /* NULL/empty string, search or regex */ - POINTERS_EQUAL(NULL, gui_color_emphasize (NULL, NULL, 0, NULL)); - POINTERS_EQUAL(NULL, gui_color_emphasize ("test", NULL, 0, NULL)); - POINTERS_EQUAL(NULL, gui_color_emphasize (NULL, "test", 0, NULL)); + STRCMP_EQUAL(NULL, gui_color_emphasize (NULL, NULL, 0, NULL)); + STRCMP_EQUAL(NULL, gui_color_emphasize ("test", NULL, 0, NULL)); + STRCMP_EQUAL(NULL, gui_color_emphasize (NULL, "test", 0, NULL)); /* build strings for tests */ snprintf (string1, sizeof (string1), diff --git a/tests/unit/gui/test-gui-filter.cpp b/tests/unit/gui/test-gui-filter.cpp index 19fe6f19a..227c7e43a 100644 --- a/tests/unit/gui/test-gui-filter.cpp +++ b/tests/unit/gui/test-gui-filter.cpp @@ -182,11 +182,11 @@ TEST(GuiFilter, New) STRCMP_EQUAL("*", filter_abc->buffer_name); LONGS_EQUAL(1, filter_abc->num_buffers); STRCMP_EQUAL("*", filter_abc->buffers[0]); - POINTERS_EQUAL(NULL, filter_abc->buffers[1]); + STRCMP_EQUAL(NULL, filter_abc->buffers[1]); STRCMP_EQUAL("tag_abc", filter_abc->tags); LONGS_EQUAL(1, filter_abc->tags_count); STRCMP_EQUAL("tag_abc", filter_abc->tags_array[0][0]); - POINTERS_EQUAL(NULL, filter_abc->tags_array[0][1]); + STRCMP_EQUAL(NULL, filter_abc->tags_array[0][1]); POINTERS_EQUAL(NULL, filter_abc->tags_array[1]); STRCMP_EQUAL("!regex_abc", filter_abc->regex); POINTERS_EQUAL(NULL, filter_abc->regex_prefix); @@ -207,14 +207,14 @@ TEST(GuiFilter, New) LONGS_EQUAL(2, filter_xyz->num_buffers); STRCMP_EQUAL("irc.test.#chan", filter_xyz->buffers[0]); STRCMP_EQUAL("irc.test.#chan2", filter_xyz->buffers[1]); - POINTERS_EQUAL(NULL, filter_xyz->buffers[2]); + STRCMP_EQUAL(NULL, filter_xyz->buffers[2]); STRCMP_EQUAL("tag_xyz,tag2_xyz+tag3_xyz", filter_xyz->tags); LONGS_EQUAL(2, filter_xyz->tags_count); STRCMP_EQUAL("tag_xyz", filter_xyz->tags_array[0][0]); - POINTERS_EQUAL(NULL, filter_xyz->tags_array[0][1]); + STRCMP_EQUAL(NULL, filter_xyz->tags_array[0][1]); STRCMP_EQUAL("tag2_xyz", filter_xyz->tags_array[1][0]); STRCMP_EQUAL("tag3_xyz", filter_xyz->tags_array[1][1]); - POINTERS_EQUAL(NULL, filter_xyz->tags_array[1][2]); + STRCMP_EQUAL(NULL, filter_xyz->tags_array[1][2]); POINTERS_EQUAL(NULL, filter_xyz->tags_array[2]); STRCMP_EQUAL("prefix\\txyz", filter_xyz->regex); CHECK(filter_xyz->regex_prefix); @@ -230,11 +230,11 @@ TEST(GuiFilter, New) STRCMP_EQUAL("*", filter_test->buffer_name); LONGS_EQUAL(1, filter_test->num_buffers); STRCMP_EQUAL("*", filter_test->buffers[0]); - POINTERS_EQUAL(NULL, filter_test->buffers[1]); + STRCMP_EQUAL(NULL, filter_test->buffers[1]); STRCMP_EQUAL("*", filter_test->tags); LONGS_EQUAL(1, filter_test->tags_count); STRCMP_EQUAL("*", filter_test->tags_array[0][0]); - POINTERS_EQUAL(NULL, filter_test->tags_array[0][1]); + STRCMP_EQUAL(NULL, filter_test->tags_array[0][1]); POINTERS_EQUAL(NULL, filter_test->tags_array[1]); STRCMP_EQUAL("regex_test", filter_test->regex); POINTERS_EQUAL(NULL, filter_test->regex_prefix); diff --git a/tests/unit/gui/test-gui-input.cpp b/tests/unit/gui/test-gui-input.cpp index 50fe4edd2..14fb00f01 100644 --- a/tests/unit/gui/test-gui-input.cpp +++ b/tests/unit/gui/test-gui-input.cpp @@ -170,13 +170,13 @@ TEST(GuiInput, ClipboardCopy) } gui_input_clipboard_copy (NULL, 1); - POINTERS_EQUAL(NULL, gui_input_clipboard); + STRCMP_EQUAL(NULL, gui_input_clipboard); gui_input_clipboard_copy ("abc", -1); - POINTERS_EQUAL(NULL, gui_input_clipboard); + STRCMP_EQUAL(NULL, gui_input_clipboard); gui_input_clipboard_copy ("abc", 0); - POINTERS_EQUAL(NULL, gui_input_clipboard); + STRCMP_EQUAL(NULL, gui_input_clipboard); gui_input_clipboard_copy ("abc", 1); STRCMP_EQUAL("a", gui_input_clipboard); diff --git a/tests/unit/gui/test-gui-key.cpp b/tests/unit/gui/test-gui-key.cpp index d882ba7b3..94dcfae9f 100644 --- a/tests/unit/gui/test-gui-key.cpp +++ b/tests/unit/gui/test-gui-key.cpp @@ -52,26 +52,10 @@ extern struct t_gui_key *gui_key_search_part (struct t_gui_buffer *buffer, int c key_name_alias = NULL; \ LONGS_EQUAL(__rc, \ gui_key_expand (__key, &key_name, &key_name_alias)); \ - if (__key_name == NULL) \ - { \ - POINTERS_EQUAL(NULL, key_name); \ - } \ - else \ - { \ - STRCMP_EQUAL(__key_name, key_name); \ - } \ - if (__key_name_alias == NULL) \ - { \ - POINTERS_EQUAL(NULL, key_name_alias); \ - } \ - else \ - { \ - STRCMP_EQUAL(__key_name_alias, key_name_alias); \ - } \ - if (key_name) \ - free (key_name); \ - if (key_name_alias) \ - free (key_name_alias); + STRCMP_EQUAL(__key_name, key_name); \ + STRCMP_EQUAL(__key_name_alias, key_name_alias); \ + free (key_name); \ + free (key_name_alias); TEST_GROUP(GuiKey) { @@ -1164,7 +1148,7 @@ TEST(GuiKey, New) STRCMP_EQUAL("meta-c", ptr_key->chunks[2]); LONGS_EQUAL(GUI_KEY_FOCUS_ANY, ptr_key->area_type[0]); LONGS_EQUAL(GUI_KEY_FOCUS_ANY, ptr_key->area_type[1]); - POINTERS_EQUAL(NULL, ptr_key->area_key); + STRCMP_EQUAL(NULL, ptr_key->area_key); STRCMP_EQUAL("/mute", ptr_key->command); LONGS_EQUAL(0, ptr_key->score); gui_key_free (GUI_KEY_CONTEXT_DEFAULT, diff --git a/tests/unit/gui/test-gui-line.cpp b/tests/unit/gui/test-gui-line.cpp index f61a589ad..f8aea3e28 100644 --- a/tests/unit/gui/test-gui-line.cpp +++ b/tests/unit/gui/test-gui-line.cpp @@ -131,7 +131,7 @@ TEST(GuiLine, TagsAlloc) gui_line_tags_alloc (&line_data, "tag1"); CHECK(line_data.tags_array); STRCMP_EQUAL("tag1", line_data.tags_array[0]); - POINTERS_EQUAL(NULL, line_data.tags_array[1]); + STRCMP_EQUAL(NULL, line_data.tags_array[1]); LONGS_EQUAL(1, line_data.tags_count); gui_line_tags_free (&line_data); @@ -141,7 +141,7 @@ TEST(GuiLine, TagsAlloc) CHECK(line_data.tags_array); STRCMP_EQUAL("tag1", line_data.tags_array[0]); STRCMP_EQUAL("tag2", line_data.tags_array[1]); - POINTERS_EQUAL(NULL, line_data.tags_array[2]); + STRCMP_EQUAL(NULL, line_data.tags_array[2]); LONGS_EQUAL(2, line_data.tags_count); gui_line_tags_free (&line_data); @@ -152,7 +152,7 @@ TEST(GuiLine, TagsAlloc) STRCMP_EQUAL("tag1", line_data.tags_array[0]); STRCMP_EQUAL("tag2", line_data.tags_array[1]); STRCMP_EQUAL("tag3", line_data.tags_array[2]); - POINTERS_EQUAL(NULL, line_data.tags_array[3]); + STRCMP_EQUAL(NULL, line_data.tags_array[3]); LONGS_EQUAL(3, line_data.tags_count); gui_line_tags_free (&line_data); @@ -221,7 +221,7 @@ TEST(GuiLine, BuildStringMessageNickOffline) { char *str, str_msg_expected[256], str_msg[256]; - POINTERS_EQUAL(NULL, gui_line_build_string_message_nick_offline (NULL)); + STRCMP_EQUAL(NULL, gui_line_build_string_message_nick_offline (NULL)); WEE_TEST_STR("", gui_line_build_string_message_nick_offline ("")); snprintf (str_msg_expected, sizeof (str_msg_expected), @@ -246,16 +246,16 @@ TEST(GuiLine, BuildStringMessageTags) char *str, str_message[256], str_result[256]; line = gui_line_new (gui_buffers, -1, 0, 0, 0, 0, "tag1,tag2", NULL, "test"); - POINTERS_EQUAL(NULL, - gui_line_build_string_message_tags (line->data->message, - -1, - line->data->tags_array, - 1)); - POINTERS_EQUAL(NULL, - gui_line_build_string_message_tags (line->data->message, - 1, - NULL, - 1)); + STRCMP_EQUAL(NULL, + gui_line_build_string_message_tags (line->data->message, + -1, + line->data->tags_array, + 1)); + STRCMP_EQUAL(NULL, + gui_line_build_string_message_tags (line->data->message, + 1, + NULL, + 1)); gui_line_free_data (line); free (line); @@ -499,15 +499,15 @@ TEST(GuiLine, SearchTagStartingWith) line.data = (struct t_gui_line_data *)calloc (1, sizeof (struct t_gui_line_data)); gui_line_tags_alloc (line.data, NULL); - POINTERS_EQUAL(NULL, gui_line_search_tag_starting_with (NULL, NULL)); - POINTERS_EQUAL(NULL, gui_line_search_tag_starting_with (NULL, "abc")); - POINTERS_EQUAL(NULL, gui_line_search_tag_starting_with (&line, NULL)); + STRCMP_EQUAL(NULL, gui_line_search_tag_starting_with (NULL, NULL)); + STRCMP_EQUAL(NULL, gui_line_search_tag_starting_with (NULL, "abc")); + STRCMP_EQUAL(NULL, gui_line_search_tag_starting_with (&line, NULL)); - POINTERS_EQUAL(NULL, gui_line_search_tag_starting_with (&line, "abc")); + STRCMP_EQUAL(NULL, gui_line_search_tag_starting_with (&line, "abc")); gui_line_tags_alloc (line.data, "tag1,word2,last3"); - POINTERS_EQUAL(NULL, gui_line_search_tag_starting_with (&line, "abc")); + STRCMP_EQUAL(NULL, gui_line_search_tag_starting_with (&line, "abc")); STRCMP_EQUAL("tag1", gui_line_search_tag_starting_with (&line, "t")); STRCMP_EQUAL("tag1", gui_line_search_tag_starting_with (&line, "tag")); STRCMP_EQUAL("word2", gui_line_search_tag_starting_with (&line, "w")); @@ -533,12 +533,12 @@ TEST(GuiLine, GetNickTag) line.data = (struct t_gui_line_data *)calloc (1, sizeof (struct t_gui_line_data)); gui_line_tags_alloc (line.data, NULL); - POINTERS_EQUAL(NULL, gui_line_get_nick_tag (NULL)); + STRCMP_EQUAL(NULL, gui_line_get_nick_tag (NULL)); - POINTERS_EQUAL(NULL, gui_line_get_nick_tag (&line)); + STRCMP_EQUAL(NULL, gui_line_get_nick_tag (&line)); gui_line_tags_alloc (line.data, "tag1,tag2,tag3"); - POINTERS_EQUAL(NULL, gui_line_get_nick_tag (&line)); + STRCMP_EQUAL(NULL, gui_line_get_nick_tag (&line)); gui_line_tags_free (line.data); gui_line_tags_alloc (line.data, "tag1,tag2,nick_jdoe,tag3"); @@ -1021,14 +1021,14 @@ TEST(GuiLine, New) LONGS_EQUAL(date.tv_usec, line1->data->date_usec); LONGS_EQUAL(date_printed.tv_sec, line1->data->date_printed); LONGS_EQUAL(date_printed.tv_usec, line1->data->date_usec_printed); - POINTERS_EQUAL(NULL, line1->data->str_time); + STRCMP_EQUAL(NULL, line1->data->str_time); LONGS_EQUAL(0, line1->data->tags_count); POINTERS_EQUAL(NULL, line1->data->tags_array); LONGS_EQUAL(1, line1->data->displayed); LONGS_EQUAL(GUI_HOTLIST_LOW, line1->data->notify_level); LONGS_EQUAL(0, line1->data->highlight); LONGS_EQUAL(1, line1->data->refresh_needed); - POINTERS_EQUAL(NULL, line1->data->prefix); + STRCMP_EQUAL(NULL, line1->data->prefix); LONGS_EQUAL(0, line1->data->prefix_length); STRCMP_EQUAL("", line1->data->message); gui_line_add (line1); @@ -1052,7 +1052,7 @@ TEST(GuiLine, New) LONGS_EQUAL(date.tv_usec, line2->data->date_usec); LONGS_EQUAL(date_printed.tv_sec, line2->data->date_printed); LONGS_EQUAL(date_printed.tv_usec, line2->data->date_usec_printed); - POINTERS_EQUAL(NULL, line2->data->str_time); + STRCMP_EQUAL(NULL, line2->data->str_time); LONGS_EQUAL(3, line2->data->tags_count); CHECK(line2->data->tags_array); STRCMP_EQUAL("tag1", line2->data->tags_array[0]); @@ -1062,7 +1062,7 @@ TEST(GuiLine, New) LONGS_EQUAL(GUI_HOTLIST_LOW, line2->data->notify_level); LONGS_EQUAL(0, line2->data->highlight); LONGS_EQUAL(1, line2->data->refresh_needed); - POINTERS_EQUAL(NULL, line2->data->prefix); + STRCMP_EQUAL(NULL, line2->data->prefix); LONGS_EQUAL(0, line2->data->prefix_length); STRCMP_EQUAL("message", line2->data->message); gui_line_add (line2); diff --git a/tests/unit/gui/test-gui-nick.cpp b/tests/unit/gui/test-gui-nick.cpp index 33b7d16b0..54259b05e 100644 --- a/tests/unit/gui/test-gui-nick.cpp +++ b/tests/unit/gui/test-gui-nick.cpp @@ -54,16 +54,8 @@ extern char *gui_nick_strdup_for_color (const char *nickname); #define WEE_NICK_STRDUP_FOR_COLOR(__result, __nickname) \ nick = gui_nick_strdup_for_color (__nickname); \ - if (__result) \ - { \ - STRCMP_EQUAL(__result, nick); \ - } \ - else \ - { \ - POINTERS_EQUAL(NULL, nick); \ - } \ - if (nick) \ - free (nick); + STRCMP_EQUAL(__result, nick); \ + free (nick); #define WEE_FIND_COLOR(__result, __nickname, __range, __colors) \ color = gui_nick_find_color_name (__nickname, __range, __colors); \ @@ -320,18 +312,18 @@ TEST(GuiNick, GetForcedColor) config_file_option_set (config_look_nick_color_force, "alice:green;bob:cyan", 1); - POINTERS_EQUAL(NULL, gui_nick_get_forced_color (NULL)); - POINTERS_EQUAL(NULL, gui_nick_get_forced_color ("")); + STRCMP_EQUAL(NULL, gui_nick_get_forced_color (NULL)); + STRCMP_EQUAL(NULL, gui_nick_get_forced_color ("")); - POINTERS_EQUAL(NULL, gui_nick_get_forced_color ("unknown")); + STRCMP_EQUAL(NULL, gui_nick_get_forced_color ("unknown")); STRCMP_EQUAL("green", gui_nick_get_forced_color ("alice")); STRCMP_EQUAL("cyan", gui_nick_get_forced_color ("bob")); - POINTERS_EQUAL(NULL, gui_nick_get_forced_color ("alice2")); - POINTERS_EQUAL(NULL, gui_nick_get_forced_color ("alice_")); - POINTERS_EQUAL(NULL, gui_nick_get_forced_color ("bob2")); - POINTERS_EQUAL(NULL, gui_nick_get_forced_color ("bob_")); + STRCMP_EQUAL(NULL, gui_nick_get_forced_color ("alice2")); + STRCMP_EQUAL(NULL, gui_nick_get_forced_color ("alice_")); + STRCMP_EQUAL(NULL, gui_nick_get_forced_color ("bob2")); + STRCMP_EQUAL(NULL, gui_nick_get_forced_color ("bob_")); config_file_option_reset (config_look_nick_color_force, 1); } diff --git a/tests/unit/gui/test-gui-nicklist.cpp b/tests/unit/gui/test-gui-nicklist.cpp index 59869bce6..4553e05e3 100644 --- a/tests/unit/gui/test-gui-nicklist.cpp +++ b/tests/unit/gui/test-gui-nicklist.cpp @@ -340,8 +340,8 @@ TEST(GuiNicklist, AddNick) POINTERS_EQUAL(group2, nick3->group); STRCMP_EQUAL("nick3", nick3->name); STRCMP_EQUAL("yellow", nick3->color); - POINTERS_EQUAL(NULL, nick3->prefix); - POINTERS_EQUAL(NULL, nick3->prefix_color); + STRCMP_EQUAL(NULL, nick3->prefix); + STRCMP_EQUAL(NULL, nick3->prefix_color); LONGS_EQUAL(0, nick3->visible); POINTERS_EQUAL(nick1, nick3->prev_nick); POINTERS_EQUAL(NULL, nick3->next_nick); @@ -354,8 +354,8 @@ TEST(GuiNicklist, AddNick) POINTERS_EQUAL(group2, nick2->group); STRCMP_EQUAL("nick2", nick2->name); STRCMP_EQUAL("lightblue", nick2->color); - POINTERS_EQUAL(NULL, nick2->prefix); - POINTERS_EQUAL(NULL, nick2->prefix_color); + STRCMP_EQUAL(NULL, nick2->prefix); + STRCMP_EQUAL(NULL, nick2->prefix_color); LONGS_EQUAL(0, nick2->visible); POINTERS_EQUAL(nick1, nick2->prev_nick); POINTERS_EQUAL(nick3, nick2->next_nick); @@ -513,7 +513,7 @@ TEST(GuiNicklist, GetGroupStart) const char *group1 = "group1"; const char *group2 = "01|group2"; - POINTERS_EQUAL(NULL, gui_nicklist_get_group_start (NULL)); + STRCMP_EQUAL(NULL, gui_nicklist_get_group_start (NULL)); STRCMP_EQUAL(group_empty, gui_nicklist_get_group_start (group_empty)); STRCMP_EQUAL(group1, gui_nicklist_get_group_start (group1)); STRCMP_EQUAL(group2 + 3, gui_nicklist_get_group_start (group2)); @@ -652,15 +652,15 @@ TEST(GuiNicklist, GroupGetString) group = gui_nicklist_add_group (buffer, NULL, "group", "blue", 1); CHECK(group); - POINTERS_EQUAL(NULL, gui_nicklist_group_get_string (buffer, NULL, NULL)); - POINTERS_EQUAL(NULL, gui_nicklist_group_get_string (buffer, NULL, "")); - POINTERS_EQUAL(NULL, gui_nicklist_group_get_string (buffer, NULL, "zzz")); - POINTERS_EQUAL(NULL, gui_nicklist_group_get_string (buffer, buffer->nicklist_root, "")); - POINTERS_EQUAL(NULL, gui_nicklist_group_get_string (buffer, buffer->nicklist_root, "zzz")); + STRCMP_EQUAL(NULL, gui_nicklist_group_get_string (buffer, NULL, NULL)); + STRCMP_EQUAL(NULL, gui_nicklist_group_get_string (buffer, NULL, "")); + STRCMP_EQUAL(NULL, gui_nicklist_group_get_string (buffer, NULL, "zzz")); + STRCMP_EQUAL(NULL, gui_nicklist_group_get_string (buffer, buffer->nicklist_root, "")); + STRCMP_EQUAL(NULL, gui_nicklist_group_get_string (buffer, buffer->nicklist_root, "zzz")); STRCMP_EQUAL("root", gui_nicklist_group_get_string (buffer, buffer->nicklist_root, "name")); STRCMP_EQUAL("group", gui_nicklist_group_get_string (buffer, group, "name")); - POINTERS_EQUAL(NULL, gui_nicklist_group_get_string (buffer, buffer->nicklist_root, "color")); + STRCMP_EQUAL(NULL, gui_nicklist_group_get_string (buffer, buffer->nicklist_root, "color")); STRCMP_EQUAL("blue", gui_nicklist_group_get_string (buffer, group, "color")); gui_buffer_close (buffer); diff --git a/tests/unit/plugins/alias/test-alias.cpp b/tests/unit/plugins/alias/test-alias.cpp index aaf7cea06..66c200e2b 100644 --- a/tests/unit/plugins/alias/test-alias.cpp +++ b/tests/unit/plugins/alias/test-alias.cpp @@ -85,9 +85,9 @@ TEST(Alias, ReplaceArgs) { char *str; - POINTERS_EQUAL(NULL, alias_replace_args (NULL, NULL)); - POINTERS_EQUAL(NULL, alias_replace_args (NULL, "")); - POINTERS_EQUAL(NULL, alias_replace_args ("", NULL)); + STRCMP_EQUAL(NULL, alias_replace_args (NULL, NULL)); + STRCMP_EQUAL(NULL, alias_replace_args (NULL, "")); + STRCMP_EQUAL(NULL, alias_replace_args ("", NULL)); WEE_TEST_STR("", alias_replace_args ("", "")); WEE_TEST_STR("", alias_replace_args ("", "abc def")); diff --git a/tests/unit/plugins/irc/test-irc-batch.cpp b/tests/unit/plugins/irc/test-irc-batch.cpp index 5d25cecb6..4b8d90b15 100644 --- a/tests/unit/plugins/irc/test-irc-batch.cpp +++ b/tests/unit/plugins/irc/test-irc-batch.cpp @@ -135,9 +135,9 @@ TEST(IrcBatch, StartBatch) CHECK(batch); POINTERS_EQUAL(batch, server->batches); STRCMP_EQUAL("ref", batch->reference); - POINTERS_EQUAL(NULL, batch->parent_ref); + STRCMP_EQUAL(NULL, batch->parent_ref); STRCMP_EQUAL("type", batch->type); - POINTERS_EQUAL(NULL, batch->parameters); + STRCMP_EQUAL(NULL, batch->parameters); POINTERS_EQUAL(NULL, batch->tags); CHECK(batch->start_time > 0); POINTERS_EQUAL(NULL, batch->messages); diff --git a/tests/unit/plugins/irc/test-irc-color.cpp b/tests/unit/plugins/irc/test-irc-color.cpp index e5aba95e6..cb6f46c9e 100644 --- a/tests/unit/plugins/irc/test-irc-color.cpp +++ b/tests/unit/plugins/irc/test-irc-color.cpp @@ -215,8 +215,8 @@ TEST(IrcColor, Decode) char string[1024], *decoded; /* NULL/empty string */ - POINTERS_EQUAL(NULL, irc_color_decode (NULL, 0)); - POINTERS_EQUAL(NULL, irc_color_decode (NULL, 1)); + STRCMP_EQUAL(NULL, irc_color_decode (NULL, 0)); + STRCMP_EQUAL(NULL, irc_color_decode (NULL, 1)); WEE_CHECK_DECODE("", "", 0); WEE_CHECK_DECODE("", "", 1); @@ -368,8 +368,8 @@ TEST(IrcColor, Encode) char string[1024], *encoded; /* NULL/empty string */ - POINTERS_EQUAL(NULL, irc_color_encode (NULL, 0)); - POINTERS_EQUAL(NULL, irc_color_encode (NULL, 1)); + STRCMP_EQUAL(NULL, irc_color_encode (NULL, 0)); + STRCMP_EQUAL(NULL, irc_color_encode (NULL, 1)); WEE_CHECK_ENCODE("", "", 0); WEE_CHECK_ENCODE("", "", 1); @@ -491,8 +491,8 @@ TEST(IrcColor, DecodeAnsi) char string[1024], *decoded; /* NULL/empty string */ - POINTERS_EQUAL(NULL, irc_color_decode_ansi (NULL, 0)); - POINTERS_EQUAL(NULL, irc_color_decode_ansi (NULL, 1)); + STRCMP_EQUAL(NULL, irc_color_decode_ansi (NULL, 0)); + STRCMP_EQUAL(NULL, irc_color_decode_ansi (NULL, 1)); WEE_CHECK_DECODE_ANSI ("", "", 0); WEE_CHECK_DECODE_ANSI ("", "", 1); @@ -642,7 +642,7 @@ TEST(IrcColor, DecodeAnsi) TEST(IrcColor, ForTags) { - POINTERS_EQUAL(NULL, irc_color_for_tags (NULL)); + STRCMP_EQUAL(NULL, irc_color_for_tags (NULL)); STRCMP_EQUAL("", irc_color_for_tags ("")); STRCMP_EQUAL("test", irc_color_for_tags ("test")); diff --git a/tests/unit/plugins/irc/test-irc-info.cpp b/tests/unit/plugins/irc/test-irc-info.cpp index d949b8315..ce3943b47 100644 --- a/tests/unit/plugins/irc/test-irc-info.cpp +++ b/tests/unit/plugins/irc/test-irc-info.cpp @@ -57,7 +57,7 @@ TEST(IrcInfo, CreateStringWithPointer) str = NULL; irc_info_create_string_with_pointer (&str, NULL); - POINTERS_EQUAL(NULL, str); + STRCMP_EQUAL(NULL, str); str = strdup ("test"); irc_info_create_string_with_pointer (&str, (void *)0x1234abcd); @@ -230,9 +230,9 @@ TEST(IrcInfo, InfoIrcBufferCb) channel_pv = irc_channel_new (server, IRC_CHANNEL_TYPE_PRIVATE, "bob", 1, 0); CHECK(channel_pv); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "irc_buffer", NULL)); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "irc_buffer", "")); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "irc_buffer", "xxx")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "irc_buffer", NULL)); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "irc_buffer", "")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "irc_buffer", "xxx")); snprintf (str_pointer, sizeof (str_pointer), "%p", server->buffer); WEE_TEST_STR(str_pointer, hook_info_get (NULL, "irc_buffer", "local")); @@ -240,7 +240,7 @@ TEST(IrcInfo, InfoIrcBufferCb) snprintf (str_pointer, sizeof (str_pointer), "%p", channel->buffer); WEE_TEST_STR(str_pointer, hook_info_get (NULL, "irc_buffer", "local,#test")); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "irc_buffer", "local,#xxx")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "irc_buffer", "local,#xxx")); snprintf (str_pointer, sizeof (str_pointer), "%p", channel->buffer); WEE_TEST_STR(str_pointer, hook_info_get (NULL, "irc_buffer", "local,#test,bob")); @@ -755,7 +755,7 @@ TEST(IrcInfo, InfolistIrcNotifyCb) STRCMP_EQUAL("bob", infolist_string (infolist, "nick")); LONGS_EQUAL(1, infolist_integer (infolist, "check_away")); LONGS_EQUAL(-1, infolist_integer (infolist, "is_on_server")); - POINTERS_EQUAL(NULL, infolist_string (infolist, "away_message")); + STRCMP_EQUAL(NULL, infolist_string (infolist, "away_message")); CHECK(infolist_next (infolist)); POINTERS_EQUAL(server, infolist_pointer (infolist, "server")); @@ -763,7 +763,7 @@ TEST(IrcInfo, InfolistIrcNotifyCb) STRCMP_EQUAL("carol", infolist_string (infolist, "nick")); LONGS_EQUAL(1, infolist_integer (infolist, "check_away")); LONGS_EQUAL(-1, infolist_integer (infolist, "is_on_server")); - POINTERS_EQUAL(NULL, infolist_string (infolist, "away_message")); + STRCMP_EQUAL(NULL, infolist_string (infolist, "away_message")); POINTERS_EQUAL(NULL, infolist_next (infolist)); @@ -778,7 +778,7 @@ TEST(IrcInfo, InfolistIrcNotifyCb) STRCMP_EQUAL("bob", infolist_string (infolist, "nick")); LONGS_EQUAL(1, infolist_integer (infolist, "check_away")); LONGS_EQUAL(-1, infolist_integer (infolist, "is_on_server")); - POINTERS_EQUAL(NULL, infolist_string (infolist, "away_message")); + STRCMP_EQUAL(NULL, infolist_string (infolist, "away_message")); CHECK(infolist_next (infolist)); POINTERS_EQUAL(server, infolist_pointer (infolist, "server")); @@ -786,7 +786,7 @@ TEST(IrcInfo, InfolistIrcNotifyCb) STRCMP_EQUAL("carol", infolist_string (infolist, "nick")); LONGS_EQUAL(1, infolist_integer (infolist, "check_away")); LONGS_EQUAL(-1, infolist_integer (infolist, "is_on_server")); - POINTERS_EQUAL(NULL, infolist_string (infolist, "away_message")); + STRCMP_EQUAL(NULL, infolist_string (infolist, "away_message")); POINTERS_EQUAL(NULL, infolist_next (infolist)); @@ -808,7 +808,7 @@ TEST(IrcInfo, InfolistIrcNotifyCb) STRCMP_EQUAL("carol", infolist_string (infolist, "nick")); LONGS_EQUAL(1, infolist_integer (infolist, "check_away")); LONGS_EQUAL(-1, infolist_integer (infolist, "is_on_server")); - POINTERS_EQUAL(NULL, infolist_string (infolist, "away_message")); + STRCMP_EQUAL(NULL, infolist_string (infolist, "away_message")); POINTERS_EQUAL(NULL, infolist_next (infolist)); diff --git a/tests/unit/plugins/irc/test-irc-join.cpp b/tests/unit/plugins/irc/test-irc-join.cpp index 59d35cd43..ddaa57091 100644 --- a/tests/unit/plugins/irc/test-irc-join.cpp +++ b/tests/unit/plugins/irc/test-irc-join.cpp @@ -43,70 +43,30 @@ extern int irc_join_compare_join_channel (struct t_irc_server *server, #define WEE_CHECK_ADD_CHANNEL(__result, __join, __channel, __key) \ str = irc_join_add_channel (NULL, __join, __channel, __key); \ - if (__result == NULL) \ - { \ - POINTERS_EQUAL(NULL, str); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result, str); \ - } \ - if (str) \ - free (str); + STRCMP_EQUAL(__result, str); \ + free (str); #define WEE_CHECK_ADD_CHANNELS(__result, __join, __join2) \ str = irc_join_add_channels (NULL, __join, __join2); \ - if (__result == NULL) \ - { \ - POINTERS_EQUAL(NULL, str); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result, str); \ - } \ - if (str) \ - free (str); + STRCMP_EQUAL(__result, str); \ + free (str); #define WEE_CHECK_REMOVE_CHANNEL(__result, __join, __channel) \ str = irc_join_remove_channel (NULL, __join, __channel); \ - if (__result == NULL) \ - { \ - POINTERS_EQUAL(NULL, str); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result, str); \ - } \ - if (str) \ - free (str); + STRCMP_EQUAL(__result, str); \ + free (str); #define WEE_CHECK_RENAME_CHANNEL(__result, __join, __channel, \ __new_channel) \ str = irc_join_rename_channel (NULL, __join, __channel, \ __new_channel); \ - if (__result == NULL) \ - { \ - POINTERS_EQUAL(NULL, str); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result, str); \ - } \ - if (str) \ - free (str); + STRCMP_EQUAL(__result, str); \ + free (str); #define WEE_CHECK_SORT_CHANNELS(__result, __join) \ str = irc_join_sort_channels (NULL, __join, IRC_JOIN_SORT_ALPHA); \ - if (__result == NULL) \ - { \ - POINTERS_EQUAL(NULL, str); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result, str); \ - } \ - if (str) \ - free (str); + STRCMP_EQUAL(__result, str); \ + free (str); TEST_GROUP(IrcJoin) { @@ -211,7 +171,7 @@ TEST(IrcJoin, SplitBuildString) channels = (struct t_irc_join_channel **)arraylist->data; CHECK(channels[0]); STRCMP_EQUAL("#xyz", channels[0]->name); - POINTERS_EQUAL(NULL, channels[0]->key); + STRCMP_EQUAL(NULL, channels[0]->key); autojoin = irc_join_build_string (arraylist); STRCMP_EQUAL("#xyz", autojoin); free (autojoin); @@ -224,9 +184,9 @@ TEST(IrcJoin, SplitBuildString) channels = (struct t_irc_join_channel **)arraylist->data; CHECK(channels[0]); STRCMP_EQUAL("#xyz", channels[0]->name); - POINTERS_EQUAL(NULL, channels[0]->key); + STRCMP_EQUAL(NULL, channels[0]->key); STRCMP_EQUAL("#abc", channels[1]->name); - POINTERS_EQUAL(NULL, channels[1]->key); + STRCMP_EQUAL(NULL, channels[1]->key); autojoin = irc_join_build_string (arraylist); STRCMP_EQUAL("#xyz,#abc", autojoin); free (autojoin); @@ -260,7 +220,7 @@ TEST(IrcJoin, SplitBuildString) STRCMP_EQUAL("#abc", channels[1]->name); STRCMP_EQUAL("key_abc", channels[1]->key); STRCMP_EQUAL("#def", channels[2]->name); - POINTERS_EQUAL(NULL, channels[2]->key); + STRCMP_EQUAL(NULL, channels[2]->key); autojoin = irc_join_build_string (arraylist); STRCMP_EQUAL("#xyz,#abc,#def key_xyz,key_abc", autojoin); free (autojoin); @@ -273,7 +233,7 @@ TEST(IrcJoin, SplitBuildString) channels = (struct t_irc_join_channel **)arraylist->data; CHECK(channels[0]); STRCMP_EQUAL("#XYZ", channels[0]->name); - POINTERS_EQUAL(NULL, channels[0]->key); + STRCMP_EQUAL(NULL, channels[0]->key); autojoin = irc_join_build_string (arraylist); STRCMP_EQUAL("#XYZ", autojoin); free (autojoin); @@ -286,10 +246,10 @@ TEST(IrcJoin, SplitBuildString) channels = (struct t_irc_join_channel **)arraylist->data; CHECK(channels[0]); STRCMP_EQUAL("#abc", channels[0]->name); - POINTERS_EQUAL(NULL, channels[0]->key); + STRCMP_EQUAL(NULL, channels[0]->key); CHECK(channels[1]); STRCMP_EQUAL("#def", channels[1]->name); - POINTERS_EQUAL(NULL, channels[1]->key); + STRCMP_EQUAL(NULL, channels[1]->key); autojoin = irc_join_build_string (arraylist); STRCMP_EQUAL("#abc,#def", autojoin); free (autojoin); @@ -306,7 +266,7 @@ TEST(IrcJoin, SplitBuildString) channels = (struct t_irc_join_channel **)arraylist->data; CHECK(channels[0]); STRCMP_EQUAL("#CHAN{A}~", channels[0]->name); - POINTERS_EQUAL(NULL, channels[0]->key); + STRCMP_EQUAL(NULL, channels[0]->key); autojoin = irc_join_build_string (arraylist); STRCMP_EQUAL("#CHAN{A}~", autojoin); free (autojoin); @@ -324,9 +284,9 @@ TEST(IrcJoin, SplitBuildString) channels = (struct t_irc_join_channel **)arraylist->data; CHECK(channels[0]); STRCMP_EQUAL("#chan[a]^", channels[0]->name); - POINTERS_EQUAL(NULL, channels[0]->key); + STRCMP_EQUAL(NULL, channels[0]->key); STRCMP_EQUAL("#CHAN{A}~", channels[1]->name); - POINTERS_EQUAL(NULL, channels[1]->key); + STRCMP_EQUAL(NULL, channels[1]->key); autojoin = irc_join_build_string (arraylist); STRCMP_EQUAL("#chan[a]^,#CHAN{A}~", autojoin); free (autojoin); @@ -347,11 +307,11 @@ TEST(IrcJoin, SplitBuildString) STRCMP_EQUAL("#xyz", channels[0]->name); STRCMP_EQUAL("key_xyz", channels[0]->key); STRCMP_EQUAL("#abc", channels[1]->name); - POINTERS_EQUAL(NULL, channels[1]->key); + STRCMP_EQUAL(NULL, channels[1]->key); STRCMP_EQUAL("#CHAN{A}~", channels[2]->name); - POINTERS_EQUAL(NULL, channels[2]->key); + STRCMP_EQUAL(NULL, channels[2]->key); STRCMP_EQUAL("#def", channels[3]->name); - POINTERS_EQUAL(NULL, channels[3]->key); + STRCMP_EQUAL(NULL, channels[3]->key); autojoin = irc_join_build_string (arraylist); STRCMP_EQUAL("#xyz,#abc,#CHAN{A}~,#def key_xyz", autojoin); free (autojoin); @@ -377,13 +337,13 @@ TEST(IrcJoin, SplitBuildString) STRCMP_EQUAL("#xyz", channels[0]->name); STRCMP_EQUAL("key_xyz", channels[0]->key); STRCMP_EQUAL("#CHAN{A}~", channels[1]->name); - POINTERS_EQUAL(NULL, channels[1]->key); + STRCMP_EQUAL(NULL, channels[1]->key); STRCMP_EQUAL("#def", channels[2]->name); - POINTERS_EQUAL(NULL, channels[2]->key); + STRCMP_EQUAL(NULL, channels[2]->key); STRCMP_EQUAL("#abc", channels[3]->name); - POINTERS_EQUAL(NULL, channels[3]->key); + STRCMP_EQUAL(NULL, channels[3]->key); STRCMP_EQUAL("#zzz", channels[4]->name); - POINTERS_EQUAL(NULL, channels[4]->key); + STRCMP_EQUAL(NULL, channels[4]->key); autojoin = irc_join_build_string (arraylist); STRCMP_EQUAL("#xyz,#CHAN{A}~,#def,#abc,#zzz key_xyz", autojoin); free (autojoin); diff --git a/tests/unit/plugins/irc/test-irc-list.cpp b/tests/unit/plugins/irc/test-irc-list.cpp index 92a10bc9f..418b45aff 100644 --- a/tests/unit/plugins/irc/test-irc-list.cpp +++ b/tests/unit/plugins/irc/test-irc-list.cpp @@ -287,8 +287,8 @@ TEST(IrcList, Alloc) POINTERS_EQUAL(NULL, list->channels); POINTERS_EQUAL(NULL, list->filter_channels); LONGS_EQUAL(0, list->name_max_length); - POINTERS_EQUAL(NULL, list->filter); - POINTERS_EQUAL(NULL, list->sort); + STRCMP_EQUAL(NULL, list->filter); + STRCMP_EQUAL(NULL, list->sort); POINTERS_EQUAL(NULL, list->sort_fields); LONGS_EQUAL(0, list->sort_fields_count); LONGS_EQUAL(0, list->selected_line); diff --git a/tests/unit/plugins/irc/test-irc-message.cpp b/tests/unit/plugins/irc/test-irc-message.cpp index e110ffa99..4b408250b 100644 --- a/tests/unit/plugins/irc/test-irc-message.cpp +++ b/tests/unit/plugins/irc/test-irc-message.cpp @@ -185,78 +185,15 @@ extern "C" &pos_command, &pos_arguments, \ &pos_channel, &pos_text); \ \ - if (__tags == NULL) \ - { \ - POINTERS_EQUAL(NULL, tags); \ - } \ - else \ - { \ - STRCMP_EQUAL(__tags, tags); \ - } \ - if (__message_without_tags == NULL) \ - { \ - POINTERS_EQUAL(NULL, message_without_tags); \ - } \ - else \ - { \ - STRCMP_EQUAL(__message_without_tags, message_without_tags); \ - } \ - if (__nick == NULL) \ - { \ - POINTERS_EQUAL(NULL, nick); \ - } \ - else \ - { \ - STRCMP_EQUAL(__nick, nick); \ - } \ - if (__user == NULL) \ - { \ - POINTERS_EQUAL(NULL, user); \ - } \ - else \ - { \ - STRCMP_EQUAL(__user, user); \ - } \ - if (__host == NULL) \ - { \ - POINTERS_EQUAL(NULL, host); \ - } \ - else \ - { \ - STRCMP_EQUAL(__host, host); \ - } \ - if (__command == NULL) \ - { \ - POINTERS_EQUAL(NULL, command); \ - } \ - else \ - { \ - STRCMP_EQUAL(__command, command); \ - } \ - if (__channel == NULL) \ - { \ - POINTERS_EQUAL(NULL, channel); \ - } \ - else \ - { \ - STRCMP_EQUAL(__channel, channel); \ - } \ - if (__arguments == NULL) \ - { \ - POINTERS_EQUAL(NULL, arguments); \ - } \ - else \ - { \ - STRCMP_EQUAL(__arguments, arguments); \ - } \ - if (__text == NULL) \ - { \ - POINTERS_EQUAL(NULL, text); \ - } \ - else \ - { \ - STRCMP_EQUAL(__text, text); \ - } \ + STRCMP_EQUAL(__tags, tags); \ + STRCMP_EQUAL(__message_without_tags, message_without_tags); \ + STRCMP_EQUAL(__nick, nick); \ + STRCMP_EQUAL(__user, user); \ + STRCMP_EQUAL(__host, host); \ + STRCMP_EQUAL(__command, command); \ + STRCMP_EQUAL(__channel, channel); \ + STRCMP_EQUAL(__arguments, arguments); \ + STRCMP_EQUAL(__text, text); \ if (__params == NULL) \ { \ POINTERS_EQUAL(NULL, params); \ @@ -278,7 +215,7 @@ extern "C" STRCMP_EQUAL(ptr_params[i], params[i]); \ } \ } \ - POINTERS_EQUAL(NULL, params[i]); \ + STRCMP_EQUAL(NULL, params[i]); \ } \ LONGS_EQUAL(__pos_command, pos_command); \ LONGS_EQUAL(__pos_arguments, pos_arguments); \ @@ -332,7 +269,7 @@ TEST(IrcMessage, ParseParams) LONGS_EQUAL(1, num_params); CHECK(params); STRCMP_EQUAL("", params[0]); - POINTERS_EQUAL(NULL, params[1]); + STRCMP_EQUAL(NULL, params[1]); string_free_split (params); /* empty trailing parameter */ @@ -342,7 +279,7 @@ TEST(IrcMessage, ParseParams) LONGS_EQUAL(1, num_params); CHECK(params); STRCMP_EQUAL("", params[0]); - POINTERS_EQUAL(NULL, params[1]); + STRCMP_EQUAL(NULL, params[1]); string_free_split (params); /* single parameter */ @@ -352,7 +289,7 @@ TEST(IrcMessage, ParseParams) LONGS_EQUAL(1, num_params); CHECK(params); STRCMP_EQUAL("param1", params[0]); - POINTERS_EQUAL(NULL, params[1]); + STRCMP_EQUAL(NULL, params[1]); string_free_split (params); /* single parameter with trailing space */ @@ -362,7 +299,7 @@ TEST(IrcMessage, ParseParams) LONGS_EQUAL(1, num_params); CHECK(params); STRCMP_EQUAL("param1", params[0]); - POINTERS_EQUAL(NULL, params[1]); + STRCMP_EQUAL(NULL, params[1]); string_free_split (params); /* two parameters */ @@ -373,7 +310,7 @@ TEST(IrcMessage, ParseParams) CHECK(params); STRCMP_EQUAL("param1", params[0]); STRCMP_EQUAL("param2", params[1]); - POINTERS_EQUAL(NULL, params[2]); + STRCMP_EQUAL(NULL, params[2]); string_free_split (params); /* trailing spaces */ @@ -384,7 +321,7 @@ TEST(IrcMessage, ParseParams) CHECK(params); STRCMP_EQUAL("param1", params[0]); STRCMP_EQUAL("param2", params[1]); - POINTERS_EQUAL(NULL, params[2]); + STRCMP_EQUAL(NULL, params[2]); string_free_split (params); /* leading and trailing spaces */ @@ -395,7 +332,7 @@ TEST(IrcMessage, ParseParams) CHECK(params); STRCMP_EQUAL("param1", params[0]); STRCMP_EQUAL("param2", params[1]); - POINTERS_EQUAL(NULL, params[2]); + STRCMP_EQUAL(NULL, params[2]); string_free_split (params); /* empty trailing parameter */ @@ -406,7 +343,7 @@ TEST(IrcMessage, ParseParams) CHECK(params); STRCMP_EQUAL("param1", params[0]); STRCMP_EQUAL("", params[1]); - POINTERS_EQUAL(NULL, params[2]); + STRCMP_EQUAL(NULL, params[2]); string_free_split (params); /* trailing parameter */ @@ -417,7 +354,7 @@ TEST(IrcMessage, ParseParams) CHECK(params); STRCMP_EQUAL("param1", params[0]); STRCMP_EQUAL("trailing params ", params[1]); - POINTERS_EQUAL(NULL, params[2]); + STRCMP_EQUAL(NULL, params[2]); string_free_split (params); /* trailing parameter with colon inside */ @@ -431,7 +368,7 @@ TEST(IrcMessage, ParseParams) STRCMP_EQUAL("param2", params[1]); STRCMP_EQUAL("param3", params[2]); STRCMP_EQUAL("trailing params :here ", params[3]); - POINTERS_EQUAL(NULL, params[4]); + STRCMP_EQUAL(NULL, params[4]); string_free_split (params); /* with params set to NULL */ @@ -453,7 +390,7 @@ TEST(IrcMessage, ParseParams) STRCMP_EQUAL("param2", params[1]); STRCMP_EQUAL("param3", params[2]); STRCMP_EQUAL("trailing params :here ", params[3]); - POINTERS_EQUAL(NULL, params[4]); + STRCMP_EQUAL(NULL, params[4]); string_free_split (params); } @@ -773,10 +710,10 @@ TEST(IrcMessage, ParseToHashtable) CHECK(hashtable); STRCMP_EQUAL("", (const char *)hashtable_get (hashtable, "tags")); - POINTERS_EQUAL(NULL, - (const char *)hashtable_get (hashtable, "tag_time")); - POINTERS_EQUAL(NULL, - (const char *)hashtable_get (hashtable, "tag_tag2")); + STRCMP_EQUAL(NULL, + (const char *)hashtable_get (hashtable, "tag_time")); + STRCMP_EQUAL(NULL, + (const char *)hashtable_get (hashtable, "tag_tag2")); STRCMP_EQUAL("PING :arguments here", (const char *)hashtable_get (hashtable, "message_without_tags")); STRCMP_EQUAL("", @@ -867,7 +804,7 @@ TEST(IrcMessage, ParseCapValue) CHECK(hashtable); LONGS_EQUAL(3, hashtable->items_count); STRCMP_EQUAL("value1", (const char *)hashtable_get (hashtable, "key1")); - POINTERS_EQUAL(NULL, (const char *)hashtable_get (hashtable, "key2")); + STRCMP_EQUAL(NULL, (const char *)hashtable_get (hashtable, "key2")); STRCMP_EQUAL("123", (const char *)hashtable_get (hashtable, "key3")); hashtable_free (hashtable); } @@ -977,9 +914,9 @@ TEST(IrcMessage, ConvertCharset) hook = hook_modifier (NULL, "convert_irc_charset", &convert_irc_charset_cb, NULL, NULL); - POINTERS_EQUAL(NULL, - irc_message_convert_charset (NULL, 0, - "convert_irc_charset", NULL)); + STRCMP_EQUAL(NULL, + irc_message_convert_charset (NULL, 0, + "convert_irc_charset", NULL)); str = irc_message_convert_charset ("PRIVMSG #channel :this is a test", 18, "convert_irc_charset", NULL); @@ -996,7 +933,7 @@ TEST(IrcMessage, ConvertCharset) TEST(IrcMessage, GetNickFromHost) { - POINTERS_EQUAL(NULL, irc_message_get_nick_from_host (NULL)); + STRCMP_EQUAL(NULL, irc_message_get_nick_from_host (NULL)); STRCMP_EQUAL("", irc_message_get_nick_from_host ("")); STRCMP_EQUAL("nick", irc_message_get_nick_from_host ("nick")); STRCMP_EQUAL("nick", irc_message_get_nick_from_host ("nick ")); @@ -1017,7 +954,7 @@ TEST(IrcMessage, GetNickFromHost) TEST(IrcMessage, GetAddressFromHost) { - POINTERS_EQUAL(NULL, irc_message_get_address_from_host (NULL)); + STRCMP_EQUAL(NULL, irc_message_get_address_from_host (NULL)); STRCMP_EQUAL("", irc_message_get_address_from_host ("")); STRCMP_EQUAL("", irc_message_get_address_from_host ("host")); STRCMP_EQUAL("", irc_message_get_address_from_host ("host ")); diff --git a/tests/unit/plugins/irc/test-irc-mode.cpp b/tests/unit/plugins/irc/test-irc-mode.cpp index a026fc050..c2b62186d 100644 --- a/tests/unit/plugins/irc/test-irc-mode.cpp +++ b/tests/unit/plugins/irc/test-irc-mode.cpp @@ -28,16 +28,8 @@ extern "C" #define WEE_CHECK_GET_ARGS(__result, __arguments) \ str = irc_mode_get_arguments (__arguments); \ - if (__result == NULL) \ - { \ - POINTERS_EQUAL(NULL, str); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result, str); \ - } \ - if (str) \ - free (str); + STRCMP_EQUAL(__result, str); \ + free (str); TEST_GROUP(IrcMode) { diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index 1a93d41ad..ae7632796 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -81,15 +81,7 @@ extern char *irc_protocol_cap_to_enable (const char *capabilities, ctxt.server = __server; \ ctxt.command = (char *)__command; \ ctxt.tags = __tags; \ - if (__result == NULL) \ - { \ - POINTERS_EQUAL(NULL, irc_protocol_tags (&ctxt, __extra_tags)); \ - } \ - else \ - { \ - STRCMP_EQUAL(__result, irc_protocol_tags (&ctxt, \ - __extra_tags)); \ - } + STRCMP_EQUAL(__result, irc_protocol_tags (&ctxt, __extra_tags)); #define WEE_CHECK_CAP_TO_ENABLE(__result, __string, __sasl_requested) \ str = irc_protocol_cap_to_enable (__string, __sasl_requested); \ @@ -1260,41 +1252,41 @@ TEST(IrcProtocolWithServer, account_without_account_notify_cap) ptr_nick = ptr_server->channels->last_nick; - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); /* not enough parameters */ RECV(":bob!user@host ACCOUNT"); CHECK_ERROR_PARAMS("account", 0, 1); - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); RECV(":bob!user@host ACCOUNT *"); CHECK_CHAN("--", "bob has unidentified", "irc_account,irc_smart_filter,nick_bob,host_user@host,log3"); CHECK_PV("bob", "--", "bob has unidentified", "irc_account,nick_bob,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); RECV(":bob!user@host ACCOUNT :*"); CHECK_CHAN("--", "bob has unidentified", "irc_account,irc_smart_filter,nick_bob,host_user@host,log3"); CHECK_PV("bob", "--", "bob has unidentified", "irc_account,nick_bob,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); RECV(":bob!user@host ACCOUNT new_account"); CHECK_CHAN("--", "bob has identified as new_account", "irc_account,irc_smart_filter,nick_bob,host_user@host,log3"); CHECK_PV("bob", "--", "bob has identified as new_account", "irc_account,nick_bob,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); RECV(":bob!user@host ACCOUNT :new_account"); CHECK_CHAN("--", "bob has identified as new_account", "irc_account,irc_smart_filter,nick_bob,host_user@host,log3"); CHECK_PV("bob", "--", "bob has identified as new_account", "irc_account,nick_bob,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); } /* @@ -1313,7 +1305,7 @@ TEST(IrcProtocolWithServer, account_with_account_notify_cap) ptr_nick = ptr_server->channels->nicks; - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); RECV(":alice!user@host ACCOUNT new_account"); CHECK_CHAN("--", "alice has identified as new_account", @@ -1328,7 +1320,7 @@ TEST(IrcProtocolWithServer, account_with_account_notify_cap) RECV(":alice!user@host ACCOUNT *"); CHECK_CHAN("--", "alice has unidentified", "irc_account,nick_alice,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); RECV(":alice!user@host ACCOUNT :new_account3"); CHECK_CHAN("--", "alice has identified as new_account3", @@ -1338,7 +1330,7 @@ TEST(IrcProtocolWithServer, account_with_account_notify_cap) RECV(":alice!user@host ACCOUNT :*"); CHECK_CHAN("--", "alice has unidentified", "irc_account,nick_alice,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); hashtable_remove (ptr_server->cap_list, "account-notify"); } @@ -1576,9 +1568,9 @@ TEST(IrcProtocolWithServer, batch_with_batch_cap) CHECK_NO_MSG; ptr_batch = irc_batch_search (ptr_server, "ref"); CHECK(ptr_batch); - POINTERS_EQUAL(NULL, ptr_batch->parent_ref); + STRCMP_EQUAL(NULL, ptr_batch->parent_ref); STRCMP_EQUAL("example", ptr_batch->type); - POINTERS_EQUAL(NULL, ptr_batch->parameters); + STRCMP_EQUAL(NULL, ptr_batch->parameters); POINTERS_EQUAL(NULL, ptr_batch->messages); LONGS_EQUAL(0, ptr_batch->end_received); LONGS_EQUAL(0, ptr_batch->messages_processed); @@ -1610,7 +1602,7 @@ TEST(IrcProtocolWithServer, batch_with_batch_cap) CHECK_NO_MSG; ptr_batch = irc_batch_search (ptr_server, "ref"); CHECK(ptr_batch); - POINTERS_EQUAL(NULL, ptr_batch->parent_ref); + STRCMP_EQUAL(NULL, ptr_batch->parent_ref); STRCMP_EQUAL("example", ptr_batch->type); STRCMP_EQUAL("param1 param2 param3", ptr_batch->parameters); POINTERS_EQUAL(NULL, ptr_batch->messages); @@ -2067,17 +2059,17 @@ TEST(IrcProtocolWithServer, join) LONGS_EQUAL(IRC_CHANNEL_TYPE_CHANNEL, ptr_channel->type); STRCMP_EQUAL("#test", ptr_channel->name); - POINTERS_EQUAL(NULL, ptr_channel->topic); - POINTERS_EQUAL(NULL, ptr_channel->modes); + STRCMP_EQUAL(NULL, ptr_channel->topic); + STRCMP_EQUAL(NULL, ptr_channel->modes); LONGS_EQUAL(0, ptr_channel->limit); - POINTERS_EQUAL(NULL, ptr_channel->key); + STRCMP_EQUAL(NULL, ptr_channel->key); LONGS_EQUAL(0, ptr_channel->checking_whox); - POINTERS_EQUAL(NULL, ptr_channel->away_message); + STRCMP_EQUAL(NULL, ptr_channel->away_message); LONGS_EQUAL(0, ptr_channel->has_quit_server); LONGS_EQUAL(0, ptr_channel->cycle); LONGS_EQUAL(0, ptr_channel->part); LONGS_EQUAL(0, ptr_channel->part); - POINTERS_EQUAL(NULL, ptr_channel->pv_remote_nick_color); + STRCMP_EQUAL(NULL, ptr_channel->pv_remote_nick_color); POINTERS_EQUAL(NULL, ptr_channel->hook_autorejoin); ptr_nick = ptr_channel->nicks; @@ -2090,8 +2082,8 @@ TEST(IrcProtocolWithServer, join) STRCMP_EQUAL(" ", ptr_nick->prefixes); STRCMP_EQUAL(" ", ptr_nick->prefix); LONGS_EQUAL(0, ptr_nick->away); - POINTERS_EQUAL(NULL, ptr_nick->account); - POINTERS_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->realname); CHECK(ptr_nick->color); CHECK(ptr_channel->buffer); @@ -2109,7 +2101,7 @@ TEST(IrcProtocolWithServer, join) STRCMP_EQUAL(" ", ptr_nick->prefixes); STRCMP_EQUAL(" ", ptr_nick->prefix); LONGS_EQUAL(0, ptr_nick->away); - POINTERS_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->account); STRCMP_EQUAL("Bob Name", ptr_nick->realname); CHECK(ptr_nick->color); @@ -2285,7 +2277,7 @@ TEST(IrcProtocolWithServer, mode) ptr_channel = ptr_server->channels; CHECK(ptr_channel); - POINTERS_EQUAL(NULL, ptr_channel->modes); + STRCMP_EQUAL(NULL, ptr_channel->modes); ptr_nick = ptr_channel->nicks; CHECK(ptr_nick); STRCMP_EQUAL("alice", ptr_nick->name); @@ -2302,7 +2294,7 @@ TEST(IrcProtocolWithServer, mode) RECV("MODE #test +nt"); CHECK_ERROR_NICK("mode"); - POINTERS_EQUAL(NULL, ptr_channel->modes); + STRCMP_EQUAL(NULL, ptr_channel->modes); /* channel mode */ RECV(":admin!user@host MODE #test +nt"); @@ -2320,7 +2312,7 @@ TEST(IrcProtocolWithServer, mode) RECV(":admin!user@host MODE #test -t"); CHECK_CHAN("--", "Mode #test [-t] by admin", "irc_mode,nick_admin,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_channel->modes); + STRCMP_EQUAL(NULL, ptr_channel->modes); /* nick mode '@' on channel #test */ RECV(":admin!user@host MODE #test +o alice"); @@ -2351,7 +2343,7 @@ TEST(IrcProtocolWithServer, mode) STRCMP_EQUAL(" ", ptr_nick->prefix); /* nick mode 'i' */ - POINTERS_EQUAL(NULL, ptr_server->nick_modes); + STRCMP_EQUAL(NULL, ptr_server->nick_modes); RECV(":admin!user@host MODE alice +i"); CHECK_SRV("--", "User mode [+i] by admin", "irc_mode,nick_admin,host_user@host,log3"); @@ -3462,7 +3454,7 @@ TEST(IrcProtocolWithServer, setname_without_setname_cap) ptr_nick = ptr_server->channels->nicks; - POINTERS_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick->realname); /* not enough parameters */ RECV(":alice!user@host SETNAME"); @@ -3472,19 +3464,19 @@ TEST(IrcProtocolWithServer, setname_without_setname_cap) RECV("SETNAME :new bob realname"); CHECK_ERROR_NICK("setname"); - POINTERS_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick->realname); /* real name of "bob" has changed */ RECV(":bob!user@host SETNAME :new bob realname "); CHECK_CHAN("--", "bob has changed real name to \"new bob realname \"", "irc_setname,irc_smart_filter,nick_bob,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick->realname); /* self real name has changed */ RECV(":alice!user@host SETNAME :new alice realname "); CHECK_SRV("--", "Your real name has been set to \"new alice realname \"", "irc_setname,nick_alice,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick->realname); } /* @@ -3504,7 +3496,7 @@ TEST(IrcProtocolWithServer, setname_with_setname_cap) ptr_nick = ptr_server->channels->nicks; ptr_nick2 = ptr_server->channels->last_nick; - POINTERS_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick->realname); /* real name of "bob" has changed */ RECV(":bob!user@host SETNAME :new bob realname "); @@ -3592,7 +3584,7 @@ TEST(IrcProtocolWithServer, topic) SRV_INIT_JOIN; ptr_channel = ptr_server->channels; - POINTERS_EQUAL(NULL, ptr_channel->topic); + STRCMP_EQUAL(NULL, ptr_channel->topic); /* not enough parameters */ RECV(":alice!user@host TOPIC"); @@ -3602,7 +3594,7 @@ TEST(IrcProtocolWithServer, topic) RECV("TOPIC #test :new topic"); CHECK_ERROR_NICK("topic"); - POINTERS_EQUAL(NULL, ptr_channel->topic); + STRCMP_EQUAL(NULL, ptr_channel->topic); /* not a channel */ RECV(":alice!user@host TOPIC bob"); @@ -3612,13 +3604,13 @@ TEST(IrcProtocolWithServer, topic) RECV(":alice!user@host TOPIC #test"); CHECK_CHAN("--", "alice has unset topic for #test", "irc_topic,nick_alice,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_channel->topic); + STRCMP_EQUAL(NULL, ptr_channel->topic); /* empty topic (with empty trailing parameter) */ RECV(":alice!user@host TOPIC #test :"); CHECK_CHAN("--", "alice has unset topic for #test", "irc_topic,nick_alice,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_channel->topic); + STRCMP_EQUAL(NULL, ptr_channel->topic); /* new topic */ RECV(":alice!user@host TOPIC #test :new topic "); @@ -3640,7 +3632,7 @@ TEST(IrcProtocolWithServer, topic) "alice has unset topic for #test (old topic: " "\"another new topic \")", "irc_topic,nick_alice,host_user@host,log3"); - POINTERS_EQUAL(NULL, ptr_channel->topic); + STRCMP_EQUAL(NULL, ptr_channel->topic); } /* @@ -3761,14 +3753,14 @@ TEST(IrcProtocolWithServer, 005_empty) { SRV_INIT; - POINTERS_EQUAL(NULL, ptr_server->prefix_modes); - POINTERS_EQUAL(NULL, ptr_server->prefix_chars); + STRCMP_EQUAL(NULL, ptr_server->prefix_modes); + STRCMP_EQUAL(NULL, ptr_server->prefix_chars); RECV(":server 005 alice TEST=A"); CHECK_SRV("--", "TEST=A", "irc_005,irc_numeric,nick_server,log3"); - POINTERS_EQUAL(NULL, ptr_server->prefix_modes); - POINTERS_EQUAL(NULL, ptr_server->prefix_chars); + STRCMP_EQUAL(NULL, ptr_server->prefix_modes); + STRCMP_EQUAL(NULL, ptr_server->prefix_chars); } /* @@ -3780,19 +3772,19 @@ TEST(IrcProtocolWithServer, 005_full) { SRV_INIT; - POINTERS_EQUAL(NULL, ptr_server->prefix_modes); - POINTERS_EQUAL(NULL, ptr_server->prefix_chars); + STRCMP_EQUAL(NULL, ptr_server->prefix_modes); + STRCMP_EQUAL(NULL, ptr_server->prefix_chars); LONGS_EQUAL(0, ptr_server->msg_max_length); LONGS_EQUAL(0, ptr_server->nick_max_length); LONGS_EQUAL(0, ptr_server->user_max_length); LONGS_EQUAL(0, ptr_server->host_max_length); LONGS_EQUAL(0, ptr_server->casemapping); - POINTERS_EQUAL(NULL, ptr_server->chantypes); - POINTERS_EQUAL(NULL, ptr_server->chanmodes); + STRCMP_EQUAL(NULL, ptr_server->chantypes); + STRCMP_EQUAL(NULL, ptr_server->chanmodes); LONGS_EQUAL(0, ptr_server->monitor); LONGS_EQUAL(IRC_SERVER_UTF8MAPPING_NONE, ptr_server->utf8mapping); LONGS_EQUAL(0, ptr_server->utf8only); - POINTERS_EQUAL(NULL, ptr_server->isupport); + STRCMP_EQUAL(NULL, ptr_server->isupport); RECV(":server 005 alice " IRC_MSG_005 " :are supported"); CHECK_SRV("--", IRC_MSG_005 " are supported", @@ -3841,10 +3833,10 @@ TEST(IrcProtocolWithServer, 005_multiple_messages) { SRV_INIT; - POINTERS_EQUAL(NULL, ptr_server->prefix_modes); - POINTERS_EQUAL(NULL, ptr_server->prefix_chars); + STRCMP_EQUAL(NULL, ptr_server->prefix_modes); + STRCMP_EQUAL(NULL, ptr_server->prefix_chars); LONGS_EQUAL(0, ptr_server->host_max_length); - POINTERS_EQUAL(NULL, ptr_server->isupport); + STRCMP_EQUAL(NULL, ptr_server->isupport); RECV(":server 005 alice PREFIX=(ohv)@%+ :are supported"); CHECK_SRV("--", "PREFIX=(ohv)@%+ are supported", @@ -3896,7 +3888,7 @@ TEST(IrcProtocolWithServer, 221) RECV(":server 221 alice"); CHECK_ERROR_PARAMS("221", 1, 2); - POINTERS_EQUAL(NULL, ptr_server->nick_modes); + STRCMP_EQUAL(NULL, ptr_server->nick_modes); RECV(":server 221 alice :+abc"); CHECK_SRV("--", "User mode for alice is [+abc]", @@ -3906,7 +3898,7 @@ TEST(IrcProtocolWithServer, 221) RECV(":server 221 alice :-abc"); CHECK_SRV("--","User mode for alice is [-abc]", "irc_221,irc_numeric,nick_server,log3"); - POINTERS_EQUAL(NULL, ptr_server->nick_modes); + STRCMP_EQUAL(NULL, ptr_server->nick_modes); } /* @@ -4119,11 +4111,11 @@ TEST(IrcProtocolWithServer, 301) RECV(":server 301"); CHECK_ERROR_PARAMS("301", 0, 1); - POINTERS_EQUAL(NULL, ptr_server->channels->away_message); + STRCMP_EQUAL(NULL, ptr_server->channels->away_message); RECV(":server 301 alice bob"); CHECK_NO_MSG; - POINTERS_EQUAL(NULL, ptr_server->channels->away_message); + STRCMP_EQUAL(NULL, ptr_server->channels->away_message); RECV(":server 301 alice bob :I am away "); CHECK_PV("bob", "--", "[bob] is away: I am away ", @@ -4172,7 +4164,7 @@ TEST(IrcProtocolWithServer, 305_306) RECV(":server 306"); CHECK_ERROR_PARAMS("306", 0, 1); - POINTERS_EQUAL(NULL, ptr_server->channels->away_message); + STRCMP_EQUAL(NULL, ptr_server->channels->away_message); RECV(":server 306 alice"); /* now away */ CHECK_NO_MSG; @@ -4432,7 +4424,7 @@ TEST(IrcProtocolWithServer, 324) { SRV_INIT_JOIN; - POINTERS_EQUAL(NULL, ptr_server->channels->modes); + STRCMP_EQUAL(NULL, ptr_server->channels->modes); /* not enough parameters */ RECV(":server 324"); @@ -4446,7 +4438,7 @@ TEST(IrcProtocolWithServer, 324) RECV(":server 324 alice #test"); CHECK_CHAN("--", "Mode #test []", "irc_324,irc_numeric,nick_server,log3"); - POINTERS_EQUAL(NULL, ptr_server->channels->modes); + STRCMP_EQUAL(NULL, ptr_server->channels->modes); } /* @@ -4615,7 +4607,7 @@ TEST(IrcProtocolWithServer, 332) RECV(":server 332 alice"); CHECK_ERROR_PARAMS("332", 1, 2); - POINTERS_EQUAL(NULL, ptr_server->channels->topic); + STRCMP_EQUAL(NULL, ptr_server->channels->topic); RECV(":server 332 alice #test"); CHECK_CHAN("--", "Topic for #test is \"\"", @@ -5054,22 +5046,22 @@ TEST(IrcProtocolWithServer, 352) STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick->away); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick->realname); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 352 alice #test user2 host2 server bob"); CHECK_SRV("--", "[#test] bob (user2@host2) ()", "irc_352,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user2@host2", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 352 alice #test user3 host3 server bob *"); CHECK_SRV("--", "[#test] bob (user3@host3) * ()", "irc_352,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user3@host3", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 352 alice #test user4 host4 server bob * :0 real name 1"); CHECK_SRV("--", "[#test] bob (user4@host4) * 0 (real name 1)", @@ -5116,7 +5108,7 @@ TEST(IrcProtocolWithServer, 352) /* nothing should have changed in the first nick */ STRCMP_EQUAL("user_a@host_a", ptr_nick->host); LONGS_EQUAL(0, ptr_nick->away); - POINTERS_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick->realname); /* channel not found */ RECV(":server 352 alice #xyz user"); @@ -5271,71 +5263,71 @@ TEST(IrcProtocolWithServer, 354) STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick->away); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick->account); - POINTERS_EQUAL(NULL, ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick->realname); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick2->account); + STRCMP_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test"); CHECK_SRV("--", "[#test]", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->account); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test user2"); CHECK_SRV("--", "[#test] user2", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->account); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test user2 :trailing parameter"); CHECK_SRV("--", "[#test] user2 trailing parameter", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->account); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test user2 host2"); CHECK_SRV("--", "[#test] user2 host2", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->account); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test user2 host2 server"); CHECK_SRV("--", "[#test] user2 host2 server", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->account); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test user2 host2 server bob"); CHECK_SRV("--", "[#test] user2 host2 server bob", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->account); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test user2 host2 server bob *"); CHECK_SRV("--", "[#test] user2 host2 server bob *", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->account); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test user2 host2 server bob H@ 0"); CHECK_SRV("--", "[#test] user2 host2 server bob H@ 0", "irc_354,irc_numeric,nick_server,log3"); STRCMP_EQUAL("user_b@host_b", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); - POINTERS_EQUAL(NULL, ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->account); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test user2 host2 server bob * 0 account2"); CHECK_SRV("--", "[#test] bob [account2] (user2@host2) * 0 ()", @@ -5343,7 +5335,7 @@ TEST(IrcProtocolWithServer, 354) STRCMP_EQUAL("user2@host2", ptr_nick2->host); LONGS_EQUAL(0, ptr_nick2->away); STRCMP_EQUAL("account2", ptr_nick2->account); - POINTERS_EQUAL(NULL, ptr_nick2->realname); + STRCMP_EQUAL(NULL, ptr_nick2->realname); RECV(":server 354 alice #test user3 host3 server bob * 0 account3 " ":real name 2"); @@ -5397,8 +5389,8 @@ TEST(IrcProtocolWithServer, 354) /* nothing should have changed in the first nick */ STRCMP_EQUAL("user_a@host_a", ptr_nick->host); LONGS_EQUAL(0, ptr_nick->away); - POINTERS_EQUAL(NULL, ptr_nick->account); - POINTERS_EQUAL(NULL, ptr_nick->realname); + STRCMP_EQUAL(NULL, ptr_nick->account); + STRCMP_EQUAL(NULL, ptr_nick->realname); /* channel not found */ RECV(":server 354 alice #xyz"); diff --git a/tests/unit/plugins/irc/test-irc-sasl.cpp b/tests/unit/plugins/irc/test-irc-sasl.cpp index e6d88a39b..f13e6384a 100644 --- a/tests/unit/plugins/irc/test-irc-sasl.cpp +++ b/tests/unit/plugins/irc/test-irc-sasl.cpp @@ -41,9 +41,9 @@ TEST_GROUP(IrcSasl) TEST(IrcSasl, MechanismPlain) { - POINTERS_EQUAL(NULL, irc_sasl_mechanism_plain (NULL, NULL)); - POINTERS_EQUAL(NULL, irc_sasl_mechanism_plain (NULL, "")); - POINTERS_EQUAL(NULL, irc_sasl_mechanism_plain ("", NULL)); + STRCMP_EQUAL(NULL, irc_sasl_mechanism_plain (NULL, NULL)); + STRCMP_EQUAL(NULL, irc_sasl_mechanism_plain (NULL, "")); + STRCMP_EQUAL(NULL, irc_sasl_mechanism_plain ("", NULL)); STRCMP_EQUAL("AAA=", irc_sasl_mechanism_plain ("", "")); @@ -70,8 +70,8 @@ TEST(IrcSasl, MechanismScram) struct t_irc_server *server; char *str, str_decoded[1024], *error; - POINTERS_EQUAL(NULL, irc_sasl_mechanism_scram (NULL, NULL, NULL, NULL, - NULL, NULL)); + STRCMP_EQUAL(NULL, irc_sasl_mechanism_scram (NULL, NULL, NULL, NULL, + NULL, NULL)); server = irc_server_alloc ("my_ircd"); @@ -79,7 +79,7 @@ TEST(IrcSasl, MechanismScram) error = NULL; str = irc_sasl_mechanism_scram (server, "sha256", "+", "user1", "secret", &error); - POINTERS_EQUAL(NULL, error); + STRCMP_EQUAL(NULL, error); CHECK(string_base64_decode (0, str, str_decoded) > 0); CHECK(strncmp (str_decoded, "n,,n=user1,r=", 13) == 0); free (str); diff --git a/tests/unit/plugins/irc/test-irc-server.cpp b/tests/unit/plugins/irc/test-irc-server.cpp index a1b91f2e1..1fc7ef814 100644 --- a/tests/unit/plugins/irc/test-irc-server.cpp +++ b/tests/unit/plugins/irc/test-irc-server.cpp @@ -277,24 +277,24 @@ TEST(IrcServer, EvalFingerprint) server = irc_server_alloc ("server1"); CHECK(server); - POINTERS_EQUAL(NULL, irc_server_eval_fingerprint (NULL)); + STRCMP_EQUAL(NULL, irc_server_eval_fingerprint (NULL)); WEE_TEST_STR("", irc_server_eval_fingerprint (server)); /* invalid: evaluated to empty string */ config_file_option_set (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT], "${empty_value}", 1); - POINTERS_EQUAL(NULL, irc_server_eval_fingerprint (server)); + STRCMP_EQUAL(NULL, irc_server_eval_fingerprint (server)); /* invalid fingerprint value */ config_file_option_set (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT], "invalid", 1); - POINTERS_EQUAL(NULL, irc_server_eval_fingerprint (server)); + STRCMP_EQUAL(NULL, irc_server_eval_fingerprint (server)); /* invalid fingerprint value (same length as SHA-1) */ config_file_option_set (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT], "zzzz0aeb5ebce80ad5c201ebc358d616904czzzz", 1); - POINTERS_EQUAL(NULL, irc_server_eval_fingerprint (server)); + STRCMP_EQUAL(NULL, irc_server_eval_fingerprint (server)); /* valid SHA-1 fingerprint */ config_file_option_set (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT], @@ -361,7 +361,7 @@ TEST(IrcServer, GetNameWithoutPort) { char *str; - POINTERS_EQUAL(NULL, irc_server_get_name_without_port (NULL)); + STRCMP_EQUAL(NULL, irc_server_get_name_without_port (NULL)); WEE_TEST_STR("", irc_server_get_name_without_port ("")); WEE_TEST_STR("example.com", irc_server_get_name_without_port ("example.com")); @@ -379,7 +379,7 @@ TEST(IrcServer, SetAddresses) struct t_irc_server *server; char *str; - POINTERS_EQUAL(NULL, irc_server_get_short_description (NULL)); + STRCMP_EQUAL(NULL, irc_server_get_short_description (NULL)); server = irc_server_alloc ("server1"); @@ -545,20 +545,20 @@ TEST(IrcServer, GetIsupportValue) free (server->isupport); server->isupport = strdup (""); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, NULL)); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "TEST")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, NULL)); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "TEST")); if (server->isupport) free (server->isupport); server->isupport = strdup ("AWAYLEN=307 BOT=B CASEMAPPING=ascii " "CHANLIMIT=#:10 EMPTY= INVEX KICKLEN=307 WHOX"); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, NULL)); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "xxx")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "AWAYLE")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "WHO")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, NULL)); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "xxx")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "AWAYLE")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "WHO")); STRCMP_EQUAL("307", irc_server_get_isupport_value (server, "AWAYLEN")); STRCMP_EQUAL("B", irc_server_get_isupport_value (server, "BOT")); @@ -573,13 +573,13 @@ TEST(IrcServer, GetIsupportValue) free (server->isupport); server->isupport = strdup ("TEST SECOND"); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "T")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "TES")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "EST")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "TESTT")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "SEC")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "COND")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "SECONDD")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "T")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "TES")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "EST")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "TESTT")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "SEC")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "COND")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "SECONDD")); STRCMP_EQUAL("", irc_server_get_isupport_value (server, "TEST")); STRCMP_EQUAL("", irc_server_get_isupport_value (server, "SECOND")); @@ -588,10 +588,10 @@ TEST(IrcServer, GetIsupportValue) free (server->isupport); server->isupport = strdup ("TEST=abc"); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "T")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "TES")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "EST")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "TESTT")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "T")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "TES")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "EST")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "TESTT")); STRCMP_EQUAL("abc", irc_server_get_isupport_value (server, "TEST")); @@ -599,10 +599,10 @@ TEST(IrcServer, GetIsupportValue) free (server->isupport); server->isupport = strdup (" TEST=abc "); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "T")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "TES")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "EST")); - POINTERS_EQUAL(NULL, irc_server_get_isupport_value (server, "TESTT")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "T")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "TES")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "EST")); + STRCMP_EQUAL(NULL, irc_server_get_isupport_value (server, "TESTT")); STRCMP_EQUAL("abc", irc_server_get_isupport_value (server, "TEST")); @@ -631,21 +631,21 @@ TEST(IrcServer, SetClienttagdeny) server = irc_server_alloc ("test_clienttagdeny"); CHECK(server); - POINTERS_EQUAL(NULL, server->clienttagdeny); + STRCMP_EQUAL(NULL, server->clienttagdeny); LONGS_EQUAL(0, server->clienttagdeny_count); POINTERS_EQUAL(NULL, server->clienttagdeny_array); LONGS_EQUAL(1, server->typing_allowed); irc_server_set_clienttagdeny (server, "*"); irc_server_set_clienttagdeny (server, NULL); - POINTERS_EQUAL(NULL, server->clienttagdeny); + STRCMP_EQUAL(NULL, server->clienttagdeny); LONGS_EQUAL(0, server->clienttagdeny_count); POINTERS_EQUAL(NULL, server->clienttagdeny_array); LONGS_EQUAL(1, server->typing_allowed); irc_server_set_clienttagdeny (server, "*"); irc_server_set_clienttagdeny (server, ""); - POINTERS_EQUAL(NULL, server->clienttagdeny); + STRCMP_EQUAL(NULL, server->clienttagdeny); LONGS_EQUAL(0, server->clienttagdeny_count); POINTERS_EQUAL(NULL, server->clienttagdeny_array); LONGS_EQUAL(1, server->typing_allowed); @@ -654,7 +654,7 @@ TEST(IrcServer, SetClienttagdeny) STRCMP_EQUAL("*", server->clienttagdeny); LONGS_EQUAL(1, server->clienttagdeny_count); STRCMP_EQUAL("*", server->clienttagdeny_array[0]); - POINTERS_EQUAL(NULL, server->clienttagdeny_array[1]); + STRCMP_EQUAL(NULL, server->clienttagdeny_array[1]); LONGS_EQUAL(0, server->typing_allowed); irc_server_set_clienttagdeny (server, "*,-foo"); @@ -662,7 +662,7 @@ TEST(IrcServer, SetClienttagdeny) LONGS_EQUAL(2, server->clienttagdeny_count); STRCMP_EQUAL("*", server->clienttagdeny_array[0]); STRCMP_EQUAL("!foo", server->clienttagdeny_array[1]); - POINTERS_EQUAL(NULL, server->clienttagdeny_array[2]); + STRCMP_EQUAL(NULL, server->clienttagdeny_array[2]); LONGS_EQUAL(0, server->typing_allowed); irc_server_set_clienttagdeny (server, "*,-foo,-example/bar"); @@ -671,7 +671,7 @@ TEST(IrcServer, SetClienttagdeny) STRCMP_EQUAL("*", server->clienttagdeny_array[0]); STRCMP_EQUAL("!foo", server->clienttagdeny_array[1]); STRCMP_EQUAL("!example/bar", server->clienttagdeny_array[2]); - POINTERS_EQUAL(NULL, server->clienttagdeny_array[3]); + STRCMP_EQUAL(NULL, server->clienttagdeny_array[3]); LONGS_EQUAL(0, server->typing_allowed); irc_server_set_clienttagdeny (server, "*,-foo,-example/bar,-typing"); @@ -681,7 +681,7 @@ TEST(IrcServer, SetClienttagdeny) STRCMP_EQUAL("!foo", server->clienttagdeny_array[1]); STRCMP_EQUAL("!example/bar", server->clienttagdeny_array[2]); STRCMP_EQUAL("!typing", server->clienttagdeny_array[3]); - POINTERS_EQUAL(NULL, server->clienttagdeny_array[4]); + STRCMP_EQUAL(NULL, server->clienttagdeny_array[4]); LONGS_EQUAL(1, server->typing_allowed); irc_server_free (server); @@ -839,12 +839,9 @@ TEST(IrcServer, AllocWithUrl) CONFIG_STRING(server->options[IRC_SERVER_OPTION_ADDRESSES])); LONGS_EQUAL(0, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_IPV6])); LONGS_EQUAL(0, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_TLS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); irc_server_free (server); /* address/port */ @@ -855,12 +852,9 @@ TEST(IrcServer, AllocWithUrl) CONFIG_STRING(server->options[IRC_SERVER_OPTION_ADDRESSES])); LONGS_EQUAL(0, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_IPV6])); LONGS_EQUAL(0, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_TLS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); irc_server_free (server); /* address/port, IPv6 */ @@ -871,12 +865,9 @@ TEST(IrcServer, AllocWithUrl) CONFIG_STRING(server->options[IRC_SERVER_OPTION_ADDRESSES])); LONGS_EQUAL(1, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_IPV6])); LONGS_EQUAL(0, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_TLS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); irc_server_free (server); /* address, TLS */ @@ -887,12 +878,9 @@ TEST(IrcServer, AllocWithUrl) CONFIG_STRING(server->options[IRC_SERVER_OPTION_ADDRESSES])); LONGS_EQUAL(0, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_IPV6])); LONGS_EQUAL(1, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_TLS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); irc_server_free (server); /* address, IPv6, TLS */ @@ -903,12 +891,9 @@ TEST(IrcServer, AllocWithUrl) CONFIG_STRING(server->options[IRC_SERVER_OPTION_ADDRESSES])); LONGS_EQUAL(1, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_IPV6])); LONGS_EQUAL(1, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_TLS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); irc_server_free (server); /* address/port, TLS */ @@ -919,12 +904,9 @@ TEST(IrcServer, AllocWithUrl) CONFIG_STRING(server->options[IRC_SERVER_OPTION_ADDRESSES])); LONGS_EQUAL(0, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_IPV6])); LONGS_EQUAL(1, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_TLS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); irc_server_free (server); /* address, nick */ @@ -935,12 +917,10 @@ TEST(IrcServer, AllocWithUrl) CONFIG_STRING(server->options[IRC_SERVER_OPTION_ADDRESSES])); LONGS_EQUAL(0, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_IPV6])); LONGS_EQUAL(0, CONFIG_BOOLEAN(server->options[IRC_SERVER_OPTION_TLS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); STRCMP_EQUAL("alice,alice2,alice3,alice4,alice5", CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); irc_server_free (server); /* address, nick, password */ @@ -955,8 +935,7 @@ TEST(IrcServer, AllocWithUrl) CONFIG_STRING(server->options[IRC_SERVER_OPTION_PASSWORD])); STRCMP_EQUAL("alice,alice2,alice3,alice4,alice5", CONFIG_STRING(server->options[IRC_SERVER_OPTION_NICKS])); - POINTERS_EQUAL(NULL, - CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); + STRCMP_EQUAL(NULL, CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN])); irc_server_free (server); /* address, nick, password, channels */ @@ -1666,7 +1645,7 @@ TEST(IrcServerConnected, BuildAutojoin) server_recv (":server 001 alice"); - POINTERS_EQUAL(NULL, irc_server_build_autojoin (ptr_server)); + STRCMP_EQUAL(NULL, irc_server_build_autojoin (ptr_server)); /* join one channel */ server_recv (":alice!user@host JOIN #test1"); @@ -1674,7 +1653,7 @@ TEST(IrcServerConnected, BuildAutojoin) /* simulate a "parted" channel */ ptr_server->channels->part = 1; - POINTERS_EQUAL(NULL, irc_server_build_autojoin (ptr_server)); + STRCMP_EQUAL(NULL, irc_server_build_autojoin (ptr_server)); /* restore "part" flag */ ptr_server->channels->part = 0; diff --git a/tests/unit/plugins/irc/test-irc-tag.cpp b/tests/unit/plugins/irc/test-irc-tag.cpp index 6bcecc612..377d6df4c 100644 --- a/tests/unit/plugins/irc/test-irc-tag.cpp +++ b/tests/unit/plugins/irc/test-irc-tag.cpp @@ -58,7 +58,7 @@ TEST(IrcTag, EscapeValue) char *escaped; /* NULL/empty string */ - POINTERS_EQUAL(NULL, irc_tag_escape_value (NULL)); + STRCMP_EQUAL(NULL, irc_tag_escape_value (NULL)); WEE_CHECK_ESCAPE_VALUE("", ""); WEE_CHECK_ESCAPE_VALUE("test", "test"); @@ -82,7 +82,7 @@ TEST(IrcTag, UnescapeValue) char *unescaped; /* NULL/empty string */ - POINTERS_EQUAL(NULL, irc_tag_unescape_value (NULL)); + STRCMP_EQUAL(NULL, irc_tag_unescape_value (NULL)); WEE_CHECK_UNESCAPE_VALUE("", ""); WEE_CHECK_UNESCAPE_VALUE("test", "test"); @@ -138,7 +138,7 @@ TEST(IrcTag, Parse) hashtable_remove_all (hashtable); LONGS_EQUAL(1, irc_tag_parse ("abc", hashtable, NULL)); LONGS_EQUAL(1, hashtable->items_count); - POINTERS_EQUAL(NULL, (const char *)hashtable_get (hashtable, "abc")); + STRCMP_EQUAL(NULL, (const char *)hashtable_get (hashtable, "abc")); hashtable_remove_all (hashtable); LONGS_EQUAL(1, irc_tag_parse ("abc=def", hashtable, NULL)); @@ -150,7 +150,7 @@ TEST(IrcTag, Parse) hashtable, NULL)); LONGS_EQUAL(3, hashtable->items_count); STRCMP_EQUAL("bbb", (const char *)hashtable_get (hashtable, "aaa")); - POINTERS_EQUAL(NULL, (const char *)hashtable_get (hashtable, "ccc")); + STRCMP_EQUAL(NULL, (const char *)hashtable_get (hashtable, "ccc")); STRCMP_EQUAL("value space", (const char *)hashtable_get (hashtable, "example.com/ddd")); @@ -159,7 +159,7 @@ TEST(IrcTag, Parse) hashtable, "tag_")); LONGS_EQUAL(3, hashtable->items_count); STRCMP_EQUAL("bbb", (const char *)hashtable_get (hashtable, "tag_aaa")); - POINTERS_EQUAL(NULL, (const char *)hashtable_get (hashtable, "tag_ccc")); + STRCMP_EQUAL(NULL, (const char *)hashtable_get (hashtable, "tag_ccc")); STRCMP_EQUAL("value space", (const char *)hashtable_get (hashtable, "tag_example.com/ddd")); @@ -177,7 +177,7 @@ TEST(IrcTag, HashtableToString) char *str; struct t_hashtable *tags; - POINTERS_EQUAL(NULL, irc_tag_hashtable_to_string (NULL)); + STRCMP_EQUAL(NULL, irc_tag_hashtable_to_string (NULL)); tags = hashtable_new (32, WEECHAT_HASHTABLE_STRING, @@ -210,7 +210,7 @@ TEST(IrcTag, AddTagsToMessage) char *str; struct t_hashtable *tags; - POINTERS_EQUAL(NULL, irc_tag_add_tags_to_message (NULL, NULL)); + STRCMP_EQUAL(NULL, irc_tag_add_tags_to_message (NULL, NULL)); WEE_TEST_STR("", irc_tag_add_tags_to_message ("", NULL)); WEE_TEST_STR(":nick!user@host PRIVMSG #test :hello", diff --git a/tests/unit/plugins/logger/test-logger-tail.cpp b/tests/unit/plugins/logger/test-logger-tail.cpp index 018fa3076..1c531fa03 100644 --- a/tests/unit/plugins/logger/test-logger-tail.cpp +++ b/tests/unit/plugins/logger/test-logger-tail.cpp @@ -49,25 +49,25 @@ TEST(LoggerTail, LastEol) { const char *str = "abc\ndef\rghi"; - POINTERS_EQUAL(NULL, logger_tail_last_eol (NULL, NULL)); - POINTERS_EQUAL(NULL, logger_tail_last_eol (NULL, "")); - POINTERS_EQUAL(NULL, logger_tail_last_eol ("", NULL)); - POINTERS_EQUAL(NULL, logger_tail_last_eol ("", "")); - POINTERS_EQUAL(NULL, logger_tail_last_eol (str + 9, str)); + STRCMP_EQUAL(NULL, logger_tail_last_eol (NULL, NULL)); + STRCMP_EQUAL(NULL, logger_tail_last_eol (NULL, "")); + STRCMP_EQUAL(NULL, logger_tail_last_eol ("", NULL)); + STRCMP_EQUAL(NULL, logger_tail_last_eol ("", "")); + STRCMP_EQUAL(NULL, logger_tail_last_eol (str + 9, str)); - POINTERS_EQUAL(NULL, logger_tail_last_eol (str, str)); - POINTERS_EQUAL(NULL, logger_tail_last_eol (str, str + 1)); - POINTERS_EQUAL(NULL, logger_tail_last_eol (str, str + 2)); + STRCMP_EQUAL(NULL, logger_tail_last_eol (str, str)); + STRCMP_EQUAL(NULL, logger_tail_last_eol (str, str + 1)); + STRCMP_EQUAL(NULL, logger_tail_last_eol (str, str + 2)); - POINTERS_EQUAL(str + 3, logger_tail_last_eol (str, str + 3)); - POINTERS_EQUAL(str + 3, logger_tail_last_eol (str, str + 4)); - POINTERS_EQUAL(str + 3, logger_tail_last_eol (str, str + 5)); - POINTERS_EQUAL(str + 3, logger_tail_last_eol (str, str + 6)); + STRCMP_EQUAL(str + 3, logger_tail_last_eol (str, str + 3)); + STRCMP_EQUAL(str + 3, logger_tail_last_eol (str, str + 4)); + STRCMP_EQUAL(str + 3, logger_tail_last_eol (str, str + 5)); + STRCMP_EQUAL(str + 3, logger_tail_last_eol (str, str + 6)); - POINTERS_EQUAL(str + 7, logger_tail_last_eol (str, str + 7)); - POINTERS_EQUAL(str + 7, logger_tail_last_eol (str, str + 8)); - POINTERS_EQUAL(str + 7, logger_tail_last_eol (str, str + 9)); - POINTERS_EQUAL(str + 7, logger_tail_last_eol (str, str + 10)); + STRCMP_EQUAL(str + 7, logger_tail_last_eol (str, str + 7)); + STRCMP_EQUAL(str + 7, logger_tail_last_eol (str, str + 8)); + STRCMP_EQUAL(str + 7, logger_tail_last_eol (str, str + 9)); + STRCMP_EQUAL(str + 7, logger_tail_last_eol (str, str + 10)); } /* diff --git a/tests/unit/plugins/relay/irc/test-relay-irc.cpp b/tests/unit/plugins/relay/irc/test-relay-irc.cpp index ffbbeca3d..16e237349 100644 --- a/tests/unit/plugins/relay/irc/test-relay-irc.cpp +++ b/tests/unit/plugins/relay/irc/test-relay-irc.cpp @@ -820,8 +820,8 @@ TEST(RelayIrcWithClient, ParseCtcp) ctcp_type = (char *)0x01; ctcp_params = (char *)0x01; relay_irc_parse_ctcp (NULL, &ctcp_type, &ctcp_params); - POINTERS_EQUAL(NULL, ctcp_type); - POINTERS_EQUAL(NULL, ctcp_params); + STRCMP_EQUAL(NULL, ctcp_type); + STRCMP_EQUAL(NULL, ctcp_params); ctcp_type = (char *)0x01; ctcp_params = (char *)0x01; @@ -843,32 +843,32 @@ TEST(RelayIrcWithClient, ParseCtcp) ctcp_params = (char *)0x01; relay_irc_parse_ctcp ("\01VERSION\01", &ctcp_type, &ctcp_params); STRCMP_EQUAL("VERSION", ctcp_type); - POINTERS_EQUAL(NULL, ctcp_params); + STRCMP_EQUAL(NULL, ctcp_params); free (ctcp_type); ctcp_type = (char *)0x01; ctcp_params = (char *)0x01; relay_irc_parse_ctcp ("\01ACTION is testing", &ctcp_type, &ctcp_params); - POINTERS_EQUAL(NULL, ctcp_type); - POINTERS_EQUAL(NULL, ctcp_params); + STRCMP_EQUAL(NULL, ctcp_type); + STRCMP_EQUAL(NULL, ctcp_params); ctcp_type = (char *)0x01; ctcp_params = (char *)0x01; relay_irc_parse_ctcp ("\01VERSION", &ctcp_type, &ctcp_params); - POINTERS_EQUAL(NULL, ctcp_type); - POINTERS_EQUAL(NULL, ctcp_params); + STRCMP_EQUAL(NULL, ctcp_type); + STRCMP_EQUAL(NULL, ctcp_params); ctcp_type = (char *)0x01; ctcp_params = (char *)0x01; relay_irc_parse_ctcp ("test", &ctcp_type, &ctcp_params); - POINTERS_EQUAL(NULL, ctcp_type); - POINTERS_EQUAL(NULL, ctcp_params); + STRCMP_EQUAL(NULL, ctcp_type); + STRCMP_EQUAL(NULL, ctcp_params); ctcp_type = (char *)0x01; ctcp_params = (char *)0x01; relay_irc_parse_ctcp ("", &ctcp_type, &ctcp_params); - POINTERS_EQUAL(NULL, ctcp_type); - POINTERS_EQUAL(NULL, ctcp_params); + STRCMP_EQUAL(NULL, ctcp_type); + STRCMP_EQUAL(NULL, ctcp_params); } /* diff --git a/tests/unit/plugins/relay/test-relay-auth.cpp b/tests/unit/plugins/relay/test-relay-auth.cpp index c6039a5dc..53a9244bd 100644 --- a/tests/unit/plugins/relay/test-relay-auth.cpp +++ b/tests/unit/plugins/relay/test-relay-auth.cpp @@ -89,8 +89,8 @@ TEST(RelayAuth, GenerateNonce) { char *nonce; - POINTERS_EQUAL(NULL, relay_auth_generate_nonce (-1)); - POINTERS_EQUAL(NULL, relay_auth_generate_nonce (0)); + STRCMP_EQUAL(NULL, relay_auth_generate_nonce (-1)); + STRCMP_EQUAL(NULL, relay_auth_generate_nonce (0)); nonce = relay_auth_generate_nonce (1); LONGS_EQUAL(2, strlen (nonce)); @@ -152,24 +152,24 @@ TEST(RelayAuth, ParseSha) /* NULL string */ WEE_CHECK_PARSE_SHA(NULL); - POINTERS_EQUAL(NULL, salt_hexa); - POINTERS_EQUAL(NULL, salt); + STRCMP_EQUAL(NULL, salt_hexa); + STRCMP_EQUAL(NULL, salt); LONGS_EQUAL(0, salt_size); - POINTERS_EQUAL(NULL, hash_sha); + STRCMP_EQUAL(NULL, hash_sha); /* not enough parameters: 0 (expected: 2) */ WEE_CHECK_PARSE_SHA(""); - POINTERS_EQUAL(NULL, salt_hexa); - POINTERS_EQUAL(NULL, salt); + STRCMP_EQUAL(NULL, salt_hexa); + STRCMP_EQUAL(NULL, salt); LONGS_EQUAL(0, salt_size); - POINTERS_EQUAL(NULL, hash_sha); + STRCMP_EQUAL(NULL, hash_sha); /* not enough parameters: 1 (expected: 2) */ WEE_CHECK_PARSE_SHA("41424344"); - POINTERS_EQUAL(NULL, salt_hexa); - POINTERS_EQUAL(NULL, salt); + STRCMP_EQUAL(NULL, salt_hexa); + STRCMP_EQUAL(NULL, salt); LONGS_EQUAL(0, salt_size); - POINTERS_EQUAL(NULL, hash_sha); + STRCMP_EQUAL(NULL, hash_sha); /* good parameters */ WEE_CHECK_PARSE_SHA("41424344:5e884898da28047151d0e56f8dc6292773603d0d6aa" @@ -187,8 +187,8 @@ TEST(RelayAuth, ParseSha) /* wrong salt */ WEE_CHECK_PARSE_SHA("Z:5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a" "11ef721d1542d8"); - POINTERS_EQUAL(NULL, salt_hexa); - POINTERS_EQUAL(NULL, salt); + STRCMP_EQUAL(NULL, salt_hexa); + STRCMP_EQUAL(NULL, salt); LONGS_EQUAL(0, salt_size); STRCMP_EQUAL("5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1" "542d8", @@ -209,35 +209,35 @@ TEST(RelayAuth, ParsePbkdf2) /* NULL string */ WEE_CHECK_PARSE_PBKDF2(NULL); - POINTERS_EQUAL(NULL, salt_hexa); - POINTERS_EQUAL(NULL, salt); + STRCMP_EQUAL(NULL, salt_hexa); + STRCMP_EQUAL(NULL, salt); LONGS_EQUAL(0, salt_size); LONGS_EQUAL(0, iterations); - POINTERS_EQUAL(NULL, hash_pbkdf2); + STRCMP_EQUAL(NULL, hash_pbkdf2); /* not enough parameters: 0 (expected: 3) */ WEE_CHECK_PARSE_PBKDF2(""); - POINTERS_EQUAL(NULL, salt_hexa); - POINTERS_EQUAL(NULL, salt); + STRCMP_EQUAL(NULL, salt_hexa); + STRCMP_EQUAL(NULL, salt); LONGS_EQUAL(0, salt_size); LONGS_EQUAL(0, iterations); - POINTERS_EQUAL(NULL, hash_pbkdf2); + STRCMP_EQUAL(NULL, hash_pbkdf2); /* not enough parameters: 1 (expected: 3) */ WEE_CHECK_PARSE_PBKDF2("41424344"); - POINTERS_EQUAL(NULL, salt_hexa); - POINTERS_EQUAL(NULL, salt); + STRCMP_EQUAL(NULL, salt_hexa); + STRCMP_EQUAL(NULL, salt); LONGS_EQUAL(0, salt_size); LONGS_EQUAL(0, iterations); - POINTERS_EQUAL(NULL, hash_pbkdf2); + STRCMP_EQUAL(NULL, hash_pbkdf2); /* not enough parameters: 2 (expected: 3) */ WEE_CHECK_PARSE_PBKDF2("41424344:1000"); - POINTERS_EQUAL(NULL, salt_hexa); - POINTERS_EQUAL(NULL, salt); + STRCMP_EQUAL(NULL, salt_hexa); + STRCMP_EQUAL(NULL, salt); LONGS_EQUAL(0, salt_size); LONGS_EQUAL(0, iterations); - POINTERS_EQUAL(NULL, hash_pbkdf2); + STRCMP_EQUAL(NULL, hash_pbkdf2); /* good parameters */ WEE_CHECK_PARSE_PBKDF2("41424344:1000:8765936466387f2cfcc47d2617423386684" @@ -256,8 +256,8 @@ TEST(RelayAuth, ParsePbkdf2) /* wrong salt */ WEE_CHECK_PARSE_PBKDF2("Z:1000:8765936466387f2cfcc47d2617423386684a218d64" "a57f8213e42b0fe60d8849"); - POINTERS_EQUAL(NULL, salt_hexa); - POINTERS_EQUAL(NULL, salt); + STRCMP_EQUAL(NULL, salt_hexa); + STRCMP_EQUAL(NULL, salt); LONGS_EQUAL(0, salt_size); LONGS_EQUAL(1000, iterations); STRCMP_EQUAL("8765936466387f2cfcc47d2617423386684a218d64a57f8213e42b0fe60" diff --git a/tests/unit/plugins/relay/test-relay-http.cpp b/tests/unit/plugins/relay/test-relay-http.cpp index 6fe3faea4..9b3558883 100644 --- a/tests/unit/plugins/relay/test-relay-http.cpp +++ b/tests/unit/plugins/relay/test-relay-http.cpp @@ -90,13 +90,13 @@ TEST(RelayHttp, RequestAllocReinitFree) LONGS_EQUAL(RELAY_HTTP_METHOD, request->status); CHECK(request->raw); STRCMP_EQUAL("", *(request->raw)); - POINTERS_EQUAL(NULL, request->method); - POINTERS_EQUAL(NULL, request->path); + STRCMP_EQUAL(NULL, request->method); + STRCMP_EQUAL(NULL, request->path); POINTERS_EQUAL(NULL, request->path_items); LONGS_EQUAL(0, request->num_path_items); CHECK(request->params); LONGS_EQUAL(0, request->params->items_count); - POINTERS_EQUAL(NULL, request->http_version); + STRCMP_EQUAL(NULL, request->http_version); CHECK(request->headers); LONGS_EQUAL(0, request->headers->items_count); CHECK(request->accept_encoding); @@ -111,7 +111,7 @@ TEST(RelayHttp, RequestAllocReinitFree) POINTERS_EQUAL(NULL, request->ws_deflate->strm_inflate); LONGS_EQUAL(0, request->content_length); LONGS_EQUAL(0, request->body_size); - POINTERS_EQUAL(NULL, request->body); + STRCMP_EQUAL(NULL, request->body); request->status = RELAY_HTTP_HEADERS; string_dyn_concat (request->raw, "test", -1); @@ -133,13 +133,13 @@ TEST(RelayHttp, RequestAllocReinitFree) LONGS_EQUAL(RELAY_HTTP_METHOD, request->status); CHECK(request->raw); STRCMP_EQUAL("", *(request->raw)); - POINTERS_EQUAL(NULL, request->method); - POINTERS_EQUAL(NULL, request->path); + STRCMP_EQUAL(NULL, request->method); + STRCMP_EQUAL(NULL, request->path); POINTERS_EQUAL(NULL, request->path_items); LONGS_EQUAL(0, request->num_path_items); CHECK(request->params); LONGS_EQUAL(0, request->params->items_count); - POINTERS_EQUAL(NULL, request->http_version); + STRCMP_EQUAL(NULL, request->http_version); CHECK(request->headers); LONGS_EQUAL(0, request->headers->items_count); CHECK(request->accept_encoding); @@ -154,7 +154,7 @@ TEST(RelayHttp, RequestAllocReinitFree) POINTERS_EQUAL(NULL, request->ws_deflate->strm_inflate); LONGS_EQUAL(0, request->content_length); LONGS_EQUAL(0, request->body_size); - POINTERS_EQUAL(NULL, request->body); + STRCMP_EQUAL(NULL, request->body); relay_http_request_free (request); } @@ -168,7 +168,7 @@ TEST(RelayHttp, UrlDecode) { char *str; - POINTERS_EQUAL(NULL, relay_http_url_decode (NULL)); + STRCMP_EQUAL(NULL, relay_http_url_decode (NULL)); WEE_TEST_STR("", relay_http_url_decode ("")); WEE_TEST_STR("test", relay_http_url_decode ("test")); WEE_TEST_STR("%", relay_http_url_decode ("%")); @@ -256,21 +256,21 @@ TEST(RelayHttp, ParsePath) CHECK(paths); LONGS_EQUAL(1, num_paths); STRCMP_EQUAL("api", paths[0]); - POINTERS_EQUAL(NULL, paths[1]); + STRCMP_EQUAL(NULL, paths[1]); LONGS_EQUAL(0, params->items_count); WEE_PARSE_PATH("/api"); CHECK(paths); LONGS_EQUAL(1, num_paths); STRCMP_EQUAL("api", paths[0]); - POINTERS_EQUAL(NULL, paths[1]); + STRCMP_EQUAL(NULL, paths[1]); LONGS_EQUAL(0, params->items_count); WEE_PARSE_PATH("/api/"); CHECK(paths); LONGS_EQUAL(1, num_paths); STRCMP_EQUAL("api", paths[0]); - POINTERS_EQUAL(NULL, paths[1]); + STRCMP_EQUAL(NULL, paths[1]); LONGS_EQUAL(0, params->items_count); WEE_PARSE_PATH("/api/buffers"); @@ -278,7 +278,7 @@ TEST(RelayHttp, ParsePath) LONGS_EQUAL(2, num_paths); STRCMP_EQUAL("api", paths[0]); STRCMP_EQUAL("buffers", paths[1]); - POINTERS_EQUAL(NULL, paths[2]); + STRCMP_EQUAL(NULL, paths[2]); LONGS_EQUAL(0, params->items_count); WEE_PARSE_PATH("/api/buffers?"); @@ -286,7 +286,7 @@ TEST(RelayHttp, ParsePath) LONGS_EQUAL(2, num_paths); STRCMP_EQUAL("api", paths[0]); STRCMP_EQUAL("buffers", paths[1]); - POINTERS_EQUAL(NULL, paths[2]); + STRCMP_EQUAL(NULL, paths[2]); LONGS_EQUAL(0, params->items_count); WEE_PARSE_PATH("/api/buffers?param"); @@ -294,7 +294,7 @@ TEST(RelayHttp, ParsePath) LONGS_EQUAL(2, num_paths); STRCMP_EQUAL("api", paths[0]); STRCMP_EQUAL("buffers", paths[1]); - POINTERS_EQUAL(NULL, paths[2]); + STRCMP_EQUAL(NULL, paths[2]); LONGS_EQUAL(1, params->items_count); STRCMP_EQUAL("", (const char *)hashtable_get (params, "param")); @@ -303,7 +303,7 @@ TEST(RelayHttp, ParsePath) LONGS_EQUAL(2, num_paths); STRCMP_EQUAL("api", paths[0]); STRCMP_EQUAL("buffers", paths[1]); - POINTERS_EQUAL(NULL, paths[2]); + STRCMP_EQUAL(NULL, paths[2]); LONGS_EQUAL(1, params->items_count); STRCMP_EQUAL("", (const char *)hashtable_get (params, "param")); @@ -312,7 +312,7 @@ TEST(RelayHttp, ParsePath) LONGS_EQUAL(2, num_paths); STRCMP_EQUAL("api", paths[0]); STRCMP_EQUAL("buffers", paths[1]); - POINTERS_EQUAL(NULL, paths[2]); + STRCMP_EQUAL(NULL, paths[2]); LONGS_EQUAL(1, params->items_count); STRCMP_EQUAL("off", (const char *)hashtable_get (params, "param")); @@ -321,7 +321,7 @@ TEST(RelayHttp, ParsePath) LONGS_EQUAL(2, num_paths); STRCMP_EQUAL("api", paths[0]); STRCMP_EQUAL("buffers", paths[1]); - POINTERS_EQUAL(NULL, paths[2]); + STRCMP_EQUAL(NULL, paths[2]); LONGS_EQUAL(2, params->items_count); STRCMP_EQUAL("off", (const char *)hashtable_get (params, "param")); STRCMP_EQUAL("value2", (const char *)hashtable_get (params, "test")); @@ -332,7 +332,7 @@ TEST(RelayHttp, ParsePath) STRCMP_EQUAL("api", paths[0]); STRCMP_EQUAL("buffers", paths[1]); STRCMP_EQUAL("irc.libera.#weechat", paths[2]); - POINTERS_EQUAL(NULL, paths[3]); + STRCMP_EQUAL(NULL, paths[3]); LONGS_EQUAL(2, params->items_count); STRCMP_EQUAL("off", (const char *)hashtable_get (params, "param")); STRCMP_EQUAL("value 2", (const char *)hashtable_get (params, "test")); @@ -355,16 +355,16 @@ TEST(RelayHttp, ParseMethodPath) relay_http_parse_method_path (request, NULL); LONGS_EQUAL(RELAY_HTTP_METHOD, request->status); STRCMP_EQUAL("", *(request->raw)); - POINTERS_EQUAL(NULL, request->path); + STRCMP_EQUAL(NULL, request->path); POINTERS_EQUAL(NULL, request->path_items); LONGS_EQUAL(0, request->num_path_items); LONGS_EQUAL(0, request->params->items_count); - POINTERS_EQUAL(NULL, request->http_version); + STRCMP_EQUAL(NULL, request->http_version); LONGS_EQUAL(0, request->headers->items_count); LONGS_EQUAL(0, request->accept_encoding->items_count); LONGS_EQUAL(0, request->content_length); LONGS_EQUAL(0, request->body_size); - POINTERS_EQUAL(NULL, request->body); + STRCMP_EQUAL(NULL, request->body); relay_http_request_free (request); request = relay_http_request_alloc (); @@ -372,16 +372,16 @@ TEST(RelayHttp, ParseMethodPath) relay_http_parse_method_path (request, ""); LONGS_EQUAL(RELAY_HTTP_METHOD, request->status); STRCMP_EQUAL("", *(request->raw)); - POINTERS_EQUAL(NULL, request->path); + STRCMP_EQUAL(NULL, request->path); POINTERS_EQUAL(NULL, request->path_items); LONGS_EQUAL(0, request->num_path_items); LONGS_EQUAL(0, request->params->items_count); - POINTERS_EQUAL(NULL, request->http_version); + STRCMP_EQUAL(NULL, request->http_version); LONGS_EQUAL(0, request->headers->items_count); LONGS_EQUAL(0, request->accept_encoding->items_count); LONGS_EQUAL(0, request->content_length); LONGS_EQUAL(0, request->body_size); - POINTERS_EQUAL(NULL, request->body); + STRCMP_EQUAL(NULL, request->body); relay_http_request_free (request); request = relay_http_request_alloc (); @@ -389,16 +389,16 @@ TEST(RelayHttp, ParseMethodPath) relay_http_parse_method_path (request, "GET"); LONGS_EQUAL(RELAY_HTTP_END, request->status); STRCMP_EQUAL("GET\n", *(request->raw)); - POINTERS_EQUAL(NULL, request->path); + STRCMP_EQUAL(NULL, request->path); POINTERS_EQUAL(NULL, request->path_items); LONGS_EQUAL(0, request->num_path_items); LONGS_EQUAL(0, request->params->items_count); - POINTERS_EQUAL(NULL, request->http_version); + STRCMP_EQUAL(NULL, request->http_version); LONGS_EQUAL(0, request->headers->items_count); LONGS_EQUAL(0, request->accept_encoding->items_count); LONGS_EQUAL(0, request->content_length); LONGS_EQUAL(0, request->body_size); - POINTERS_EQUAL(NULL, request->body); + STRCMP_EQUAL(NULL, request->body); relay_http_request_free (request); request = relay_http_request_alloc (); @@ -409,15 +409,15 @@ TEST(RelayHttp, ParseMethodPath) STRCMP_EQUAL("/api", request->path); CHECK(request->path_items); STRCMP_EQUAL("api", request->path_items[0]); - POINTERS_EQUAL(NULL, request->path_items[1]); + STRCMP_EQUAL(NULL, request->path_items[1]); LONGS_EQUAL(1, request->num_path_items); LONGS_EQUAL(0, request->params->items_count); - POINTERS_EQUAL(NULL, request->http_version); + STRCMP_EQUAL(NULL, request->http_version); LONGS_EQUAL(0, request->headers->items_count); LONGS_EQUAL(0, request->accept_encoding->items_count); LONGS_EQUAL(0, request->content_length); LONGS_EQUAL(0, request->body_size); - POINTERS_EQUAL(NULL, request->body); + STRCMP_EQUAL(NULL, request->body); relay_http_request_free (request); request = relay_http_request_alloc (); @@ -429,7 +429,7 @@ TEST(RelayHttp, ParseMethodPath) CHECK(request->path_items); STRCMP_EQUAL("api", request->path_items[0]); STRCMP_EQUAL("buffers", request->path_items[1]); - POINTERS_EQUAL(NULL, request->path_items[2]); + STRCMP_EQUAL(NULL, request->path_items[2]); LONGS_EQUAL(2, request->num_path_items); LONGS_EQUAL(0, request->params->items_count); STRCMP_EQUAL("HTTP/1.1", request->http_version); @@ -437,7 +437,7 @@ TEST(RelayHttp, ParseMethodPath) LONGS_EQUAL(0, request->accept_encoding->items_count); LONGS_EQUAL(0, request->content_length); LONGS_EQUAL(0, request->body_size); - POINTERS_EQUAL(NULL, request->body); + STRCMP_EQUAL(NULL, request->body); relay_http_request_free (request); request = relay_http_request_alloc (); @@ -453,7 +453,7 @@ TEST(RelayHttp, ParseMethodPath) CHECK(request->path_items); STRCMP_EQUAL("api", request->path_items[0]); STRCMP_EQUAL("buffers", request->path_items[1]); - POINTERS_EQUAL(NULL, request->path_items[2]); + STRCMP_EQUAL(NULL, request->path_items[2]); LONGS_EQUAL(2, request->num_path_items); LONGS_EQUAL(2, request->params->items_count); STRCMP_EQUAL("1", (const char *)hashtable_get (request->params, "test")); @@ -463,7 +463,7 @@ TEST(RelayHttp, ParseMethodPath) LONGS_EQUAL(0, request->accept_encoding->items_count); LONGS_EQUAL(0, request->content_length); LONGS_EQUAL(0, request->body_size); - POINTERS_EQUAL(NULL, request->body); + STRCMP_EQUAL(NULL, request->body); relay_http_request_free (request); } @@ -602,14 +602,14 @@ TEST(RelayHttp, AddToBody) LONGS_EQUAL(RELAY_HTTP_BODY, request->status); LONGS_EQUAL(3, request->body_size); MEMCMP_EQUAL("abc", request->body, 3); - POINTERS_EQUAL(NULL, partial_message); + STRCMP_EQUAL(NULL, partial_message); partial_message = strdup (body_part2); relay_http_add_to_body (request, &partial_message); LONGS_EQUAL(RELAY_HTTP_END, request->status); LONGS_EQUAL(10, request->body_size); MEMCMP_EQUAL("abcdefghij", request->body, 10); - POINTERS_EQUAL(NULL, partial_message); + STRCMP_EQUAL(NULL, partial_message); relay_http_request_free (request); @@ -629,7 +629,7 @@ TEST(RelayHttp, AddToBody) LONGS_EQUAL(RELAY_HTTP_BODY, request->status); LONGS_EQUAL(3, request->body_size); MEMCMP_EQUAL("abc", request->body, 3); - POINTERS_EQUAL(NULL, partial_message); + STRCMP_EQUAL(NULL, partial_message); partial_message = strdup (body_part2); relay_http_add_to_body (request, &partial_message); @@ -934,7 +934,7 @@ TEST(RelayHttp, Compress) hashtable_remove_all (request->accept_encoding); size = -1; buffer = relay_http_compress (request, NULL, 0, &size, NULL, 0); - POINTERS_EQUAL(NULL, buffer); + STRCMP_EQUAL(NULL, buffer); LONGS_EQUAL(0, size); hashtable_remove_all (request->accept_encoding); @@ -942,7 +942,7 @@ TEST(RelayHttp, Compress) snprintf (encoding, sizeof (encoding), "test"); buffer = relay_http_compress (request, NULL, 0, &size, encoding, sizeof (encoding)); - POINTERS_EQUAL(NULL, buffer); + STRCMP_EQUAL(NULL, buffer); LONGS_EQUAL(0, size); STRCMP_EQUAL("", encoding); @@ -952,7 +952,7 @@ TEST(RelayHttp, Compress) snprintf (encoding, sizeof (encoding), "test"); buffer = relay_http_compress (request, body, sizeof (body), &size, encoding, sizeof (encoding)); - POINTERS_EQUAL(NULL, buffer); + STRCMP_EQUAL(NULL, buffer); LONGS_EQUAL(0, size); STRCMP_EQUAL("", encoding); @@ -1028,14 +1028,14 @@ TEST(RelayHttp, ResponseAllocFree) CHECK(response); LONGS_EQUAL(RELAY_HTTP_METHOD, response->status); - POINTERS_EQUAL(NULL, response->http_version); + STRCMP_EQUAL(NULL, response->http_version); LONGS_EQUAL(0, response->return_code); - POINTERS_EQUAL(NULL, response->message); + STRCMP_EQUAL(NULL, response->message); CHECK(response->headers); LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); @@ -1056,14 +1056,14 @@ TEST(RelayHttp, ParseResponseCode) CHECK(response); relay_http_parse_response_code (NULL, NULL); LONGS_EQUAL(RELAY_HTTP_METHOD, response->status); - POINTERS_EQUAL(NULL, response->http_version); + STRCMP_EQUAL(NULL, response->http_version); LONGS_EQUAL(0, response->return_code); - POINTERS_EQUAL(NULL, response->message); + STRCMP_EQUAL(NULL, response->message); CHECK(response->headers); LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); response = relay_http_response_alloc (); @@ -1071,28 +1071,28 @@ TEST(RelayHttp, ParseResponseCode) relay_http_parse_response_code (response, NULL); relay_http_parse_response_code (response, ""); LONGS_EQUAL(RELAY_HTTP_END, response->status); - POINTERS_EQUAL(NULL, response->http_version); + STRCMP_EQUAL(NULL, response->http_version); LONGS_EQUAL(0, response->return_code); - POINTERS_EQUAL(NULL, response->message); + STRCMP_EQUAL(NULL, response->message); CHECK(response->headers); LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); response = relay_http_response_alloc (); CHECK(response); relay_http_parse_response_code (response, "HTTP/1.1"); LONGS_EQUAL(RELAY_HTTP_END, response->status); - POINTERS_EQUAL(NULL, response->http_version); + STRCMP_EQUAL(NULL, response->http_version); LONGS_EQUAL(0, response->return_code); - POINTERS_EQUAL(NULL, response->message); + STRCMP_EQUAL(NULL, response->message); CHECK(response->headers); LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); response = relay_http_response_alloc (); @@ -1101,12 +1101,12 @@ TEST(RelayHttp, ParseResponseCode) LONGS_EQUAL(RELAY_HTTP_HEADERS, response->status); STRCMP_EQUAL("HTTP/1.1", response->http_version); LONGS_EQUAL(200, response->return_code); - POINTERS_EQUAL(NULL, response->message); + STRCMP_EQUAL(NULL, response->message); CHECK(response->headers); LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); response = relay_http_response_alloc (); @@ -1120,7 +1120,7 @@ TEST(RelayHttp, ParseResponseCode) LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); response = relay_http_response_alloc (); @@ -1134,7 +1134,7 @@ TEST(RelayHttp, ParseResponseCode) LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); @@ -1149,7 +1149,7 @@ TEST(RelayHttp, ParseResponseCode) LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); } @@ -1235,27 +1235,27 @@ TEST(RelayHttp, ParseResponse) response = relay_http_parse_response ("invalid"); CHECK(response); LONGS_EQUAL(RELAY_HTTP_METHOD, response->status); - POINTERS_EQUAL(NULL, response->http_version); + STRCMP_EQUAL(NULL, response->http_version); LONGS_EQUAL(0, response->return_code); - POINTERS_EQUAL(NULL, response->message); + STRCMP_EQUAL(NULL, response->message); CHECK(response->headers); LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); response = relay_http_parse_response ("invalid\r\n"); CHECK(response); LONGS_EQUAL(RELAY_HTTP_END, response->status); - POINTERS_EQUAL(NULL, response->http_version); + STRCMP_EQUAL(NULL, response->http_version); LONGS_EQUAL(0, response->return_code); - POINTERS_EQUAL(NULL, response->message); + STRCMP_EQUAL(NULL, response->message); CHECK(response->headers); LONGS_EQUAL(0, response->headers->items_count); LONGS_EQUAL(0, response->content_length); LONGS_EQUAL(0, response->body_size); - POINTERS_EQUAL(NULL, response->body); + STRCMP_EQUAL(NULL, response->body); relay_http_response_free (response); response = relay_http_parse_response ("HTTP/1.1 200 OK\r\n" diff --git a/tests/unit/plugins/relay/test-relay-websocket.cpp b/tests/unit/plugins/relay/test-relay-websocket.cpp index d9df3e900..b4e129789 100644 --- a/tests/unit/plugins/relay/test-relay-websocket.cpp +++ b/tests/unit/plugins/relay/test-relay-websocket.cpp @@ -147,7 +147,7 @@ TEST(RelayWebsocket, ClientHandshakeValid) hashtable_set (request->headers, "sec-websocket-key", "CI1sXhf/u2o34BfWK7NeIg=="); LONGS_EQUAL(0, relay_websocket_client_handshake_valid (request)); - POINTERS_EQUAL(NULL, relay_websocket_build_handshake (NULL)); + STRCMP_EQUAL(NULL, relay_websocket_build_handshake (NULL)); WEE_TEST_STR( "HTTP/1.1 101 Switching Protocols\r\n" diff --git a/tests/unit/plugins/test-plugin-api-info.cpp b/tests/unit/plugins/test-plugin-api-info.cpp index a8c38c5a0..6174e0da8 100644 --- a/tests/unit/plugins/test-plugin-api-info.cpp +++ b/tests/unit/plugins/test-plugin-api-info.cpp @@ -152,9 +152,9 @@ TEST(PluginApiInfo, AbsolutePath) { char *str; - POINTERS_EQUAL(NULL, plugin_api_info_absolute_path (NULL)); - POINTERS_EQUAL(NULL, plugin_api_info_absolute_path ("")); - POINTERS_EQUAL(NULL, plugin_api_info_absolute_path ("/invalid/dir")); + STRCMP_EQUAL(NULL, plugin_api_info_absolute_path (NULL)); + STRCMP_EQUAL(NULL, plugin_api_info_absolute_path ("")); + STRCMP_EQUAL(NULL, plugin_api_info_absolute_path ("/invalid/dir")); WEE_TEST_STR("/", plugin_api_info_absolute_path ("/tmp/..")); } @@ -340,10 +340,10 @@ TEST(PluginApiInfo, BufferCb) { char *str, str_buffer[64]; - POINTERS_EQUAL(NULL, hook_info_get (NULL, "buffer", NULL)); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "buffer", "")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "buffer", NULL)); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "buffer", "")); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "buffer", "zzz")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "buffer", "zzz")); snprintf (str_buffer, sizeof (str_buffer), "%p", gui_buffers); WEE_TEST_STR(str_buffer, hook_info_get (NULL, "buffer", "core.weechat")); @@ -529,8 +529,8 @@ TEST(PluginApiInfo, ColorTerm2rgbCb) { char *str; - POINTERS_EQUAL(NULL, hook_info_get (NULL, "color_term2rgb", NULL)); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "color_term2rgb", "")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "color_term2rgb", NULL)); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "color_term2rgb", "")); WEE_TEST_STR("8421504", hook_info_get (NULL, "color_term2rgb", "8")); WEE_TEST_STR("11534080", hook_info_get (NULL, "color_term2rgb", "154")); @@ -545,8 +545,8 @@ TEST(PluginApiInfo, ColorRgb2termCb) { char *str; - POINTERS_EQUAL(NULL, hook_info_get (NULL, "color_rgb2term", NULL)); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "color_rgb2term", "")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "color_rgb2term", NULL)); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "color_rgb2term", "")); WEE_TEST_STR("8", hook_info_get (NULL, "color_rgb2term", "8421504")); WEE_TEST_STR("154", hook_info_get (NULL, "color_rgb2term", "11534080")); @@ -608,7 +608,7 @@ TEST(PluginApiInfo, Uptime) char *str, *error; long long seconds; - POINTERS_EQUAL(NULL, hook_info_get (NULL, "uptime", "invalid")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "uptime", "invalid")); str = hook_info_get (NULL, "uptime", NULL); STRNCMP_EQUAL("0:00:00:", str, 8); @@ -640,21 +640,21 @@ TEST(PluginApiInfo, TotpGenerateCb) { char *str; - POINTERS_EQUAL(NULL, hook_info_get (NULL, "totp_generate", NULL)); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "totp_generate", "")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "totp_generate", NULL)); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "totp_generate", "")); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "totp_validate", NULL)); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "totp_validate", "")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "totp_validate", NULL)); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "totp_validate", "")); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "totp_generate", - "secretpasswordbase32,abc")); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "totp_generate", - "secretpasswordbase32,1540624066,abc")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "totp_generate", + "secretpasswordbase32,abc")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "totp_generate", + "secretpasswordbase32,1540624066,abc")); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "totp_validate", - "secretpasswordbase32,123456,abc")); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "totp_validate", - "secretpasswordbase32,123456,1540624066,abc")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "totp_validate", + "secretpasswordbase32,123456,abc")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "totp_validate", + "secretpasswordbase32,123456,1540624066,abc")); WEE_TEST_STR("065486", hook_info_get (NULL, @@ -680,10 +680,10 @@ TEST(PluginApiInfo, PluginLoadedCb) { char *str; - POINTERS_EQUAL(NULL, hook_info_get (NULL, "plugin_loaded", NULL)); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "plugin_loaded", "")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "plugin_loaded", NULL)); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "plugin_loaded", "")); - POINTERS_EQUAL(NULL, hook_info_get (NULL, "plugin_loaded", "xxx")); + STRCMP_EQUAL(NULL, hook_info_get (NULL, "plugin_loaded", "xxx")); WEE_TEST_STR("1", hook_info_get (NULL, "plugin_loaded", "alias")); WEE_TEST_STR("1", hook_info_get (NULL, "plugin_loaded", "irc")); diff --git a/tests/unit/plugins/trigger/test-trigger.cpp b/tests/unit/plugins/trigger/test-trigger.cpp index a0b77a020..dc91ac3cf 100644 --- a/tests/unit/plugins/trigger/test-trigger.cpp +++ b/tests/unit/plugins/trigger/test-trigger.cpp @@ -230,7 +230,7 @@ TEST(Trigger, RegexSplit) /* simple regex (implicit command "s") */ WEE_CHECK_REGEX_SPLIT(0, 1, "/a/b"); - POINTERS_EQUAL(NULL, regex[0].variable); + STRCMP_EQUAL(NULL, regex[0].variable); STRCMP_EQUAL("a", regex[0].str_regex); CHECK(regex[0].regex); STRCMP_EQUAL("b", regex[0].replace); @@ -238,7 +238,7 @@ TEST(Trigger, RegexSplit) /* simple regex replace (command "s") */ WEE_CHECK_REGEX_SPLIT(0, 1, "s/a/b"); - POINTERS_EQUAL(NULL, regex[0].variable); + STRCMP_EQUAL(NULL, regex[0].variable); STRCMP_EQUAL("a", regex[0].str_regex); CHECK(regex[0].regex); STRCMP_EQUAL("b", regex[0].replace); @@ -246,11 +246,11 @@ TEST(Trigger, RegexSplit) /* simple translate chars (command "y") */ WEE_CHECK_REGEX_SPLIT(0, 1, "y/${chars:a-h}/${chars:A-H}"); - POINTERS_EQUAL(NULL, regex[0].variable); + STRCMP_EQUAL(NULL, regex[0].variable); STRCMP_EQUAL("${chars:a-h}", regex[0].str_regex); POINTERS_EQUAL(NULL, regex[0].regex); STRCMP_EQUAL("${chars:A-H}", regex[0].replace); - POINTERS_EQUAL(NULL, regex[0].replace_escaped); + STRCMP_EQUAL(NULL, regex[0].replace_escaped); /* simple regex replace with variable (implicit command "s") */ WEE_CHECK_REGEX_SPLIT(0, 1, "/a/b/var"); @@ -274,16 +274,16 @@ TEST(Trigger, RegexSplit) STRCMP_EQUAL("${chars:a-h}", regex[0].str_regex); POINTERS_EQUAL(NULL, regex[0].regex); STRCMP_EQUAL("${chars:A-H}", regex[0].replace); - POINTERS_EQUAL(NULL, regex[0].replace_escaped); + STRCMP_EQUAL(NULL, regex[0].replace_escaped); /* 2 regex replace separated by 3 spaces, without variables, implicit command "s" */ WEE_CHECK_REGEX_SPLIT(0, 2, "/abc/def/ /ghi/jkl/"); - POINTERS_EQUAL(NULL, regex[0].variable); + STRCMP_EQUAL(NULL, regex[0].variable); STRCMP_EQUAL("abc", regex[0].str_regex); CHECK(regex[0].regex); STRCMP_EQUAL("def", regex[0].replace); STRCMP_EQUAL("def", regex[0].replace_escaped); - POINTERS_EQUAL(NULL, regex[1].variable); + STRCMP_EQUAL(NULL, regex[1].variable); STRCMP_EQUAL("ghi", regex[1].str_regex); CHECK(regex[1].regex); STRCMP_EQUAL("jkl", regex[1].replace); @@ -291,12 +291,12 @@ TEST(Trigger, RegexSplit) /* 2 regex replace separated by 3 spaces, without variables, command "s" */ WEE_CHECK_REGEX_SPLIT(0, 2, "s/abc/def/ s/ghi/jkl/"); - POINTERS_EQUAL(NULL, regex[0].variable); + STRCMP_EQUAL(NULL, regex[0].variable); STRCMP_EQUAL("abc", regex[0].str_regex); CHECK(regex[0].regex); STRCMP_EQUAL("def", regex[0].replace); STRCMP_EQUAL("def", regex[0].replace_escaped); - POINTERS_EQUAL(NULL, regex[1].variable); + STRCMP_EQUAL(NULL, regex[1].variable); STRCMP_EQUAL("ghi", regex[1].str_regex); CHECK(regex[1].regex); STRCMP_EQUAL("jkl", regex[1].replace); @@ -304,16 +304,16 @@ TEST(Trigger, RegexSplit) /* 2 translate chars separated by 3 spaces, without variables, command "y" */ WEE_CHECK_REGEX_SPLIT(0, 2, "y/abc/ABC/ y/ghi/GHI/"); - POINTERS_EQUAL(NULL, regex[0].variable); + STRCMP_EQUAL(NULL, regex[0].variable); STRCMP_EQUAL("abc", regex[0].str_regex); POINTERS_EQUAL(NULL, regex[0].regex); STRCMP_EQUAL("ABC", regex[0].replace); - POINTERS_EQUAL(NULL, regex[0].replace_escaped); - POINTERS_EQUAL(NULL, regex[1].variable); + STRCMP_EQUAL(NULL, regex[0].replace_escaped); + STRCMP_EQUAL(NULL, regex[1].variable); STRCMP_EQUAL("ghi", regex[1].str_regex); POINTERS_EQUAL(NULL, regex[1].regex); STRCMP_EQUAL("GHI", regex[1].replace); - POINTERS_EQUAL(NULL, regex[1].replace_escaped); + STRCMP_EQUAL(NULL, regex[1].replace_escaped); /* 3 regex replace with variables and escaped replace, implicit command "s" */ WEE_CHECK_REGEX_SPLIT(0, 3, @@ -360,17 +360,17 @@ TEST(Trigger, RegexSplit) STRCMP_EQUAL("abc", regex[0].str_regex); POINTERS_EQUAL(NULL, regex[0].regex); STRCMP_EQUAL("ABC", regex[0].replace); - POINTERS_EQUAL(NULL, regex[0].replace_escaped); + STRCMP_EQUAL(NULL, regex[0].replace_escaped); STRCMP_EQUAL("var2", regex[1].variable); STRCMP_EQUAL("ghi", regex[1].str_regex); POINTERS_EQUAL(NULL, regex[1].regex); STRCMP_EQUAL("GHI", regex[1].replace); - POINTERS_EQUAL(NULL, regex[1].replace_escaped); + STRCMP_EQUAL(NULL, regex[1].replace_escaped); STRCMP_EQUAL("var3", regex[2].variable); STRCMP_EQUAL("mno", regex[2].str_regex); POINTERS_EQUAL(NULL, regex[2].regex); STRCMP_EQUAL("MNO", regex[2].replace); - POINTERS_EQUAL(NULL, regex[2].replace_escaped); + STRCMP_EQUAL(NULL, regex[2].replace_escaped); /* mixed regex replace and translate chars */ WEE_CHECK_REGEX_SPLIT(0, 2, @@ -384,7 +384,7 @@ TEST(Trigger, RegexSplit) STRCMP_EQUAL("${chars:x-z}", regex[1].str_regex); POINTERS_EQUAL(NULL, regex[1].regex); STRCMP_EQUAL("${chars:X-Z}", regex[1].replace); - POINTERS_EQUAL(NULL, regex[1].replace_escaped); + STRCMP_EQUAL(NULL, regex[1].replace_escaped); trigger_regex_free (®ex_count, ®ex); } @@ -571,7 +571,7 @@ TEST(Trigger, New) } LONGS_EQUAL(1, trigger->regex_count); CHECK(trigger->regex); - POINTERS_EQUAL(NULL, trigger->regex[0].variable); + STRCMP_EQUAL(NULL, trigger->regex[0].variable); STRCMP_EQUAL("abc", trigger->regex[0].str_regex); CHECK(trigger->regex[0].regex); STRCMP_EQUAL("def", trigger->regex[0].replace); diff --git a/tests/unit/plugins/xfer/test-xfer-file.cpp b/tests/unit/plugins/xfer/test-xfer-file.cpp index ee868eadf..f5764d628 100644 --- a/tests/unit/plugins/xfer/test-xfer-file.cpp +++ b/tests/unit/plugins/xfer/test-xfer-file.cpp @@ -37,12 +37,12 @@ TEST_GROUP(XferFile) TEST(XferFile, SearchCrc32) { - POINTERS_EQUAL(NULL, xfer_file_search_crc32 (NULL)); - POINTERS_EQUAL(NULL, xfer_file_search_crc32 ("")); - POINTERS_EQUAL(NULL, xfer_file_search_crc32 ("a")); - POINTERS_EQUAL(NULL, xfer_file_search_crc32 ("z")); - POINTERS_EQUAL(NULL, xfer_file_search_crc32 ("123456781234abcd")); - POINTERS_EQUAL(NULL, xfer_file_search_crc32 ("test_filename")); + STRCMP_EQUAL(NULL, xfer_file_search_crc32 (NULL)); + STRCMP_EQUAL(NULL, xfer_file_search_crc32 ("")); + STRCMP_EQUAL(NULL, xfer_file_search_crc32 ("a")); + STRCMP_EQUAL(NULL, xfer_file_search_crc32 ("z")); + STRCMP_EQUAL(NULL, xfer_file_search_crc32 ("123456781234abcd")); + STRCMP_EQUAL(NULL, xfer_file_search_crc32 ("test_filename")); /* valid CRC32 */ STRCMP_EQUAL("1234abcd", xfer_file_search_crc32 ("test_1234abcd")); diff --git a/tests/unit/plugins/xfer/test-xfer-network.cpp b/tests/unit/plugins/xfer/test-xfer-network.cpp index a838e6243..ef9009cf1 100644 --- a/tests/unit/plugins/xfer/test-xfer-network.cpp +++ b/tests/unit/plugins/xfer/test-xfer-network.cpp @@ -43,14 +43,14 @@ TEST(XferNetwork, ConvertIntegerToIpv4) { char *str; - POINTERS_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 (NULL)); - POINTERS_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("")); - POINTERS_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("abc")); - POINTERS_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("0")); - POINTERS_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("-1")); + STRCMP_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 (NULL)); + STRCMP_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("")); + STRCMP_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("abc")); + STRCMP_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("0")); + STRCMP_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("-1")); /* too big: UINT32_MAX + 1 = 4294967296 */ - POINTERS_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("4294967296")); + STRCMP_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("4294967296")); WEE_TEST_STR("0.0.0.1", xfer_network_convert_integer_to_ipv4 ("1")); WEE_TEST_STR("0.0.1.0", xfer_network_convert_integer_to_ipv4 ("256"));