From 214f729ef66e5d119ffce5f601cbf09c6492e6fd Mon Sep 17 00:00:00 2001 From: nash Date: Mon, 2 Aug 2010 09:44:06 +0000 Subject: [PATCH] Beef up the strncpy test git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@50740 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/tests/eina_test_ustr.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/tests/eina_test_ustr.c b/src/tests/eina_test_ustr.c index d069a96..458f8d2 100644 --- a/src/tests/eina_test_ustr.c +++ b/src/tests/eina_test_ustr.c @@ -114,14 +114,27 @@ START_TEST(eina_unicode_strncpy_test) rv = eina_unicode_strncpy(buf,STR1,1); fail_if(rv != buf); fail_if(buf[1] != '7'); - fail_if(buf[0] != STR1[1]); + fail_if(buf[0] != STR1[0]); buf[9] = '7'; - rv = eina_unicode_strncpy(buf, STR1, 10); + rv = eina_unicode_strncpy(buf, STR4, 10); fail_if(rv != buf); - fail_if(eina_unicode_strcmp(buf,STR1) != 0); + fail_if(eina_unicode_strcmp(buf,STR4) != 0); fail_if(buf[9] != 0); + buf[0] = '7'; + rv = eina_unicode_strncpy(buf, STR1, 0); + fail_if(buf[0] != '7'); + + /* may segfault */ + buf[0] = '7'; + rv = eina_unicode_strncpy(buf, NULL, 0); + fail_if(buf[0] != '7'); + + /* Hopefully won't segfault */ + rv = eina_unicode_strncpy(NULL, STR1, 0); + fail_if(rv != NULL); + eina_shutdown(); } END_TEST -- 2.7.4