diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-08-27 16:17:08 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-08-28 11:16:28 +0100 |
commit | 0bb46b877364cea6ca8536e397c35cd18b31f42c (patch) | |
tree | d54f2d301be4c7e2f8dabcedca188a46cd9f1d66 | |
parent | 290d7c19352ec88d113be42772107894343db48f (diff) |
test wocky_resource_contact_equal
-rw-r--r-- | tests/wocky-resource-contact-test.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/wocky-resource-contact-test.c b/tests/wocky-resource-contact-test.c index 0d4aa16..00fe11a 100644 --- a/tests/wocky-resource-contact-test.c +++ b/tests/wocky-resource-contact-test.c @@ -75,6 +75,34 @@ test_get_bare_contact (void) g_object_unref (resource_contact); } +static void +test_equal (void) +{ + WockyBareContact *a, *b; + WockyResourceContact *a_1, *a_2, *b_1; + + a = wocky_bare_contact_new ("a@example.net"); + a_1 = wocky_resource_contact_new (a, "Resource1"); + + g_assert (wocky_resource_contact_equal (a_1, a_1)); + g_assert (!wocky_resource_contact_equal (a_1, NULL)); + g_assert (!wocky_resource_contact_equal (NULL, a_1)); + + a_2 = wocky_resource_contact_new (a, "Resource2"); + g_assert (!wocky_resource_contact_equal (a_1, a_2)); + + b = wocky_bare_contact_new ("b@example.net"); + b_1 = wocky_resource_contact_new (b, "Resource1"); + g_assert (!wocky_resource_contact_equal (b_1, a_1)); + g_assert (!wocky_resource_contact_equal (b_1, a_2)); + + g_object_unref (a); + g_object_unref (b); + g_object_unref (a_1); + g_object_unref (a_2); + g_object_unref (b_1); +} + int main (int argc, char **argv) { @@ -85,6 +113,7 @@ main (int argc, char **argv) g_test_add_func ("/resource-contact/instantiation", test_instantiation); g_test_add_func ("/resource-contact/get-resource", test_get_resource); g_test_add_func ("/resource-contact/get-bare-contact", test_get_bare_contact); + g_test_add_func ("/resource-contact/equal", test_equal); result = g_test_run (); test_deinit (); |