diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_contact_list.c | 48 | ||||
-rw-r--r-- | tests/test_prof_autocomplete.c | 42 | ||||
-rw-r--r-- | tests/test_prof_history.c | 22 |
3 files changed, 56 insertions, 56 deletions
diff --git a/tests/test_contact_list.c b/tests/test_contact_list.c index 599c8ca1..65d5fd72 100644 --- a/tests/test_contact_list.c +++ b/tests/test_contact_list.c @@ -59,10 +59,10 @@ static void first_and_second_elements_correct(void) contact_list_add("James", NULL, NULL); contact_list_add("Dave", NULL, NULL); GSList *list = get_contact_list(); - + PContact dave = list->data; PContact james = (g_slist_next(list))->data; - + assert_string_equals("James", p_contact_name(james)); assert_string_equals("Dave", p_contact_name(dave)); } @@ -73,7 +73,7 @@ static void contains_three_elements(void) contact_list_add("Bob", NULL, NULL); contact_list_add("Dave", NULL, NULL); GSList *list = get_contact_list(); - + assert_int_equals(3, g_slist_length(list)); } @@ -86,7 +86,7 @@ static void first_three_elements_correct(void) PContact bob = list->data; PContact dave = (g_slist_next(list))->data; PContact james = (g_slist_next(g_slist_next(list)))->data; - + assert_string_equals("James", p_contact_name(james)); assert_string_equals("Dave", p_contact_name(dave)); assert_string_equals("Bob", p_contact_name(bob)); @@ -102,8 +102,8 @@ static void add_twice_at_beginning_adds_once(void) PContact bob = list->data; PContact dave = (g_slist_next(list))->data; PContact james = (g_slist_next(g_slist_next(list)))->data; - - assert_int_equals(3, g_slist_length(list)); + + assert_int_equals(3, g_slist_length(list)); assert_string_equals("James", p_contact_name(james)); assert_string_equals("Dave", p_contact_name(dave)); assert_string_equals("Bob", p_contact_name(bob)); @@ -119,8 +119,8 @@ static void add_twice_in_middle_adds_once(void) PContact bob = list->data; PContact dave = (g_slist_next(list))->data; PContact james = (g_slist_next(g_slist_next(list)))->data; - - assert_int_equals(3, g_slist_length(list)); + + assert_int_equals(3, g_slist_length(list)); assert_string_equals("James", p_contact_name(james)); assert_string_equals("Dave", p_contact_name(dave)); assert_string_equals("Bob", p_contact_name(bob)); @@ -136,8 +136,8 @@ static void add_twice_at_end_adds_once(void) PContact bob = list->data; PContact dave = (g_slist_next(list))->data; PContact james = (g_slist_next(g_slist_next(list)))->data; - - assert_int_equals(3, g_slist_length(list)); + + assert_int_equals(3, g_slist_length(list)); assert_string_equals("James", p_contact_name(james)); assert_string_equals("Dave", p_contact_name(dave)); assert_string_equals("Bob", p_contact_name(bob)); @@ -156,7 +156,7 @@ static void remove_when_one_removes(void) contact_list_add("James", NULL, NULL); contact_list_remove("James"); GSList *list = get_contact_list(); - + assert_int_equals(0, g_slist_length(list)); } @@ -167,7 +167,7 @@ static void remove_first_when_two(void) contact_list_remove("James"); GSList *list = get_contact_list(); - + assert_int_equals(1, g_slist_length(list)); PContact dave = list->data; assert_string_equals("Dave", p_contact_name(dave)); @@ -180,7 +180,7 @@ static void remove_second_when_two(void) contact_list_remove("Dave"); GSList *list = get_contact_list(); - + assert_int_equals(1, g_slist_length(list)); PContact james = list->data; assert_string_equals("James", p_contact_name(james)); @@ -194,11 +194,11 @@ static void remove_first_when_three(void) contact_list_remove("James"); GSList *list = get_contact_list(); - + assert_int_equals(2, g_slist_length(list)); PContact bob = list->data; PContact dave = (g_slist_next(list))->data; - + assert_string_equals("Dave", p_contact_name(dave)); assert_string_equals("Bob", p_contact_name(bob)); } @@ -211,11 +211,11 @@ static void remove_second_when_three(void) contact_list_remove("Dave"); GSList *list = get_contact_list(); - + assert_int_equals(2, g_slist_length(list)); PContact bob = list->data; PContact james = (g_slist_next(list))->data; - + assert_string_equals("James", p_contact_name(james)); assert_string_equals("Bob", p_contact_name(bob)); } @@ -228,11 +228,11 @@ static void remove_third_when_three(void) contact_list_remove("Bob"); GSList *list = get_contact_list(); - + assert_int_equals(2, g_slist_length(list)); PContact dave = list->data; PContact james = (g_slist_next(list))->data; - + assert_string_equals("James", p_contact_name(james)); assert_string_equals("Dave", p_contact_name(dave)); } @@ -242,7 +242,7 @@ static void test_show_when_value(void) contact_list_add("James", "away", NULL); GSList *list = get_contact_list(); PContact james = list->data; - + assert_string_equals("away", p_contact_show(james)); } @@ -251,7 +251,7 @@ static void test_show_online_when_no_value(void) contact_list_add("James", NULL, NULL); GSList *list = get_contact_list(); PContact james = list->data; - + assert_string_equals("online", p_contact_show(james)); } @@ -260,7 +260,7 @@ static void test_show_online_when_empty_string(void) contact_list_add("James", "", NULL); GSList *list = get_contact_list(); PContact james = list->data; - + assert_string_equals("online", p_contact_show(james)); } @@ -269,7 +269,7 @@ static void test_status_when_value(void) contact_list_add("James", NULL, "I'm not here right now"); GSList *list = get_contact_list(); PContact james = list->data; - + assert_string_equals("I'm not here right now", p_contact_status(james)); } @@ -278,7 +278,7 @@ static void test_status_when_no_value(void) contact_list_add("James", NULL, NULL); GSList *list = get_contact_list(); PContact james = list->data; - + assert_is_null(p_contact_status(james)); } diff --git a/tests/test_prof_autocomplete.c b/tests/test_prof_autocomplete.c index 45717abd..895a4a44 100644 --- a/tests/test_prof_autocomplete.c +++ b/tests/test_prof_autocomplete.c @@ -15,7 +15,7 @@ static void clear_empty(void) static void clear_empty_with_free_func(void) { - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -49,7 +49,7 @@ static void get_after_create_returns_null(void) static void get_after_create_with_copy_func_returns_null(void) { - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -57,7 +57,7 @@ static void get_after_create_with_copy_func_returns_null(void) GSList *result = p_autocomplete_get_list(ac); assert_is_null(result); - + p_autocomplete_clear(ac); } @@ -76,7 +76,7 @@ static void add_one_and_complete(void) static void add_one_and_complete_with_funcs(void) { PContact contact = p_contact_new("James", "Online", "I'm here"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -85,7 +85,7 @@ static void add_one_and_complete_with_funcs(void) char *result = p_autocomplete_complete(ac, "Jam"); assert_string_equals("James", result); - + p_autocomplete_clear(ac); } @@ -99,7 +99,7 @@ static void add_two_and_complete_returns_first(void) char *result = p_autocomplete_complete(ac, "Hel"); assert_string_equals("Hello", result); - + p_autocomplete_clear(ac); } @@ -107,7 +107,7 @@ static void add_two_and_complete_returns_first_with_funcs(void) { PContact contact1 = p_contact_new("James", "Online", "I'm here"); PContact contact2 = p_contact_new("Jamie", "Away", "Out to lunch"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -117,7 +117,7 @@ static void add_two_and_complete_returns_first_with_funcs(void) char *result = p_autocomplete_complete(ac, "Jam"); assert_string_equals("James", result); - + p_autocomplete_clear(ac); } @@ -132,7 +132,7 @@ static void add_two_and_complete_returns_second(void) char *result2 = p_autocomplete_complete(ac, result1); assert_string_equals("Help", result2); - + p_autocomplete_clear(ac); } @@ -140,7 +140,7 @@ static void add_two_and_complete_returns_second_with_funcs(void) { PContact contact1 = p_contact_new("James", "Online", "I'm here"); PContact contact2 = p_contact_new("Jamie", "Away", "Out to lunch"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -151,7 +151,7 @@ static void add_two_and_complete_returns_second_with_funcs(void) char *result2 = p_autocomplete_complete(ac, result1); assert_string_equals("Jamie", result2); - + p_autocomplete_clear(ac); } @@ -173,7 +173,7 @@ static void add_two_adds_two_with_funcs(void) { PContact contact1 = p_contact_new("James", "Online", "I'm here"); PContact contact2 = p_contact_new("Jamie", "Away", "Out to lunch"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -183,7 +183,7 @@ static void add_two_adds_two_with_funcs(void) GSList *result = p_autocomplete_get_list(ac); assert_int_equals(2, g_slist_length(result)); - + p_autocomplete_clear(ac); } @@ -205,7 +205,7 @@ static void add_two_same_adds_one_with_funcs(void) { PContact contact1 = p_contact_new("James", "Online", "I'm here"); PContact contact2 = p_contact_new("James", "Away", "Out to lunch"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -215,7 +215,7 @@ static void add_two_same_adds_one_with_funcs(void) GSList *result = p_autocomplete_get_list(ac); assert_int_equals(1, g_slist_length(result)); - + p_autocomplete_clear(ac); } @@ -241,7 +241,7 @@ static void add_two_same_updates_with_funcs(void) { PContact contact1 = p_contact_new("James", "Online", "I'm here"); PContact contact2 = p_contact_new("James", "Away", "Out to lunch"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -274,7 +274,7 @@ static void add_one_returns_true(void) static void add_one_returns_true_with_funcs(void) { PContact contact = p_contact_new("James", "Online", "I'm here"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -282,7 +282,7 @@ static void add_one_returns_true_with_funcs(void) int result = p_autocomplete_add(ac, contact); assert_true(result); - + p_autocomplete_clear(ac); } @@ -304,7 +304,7 @@ static void add_two_different_returns_true_with_funcs(void) { PContact contact1 = p_contact_new("James", "Online", "I'm here"); PContact contact2 = p_contact_new("JamesB", "Away", "Out to lunch"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -336,7 +336,7 @@ static void add_two_same_returns_false_with_funcs(void) { PContact contact1 = p_contact_new("James", "Online", "I'm here"); PContact contact2 = p_contact_new("James", "Online", "I'm here"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, @@ -354,7 +354,7 @@ static void add_two_same_different_data_returns_true(void) { PContact contact1 = p_contact_new("James", "Online", "I'm here"); PContact contact2 = p_contact_new("James", "Away", "I'm not here right now"); - PAutocomplete ac = + PAutocomplete ac = p_obj_autocomplete_new((PStrFunc)p_contact_name, (PCopyFunc)p_contact_copy, (PEqualDeepFunc)p_contacts_equal_deep, diff --git a/tests/test_prof_history.c b/tests/test_prof_history.c index 5f08c26c..c58c5957 100644 --- a/tests/test_prof_history.c +++ b/tests/test_prof_history.c @@ -67,8 +67,8 @@ void previous_goes_to_correct_element(void) char *item1 = p_history_previous(history, NULL); char *item2 = p_history_previous(history, item1); char *item3 = p_history_previous(history, item2); - - assert_string_equals("going", item3); + + assert_string_equals("going", item3); } void prev_then_next_returns_empty(void) @@ -128,7 +128,7 @@ void navigate_then_append_new(void) char *item5 = p_history_next(history, item4); assert_string_equals("append", item5); - + char *item6 = p_history_next(history, item5); assert_string_equals("new text", item6); } @@ -144,22 +144,22 @@ void edit_item_mid_history(void) char *item1 = p_history_previous(history, "new item"); assert_string_equals("append", item1); - + char *item2 = p_history_previous(history, item1); assert_string_equals("history", item2); char *item3 = p_history_previous(history, item2); assert_string_equals("testing", item3); - + char *item4 = p_history_previous(history, "EDITED"); - assert_string_equals("again", item4); - + assert_string_equals("again", item4); + char *item5 = p_history_previous(history, item4); assert_string_equals("Hello", item5); char *item6 = p_history_next(history, item5); assert_string_equals("again", item6); - + char *item7 = p_history_next(history, item6); assert_string_equals("EDITED", item7); @@ -184,13 +184,13 @@ void edit_previous_and_append(void) char *item1 = p_history_previous(history, "new item"); assert_string_equals("append", item1); - + char *item2 = p_history_previous(history, item1); assert_string_equals("history", item2); char *item3 = p_history_previous(history, item2); assert_string_equals("testing", item3); - + p_history_append(history, "EDITED"); char *item4 = p_history_previous(history, NULL); @@ -204,7 +204,7 @@ void start_session_add_new_submit_previous(void) char *item1 = p_history_previous(history, NULL); assert_string_equals("hello", item1); - + char *item2 = p_history_next(history, item1); assert_string_equals("", item2); |