Beef up the strncpy test

SVN revision: 50740
This commit is contained in:
Brett Nash 2010-08-02 09:44:06 +00:00
parent 7f83020567
commit d3655ee501
1 changed files with 16 additions and 3 deletions

View File

@ -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