summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-05-29 13:49:36 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-29 13:49:36 -0400
commit075d655a199f1d3797c66da9397be22b79956d5f (patch)
treef86613d76e9a6a2f73bfdc9a30fa3da8a463eb61
parent2a3bf30abc084761e2c0212454ae623facaf1e24 (diff)
eina: add test for eina_slstr_copy_new_length.
Summary: Depends on D8800 Reviewers: zmike Reviewed By: zmike Subscribers: zmike, #reviewers, #committers Tags: #efl Maniphest Tasks: T7832 Differential Revision: https://phab.enlightenment.org/D9016
-rw-r--r--src/tests/eina/eina_test_slstr.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_slstr.c b/src/tests/eina/eina_test_slstr.c
index fd17cef042..4de2dca3fe 100644
--- a/src/tests/eina/eina_test_slstr.c
+++ b/src/tests/eina/eina_test_slstr.c
@@ -178,6 +178,36 @@ EFL_START_TEST(slstr_thread)
178} 178}
179EFL_END_TEST 179EFL_END_TEST
180 180
181#define STRL "Hello world 7"
182
183static Eina_Slstr *
184_slstr_length(unsigned int length)
185{
186 Eina_Tmpstr *str = eina_tmpstr_add(STRL);
187
188 return eina_slstr_copy_new_length(str, length);
189}
190
191EFL_START_TEST(slstr_length)
192{
193 unsigned int i;
194
195 for (i = 0; i < strlen(STRL); i++)
196 {
197 Eina_Slstr *slstr;
198 char *str;
199
200 slstr = _slstr_length(i);
201 str = eina_strndup(STRL, i);
202 ck_assert_str_eq(str, slstr);
203
204 free(str);
205 }
206
207 eina_slstr_local_clear();
208}
209EFL_END_TEST
210
181void 211void
182eina_test_slstr(TCase *tc) 212eina_test_slstr(TCase *tc)
183{ 213{
@@ -189,4 +219,5 @@ eina_test_slstr(TCase *tc)
189 tcase_add_test(tc, slstr_slstr_printf); 219 tcase_add_test(tc, slstr_slstr_printf);
190 tcase_add_test(tc, slstr_many); 220 tcase_add_test(tc, slstr_many);
191 tcase_add_test(tc, slstr_thread); 221 tcase_add_test(tc, slstr_thread);
222 tcase_add_test(tc, slstr_length);
192} 223}