summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 73afd2f)
raw | patch | inline | side by side (parent: 73afd2f)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 7 Dec 2013 14:05:08 +0000 (15:05 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 7 Dec 2013 14:05:08 +0000 (15:05 +0100) |
t/core/object_test.c | patch | blob | history |
diff --git a/t/core/object_test.c b/t/core/object_test.c
index f39819cc1f59f6e634ca671dae0230bde3c95afd..e00d300177b4694a5fd2b6d90a1ee9d9a3e72c84 100644 (file)
--- a/t/core/object_test.c
+++ b/t/core/object_test.c
}
END_TEST
+START_TEST(test_obj_cmp)
+{
+ sdb_object_t *obj1, *obj2, *obj3, *obj4;
+ int status;
+
+ obj1 = sdb_object_create("a", noop_type);
+ obj2 = sdb_object_create("b", noop_type);
+ obj3 = sdb_object_create("B", noop_type);
+ obj4 = sdb_object_create("c", noop_type);
+
+ status = sdb_object_cmp_by_name(obj1, obj2);
+ fail_unless(status == -1,
+ "sdb_object_cmp_by_name('a', 'b') = %d; expected: -1", status);
+ status = sdb_object_cmp_by_name(obj2, obj3);
+ fail_unless(status == 0,
+ "sdb_object_cmp_by_name('b', 'B') = %d; expected: 0", status);
+ status = sdb_object_cmp_by_name(obj4, obj3);
+ fail_unless(status == 1,
+ "sdb_object_cmp_by_name('c', 'B') = %d; expected: 1", status);
+ status = sdb_object_cmp_by_name(obj1, obj1);
+ fail_unless(status == 0,
+ "sdb_object_cmp_by_name('a', 'a') = %d; expected: 0", status);
+
+ sdb_object_deref(obj1);
+ sdb_object_deref(obj2);
+ sdb_object_deref(obj3);
+ sdb_object_deref(obj4);
+}
+END_TEST
+
Suite *
core_object_suite(void)
{
tcase_add_test(tc, test_obj_create);
tcase_add_test(tc, test_obj_wrapper);
tcase_add_test(tc, test_obj_ref);
+ tcase_add_test(tc, test_obj_cmp);
suite_add_tcase(s, tc);
return s;