summaryrefslogtreecommitdiff
path: root/src/tests/eina/eina_test_tmpstr.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-02-09 13:43:40 +0000
committerTom Hacohen <tom@stosb.com>2015-02-09 13:55:13 +0000
commitf7a6880d5b0f25c8004d2bb3ba6385cc0d8869c5 (patch)
treeb5ce7715d61385f40283174fc3e62ce7198a9ecd /src/tests/eina/eina_test_tmpstr.c
parentf9548fa7da37be05f316d2d68fdcfb4826d4ab42 (diff)
Eina tmpstr: deprecate tmpstr_strlen and add tmpstr_len.
Confusingly enough, strlen was actually returning strlen + 1 for strings. The new functions behaves as expected.
Diffstat (limited to '')
-rw-r--r--src/tests/eina/eina_test_tmpstr.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_tmpstr.c b/src/tests/eina/eina_test_tmpstr.c
index ba3d3e703d..72fb7c840b 100644
--- a/src/tests/eina/eina_test_tmpstr.c
+++ b/src/tests/eina/eina_test_tmpstr.c
@@ -60,8 +60,31 @@ START_TEST(tmpstr_simple)
60} 60}
61END_TEST 61END_TEST
62 62
63START_TEST(tmpstr_len)
64{
65 eina_init();
66
67 const char *str1 = "12345";
68 const char *str2 = "123456789";
69 Eina_Tmpstr *tstr1 = eina_tmpstr_add(str1);
70 Eina_Tmpstr *tstr2 = eina_tmpstr_add(str2);
71 Eina_Tmpstr *tstr_empty = eina_tmpstr_add("");
72
73 ck_assert_int_eq(eina_tmpstr_len(tstr1), strlen(str1));
74 ck_assert_int_eq(eina_tmpstr_len(tstr2), strlen(str2));
75
76 ck_assert_int_eq(eina_tmpstr_len(tstr_empty), 0);
77
78 eina_tmpstr_del(tstr1);
79 eina_tmpstr_del(tstr2);
80
81 eina_shutdown();
82}
83END_TEST
84
63void 85void
64eina_test_tmpstr(TCase *tc) 86eina_test_tmpstr(TCase *tc)
65{ 87{
66 tcase_add_test(tc, tmpstr_simple); 88 tcase_add_test(tc, tmpstr_simple);
89 tcase_add_test(tc, tmpstr_len);
67} 90}