about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-03-10 01:10:12 +0000
committerJames Booth <boothj5@gmail.com>2012-03-10 01:10:12 +0000
commitce7850d30fb8a441d3ed7f24f1844c6a9887886d (patch)
tree3655ff4782fc918d211b9e45e950572776025426
parent6576ec295848bcec8cfc8807b32a14cacbfc7ed3 (diff)
downloadprofani-tty-ce7850d30fb8a441d3ed7f24f1844c6a9887886d.tar.gz
More contact_list tests
-rw-r--r--test_contact_list.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/test_contact_list.c b/test_contact_list.c
index b7efffa4..35b6cb73 100644
--- a/test_contact_list.c
+++ b/test_contact_list.c
@@ -265,6 +265,54 @@ static void test_status_when_no_value(void)
     assert_is_null(james->status);
 }
 
+static void update_show(void)
+{
+    contact_list_add("James", "away", NULL);
+    contact_list_add("James", "dnd", NULL);
+    contact_list_t *list = get_contact_list();
+
+    assert_int_equals(1, list->size);
+    contact_t *james = list->contacts[0];
+    assert_string_equals("James", james->name);
+    assert_string_equals("dnd", james->show);
+}
+
+static void set_show_to_null(void)
+{
+    contact_list_add("James", "away", NULL);
+    contact_list_add("James", NULL, NULL);
+    contact_list_t *list = get_contact_list();
+
+    assert_int_equals(1, list->size);
+    contact_t *james = list->contacts[0];
+    assert_string_equals("James", james->name);
+    assert_string_equals("online", james->show);
+}
+
+static void update_status(void)
+{
+    contact_list_add("James", NULL, "I'm not here right now");
+    contact_list_add("James", NULL, "Gone to lunch");
+    contact_list_t *list = get_contact_list();
+
+    assert_int_equals(1, list->size);
+    contact_t *james = list->contacts[0];
+    assert_string_equals("James", james->name);
+    assert_string_equals("Gone to lunch", james->status);
+}
+
+static void set_status_to_null(void)
+{
+    contact_list_add("James", NULL, "Gone to lunch");
+    contact_list_add("James", NULL, NULL);
+    contact_list_t *list = get_contact_list();
+
+    assert_int_equals(1, list->size);
+    contact_t *james = list->contacts[0];
+    assert_string_equals("James", james->name);
+    assert_is_null(james->status);
+}
+
 void register_contact_list_tests(void)
 {
     TEST_MODULE("contact_list tests");
@@ -291,4 +339,8 @@ void register_contact_list_tests(void)
     TEST(test_show_online_when_empty_string);
     TEST(test_status_when_value);
     TEST(test_status_when_no_value);
+    TEST(update_show);
+    TEST(set_show_to_null);
+    TEST(update_status);
+    TEST(set_status_to_null);
 }