diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2012-11-28 15:53:07 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2012-11-28 17:32:55 +0100 |
commit | 05b70b7027857b43a18971fcb74062299dc5f9d3 (patch) | |
tree | 84412bff031b190fc6d713cc5ff9a3ac8f1b8e55 /test | |
parent | e6256415834559d73fc6e51a2a648ad795fe88f4 (diff) |
Add test case for handling int in entities
Diffstat (limited to 'test')
-rw-r--r-- | test/test-entity.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test-entity.c b/test/test-entity.c index aff2a59..199307b 100644 --- a/test/test-entity.c +++ b/test/test-entity.c @@ -292,6 +292,27 @@ START_TEST(test_multi_props_clear) END_TEST +START_TEST(test_int64_props) +{ + OsinfoEntity *ent = g_object_new(osinfo_dummy_get_type(), "id", "myentity", NULL); + + osinfo_entity_set_param_int64(ent, "my_int", 10); + fail_unless(osinfo_entity_get_param_value_int64(ent, "my_int") == 10); + osinfo_entity_set_param_int64(ent, "my_neg_int", -20); + fail_unless(osinfo_entity_get_param_value_int64(ent, "my_neg_int") == -20); + osinfo_entity_set_param_int64(ent, "my_str", 30); + fail_unless(osinfo_entity_get_param_value_int64(ent, "my_str") == 30); + osinfo_entity_set_param_int64(ent, "my_neg_str", -40); + fail_unless(osinfo_entity_get_param_value_int64(ent, "my_neg_str") == -40); + fail_unless(osinfo_entity_get_param_value_int64_with_default(ent, "my_neg_str", 1234) == -40); + + fail_unless(osinfo_entity_get_param_value_int64(ent, "missing") == -1); + fail_unless(osinfo_entity_get_param_value_int64_with_default(ent, "missing", 1234) == 1234); + + g_object_unref(ent); +} +END_TEST + static Suite * entity_suite(void) { @@ -303,6 +324,7 @@ entity_suite(void) tcase_add_test(tc, test_multi_prop_value); tcase_add_test(tc, test_multi_props); tcase_add_test(tc, test_multi_props_clear); + tcase_add_test(tc, test_int64_props); suite_add_tcase(s, tc); return s; } |