summaryrefslogtreecommitdiff
path: root/check-qstring.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2009-11-18 23:05:29 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:19 -0600
commit64084a03c375802150c5d1d0d6e72606f23553a7 (patch)
tree5ad5dcd43509879f3c4f7eb905c25f02e353cdf3 /check-qstring.c
parentf08932c8802607f9391d5c79b5ed53c8090cd6cd (diff)
utests: Add qstring_from_substr() unit-test
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'check-qstring.c')
-rw-r--r--check-qstring.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/check-qstring.c b/check-qstring.c
index 412038adb..c308a63ea 100644
--- a/check-qstring.c
+++ b/check-qstring.c
@@ -71,6 +71,19 @@ START_TEST(qstring_append_chr_test)
}
END_TEST
+START_TEST(qstring_from_substr_test)
+{
+ QString *qs;
+
+ qs = qstring_from_substr("virtualization", 3, 9);
+ fail_unless(qs != NULL);
+ fail_unless(strcmp(qstring_get_str(qs), "tualiza") == 0);
+
+ QDECREF(qs);
+}
+END_TEST
+
+
START_TEST(qobject_to_qstring_test)
{
QString *qstring;
@@ -95,6 +108,7 @@ static Suite *qstring_suite(void)
tcase_add_test(qstring_public_tcase, qstring_destroy_test);
tcase_add_test(qstring_public_tcase, qstring_get_str_test);
tcase_add_test(qstring_public_tcase, qstring_append_chr_test);
+ tcase_add_test(qstring_public_tcase, qstring_from_substr_test);
tcase_add_test(qstring_public_tcase, qobject_to_qstring_test);
return s;