about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-12-17 22:58:27 +0000
committerJames Booth <boothj5@gmail.com>2013-12-17 22:58:27 +0000
commitd5a2e645bf2d5ab6852e45a5a5268759ed2c2b2a (patch)
treef630ea740b0074706c9429cc047d8e8fba90159c
parent99f4eeb60dfbf330312d472da0ec2606b0a79aff (diff)
downloadprofani-tty-d5a2e645bf2d5ab6852e45a5a5268759ed2c2b2a.tar.gz
Tests valid and invalid resource presence strings
-rw-r--r--tests/test_common.c40
-rw-r--r--tests/test_common.h8
-rw-r--r--tests/testsuite.c8
3 files changed, 56 insertions, 0 deletions
diff --git a/tests/test_common.c b/tests/test_common.c
index 124a1181..0d02bbd0 100644
--- a/tests/test_common.c
+++ b/tests/test_common.c
@@ -424,3 +424,43 @@ void next_available_24_first_big_gap(void **state)
 
     assert_int_equal(24, result);
 }
+
+void test_online_is_valid_resource_presence_string(void **state)
+{
+    assert_true(valid_resource_presence_string("online"));
+}
+
+void test_chat_is_valid_resource_presence_string(void **state)
+{
+    assert_true(valid_resource_presence_string("chat"));
+}
+
+void test_away_is_valid_resource_presence_string(void **state)
+{
+    assert_true(valid_resource_presence_string("away"));
+}
+
+void test_xa_is_valid_resource_presence_string(void **state)
+{
+    assert_true(valid_resource_presence_string("xa"));
+}
+
+void test_dnd_is_valid_resource_presence_string(void **state)
+{
+    assert_true(valid_resource_presence_string("dnd"));
+}
+
+void test_available_is_not_valid_resource_presence_string(void **state)
+{
+    assert_false(valid_resource_presence_string("available"));
+}
+
+void test_unavailable_is_not_valid_resource_presence_string(void **state)
+{
+    assert_false(valid_resource_presence_string("unavailable"));
+}
+
+void test_blah_is_not_valid_resource_presence_string(void **state)
+{
+    assert_false(valid_resource_presence_string("blah"));
+}
diff --git a/tests/test_common.h b/tests/test_common.h
index 903570e3..227eec24 100644
--- a/tests/test_common.h
+++ b/tests/test_common.h
@@ -30,3 +30,11 @@ void next_available_9_in_first_gap(void **state);
 void next_available_0_in_first_gap(void **state);
 void next_available_11_in_first_gap(void **state);
 void next_available_24_first_big_gap(void **state);
+void test_online_is_valid_resource_presence_string(void **state);
+void test_chat_is_valid_resource_presence_string(void **state);
+void test_away_is_valid_resource_presence_string(void **state);
+void test_xa_is_valid_resource_presence_string(void **state);
+void test_dnd_is_valid_resource_presence_string(void **state);
+void test_available_is_not_valid_resource_presence_string(void **state);
+void test_unavailable_is_not_valid_resource_presence_string(void **state);
+void test_blah_is_not_valid_resource_presence_string(void **state);
diff --git a/tests/testsuite.c b/tests/testsuite.c
index d23f13d5..9c05d031 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -47,6 +47,14 @@ int main(int argc, char* argv[]) {
         unit_test(next_available_0_in_first_gap),
         unit_test(next_available_11_in_first_gap),
         unit_test(next_available_24_first_big_gap),
+        unit_test(test_online_is_valid_resource_presence_string),
+        unit_test(test_chat_is_valid_resource_presence_string),
+        unit_test(test_away_is_valid_resource_presence_string),
+        unit_test(test_xa_is_valid_resource_presence_string),
+        unit_test(test_dnd_is_valid_resource_presence_string),
+        unit_test(test_available_is_not_valid_resource_presence_string),
+        unit_test(test_unavailable_is_not_valid_resource_presence_string),
+        unit_test(test_blah_is_not_valid_resource_presence_string),
 
         unit_test(clear_empty),
         unit_test(reset_after_create),