about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-10-22 22:21:55 +0100
committerJames Booth <boothj5@gmail.com>2012-10-22 22:21:55 +0100
commita5e4e52567f32356c3ba637bc220ddb6a33248a3 (patch)
tree18a0372503437a5949fb191eca1226edc94209c8 /tests
parentd2be6929921170ef8d6395781b4f4c7808bf2923 (diff)
parentf9b4abe3dabd3384524e4506124dce4e9cec6814 (diff)
downloadprofani-tty-a5e4e52567f32356c3ba637bc220ddb6a33248a3.tar.gz
Merge branch 'master' into type_out
Diffstat (limited to 'tests')
-rw-r--r--tests/test_contact_list.c84
-rw-r--r--tests/test_prof_autocomplete.c42
-rw-r--r--tests/test_prof_history.c22
3 files changed, 74 insertions, 74 deletions
diff --git a/tests/test_contact_list.c b/tests/test_contact_list.c
index 599c8ca1..18d5a6e4 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));
 }
 
@@ -339,7 +339,7 @@ static void find_first_exists(void)
     char *search = (char *) malloc(2 * sizeof(char));
     strcpy(search, "B");
 
-    char *result = find_contact(search);
+    char *result = contact_list_find_contact(search);
     assert_string_equals("Bob", result);
     free(result);
     free(search);
@@ -351,7 +351,7 @@ static void find_second_exists(void)
     contact_list_add("Dave", NULL, NULL);
     contact_list_add("Bob", NULL, NULL);
 
-    char *result = find_contact("Dav");
+    char *result = contact_list_find_contact("Dav");
     assert_string_equals("Dave", result);
     free(result);
 }
@@ -362,7 +362,7 @@ static void find_third_exists(void)
     contact_list_add("Dave", NULL, NULL);
     contact_list_add("Bob", NULL, NULL);
 
-    char *result = find_contact("Ja");
+    char *result = contact_list_find_contact("Ja");
     assert_string_equals("James", result);
     free(result);
 }
@@ -373,13 +373,13 @@ static void find_returns_null(void)
     contact_list_add("Dave", NULL, NULL);
     contact_list_add("Bob", NULL, NULL);
 
-    char *result = find_contact("Mike");
+    char *result = contact_list_find_contact("Mike");
     assert_is_null(result);
 }
 
 static void find_on_empty_returns_null(void)
 {
-    char *result = find_contact("James");
+    char *result = contact_list_find_contact("James");
     assert_is_null(result);
 }
 
@@ -389,8 +389,8 @@ static void find_twice_returns_second_when_two_match(void)
     contact_list_add("Jamie", NULL, NULL);
     contact_list_add("Bob", NULL, NULL);
 
-    char *result1 = find_contact("Jam");
-    char *result2 = find_contact(result1);
+    char *result1 = contact_list_find_contact("Jam");
+    char *result2 = contact_list_find_contact(result1);
     assert_string_equals("Jamie", result2);
     free(result1);
     free(result2);
@@ -409,11 +409,11 @@ static void find_five_times_finds_fifth(void)
     contact_list_add("Jamy", NULL, NULL);
     contact_list_add("Jamz", NULL, NULL);
 
-    char *result1 = find_contact("Jam");
-    char *result2 = find_contact(result1);
-    char *result3 = find_contact(result2);
-    char *result4 = find_contact(result3);
-    char *result5 = find_contact(result4);
+    char *result1 = contact_list_find_contact("Jam");
+    char *result2 = contact_list_find_contact(result1);
+    char *result3 = contact_list_find_contact(result2);
+    char *result4 = contact_list_find_contact(result3);
+    char *result5 = contact_list_find_contact(result4);
     assert_string_equals("Jamo", result5);
     free(result1);
     free(result2);
@@ -428,9 +428,9 @@ static void find_twice_returns_first_when_two_match_and_reset(void)
     contact_list_add("Jamie", NULL, NULL);
     contact_list_add("Bob", NULL, NULL);
 
-    char *result1 = find_contact("Jam");
-    reset_search_attempts();
-    char *result2 = find_contact(result1);
+    char *result1 = contact_list_find_contact("Jam");
+    contact_list_reset_search_attempts();
+    char *result2 = contact_list_find_contact(result1);
     assert_string_equals("James", result2);
     free(result1);
     free(result2);
@@ -444,10 +444,10 @@ static void removed_contact_not_in_search(void)
     contact_list_add("James", NULL, NULL);
     contact_list_add("Jamie", NULL, NULL);
 
-    char *result1 = find_contact("Jam"); // Jamatron
-    char *result2 = find_contact(result1); // Jambo
+    char *result1 = contact_list_find_contact("Jam"); // Jamatron
+    char *result2 = contact_list_find_contact(result1); // Jambo
     contact_list_remove("James");
-    char *result3 = find_contact(result2);
+    char *result3 = contact_list_find_contact(result2);
     assert_string_equals("Jamie", result3);
     free(result1);
     free(result2);
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);