cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=2e260f019ae4ca23bf3c73fc773ef6a45b7fc707
commit 2e260f019ae4ca23bf3c73fc773ef6a45b7fc707 Author: vivek <vivek.el...@samsung.com> Date: Fri Feb 20 12:24:12 2015 +0100 eina: add test case for eina unicode escape function. Summary: Added test case for eina_unicode_escape function Signed-off-by: vivek <vivek.el...@samsung.com> Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1963 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/tests/eina/eina_test_ustr.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/tests/eina/eina_test_ustr.c b/src/tests/eina/eina_test_ustr.c index 048bace..f9c28d3 100644 --- a/src/tests/eina/eina_test_ustr.c +++ b/src/tests/eina/eina_test_ustr.c @@ -336,6 +336,32 @@ START_TEST(eina_unicode_strstr_test) } END_TEST +START_TEST(eina_unicode_escape_test) +{ + Eina_Unicode str[][10] = {{'P', 'a', ' ', 'O', 'n', 0}, + {'P', 'a', ' ', '\\', '\'',0}, + {'n', 0}, {0}}; + Eina_Unicode result_str[][10] = {{'P', 'a', '\\',' ', 'O', 'n', 0}, + {'P', 'a', '\\',' ', '\\','\\', '\\','\'',0}, + {'n', 0}, {0}}; + Eina_Unicode *buf; + size_t i; + + eina_init(); + + for (i = 0; i < sizeof(str)/sizeof(str[0]); ++i) + { + buf = eina_unicode_escape(str[i]); + fail_if(!buf); + fail_if(eina_unicode_strlen(buf) != eina_unicode_strlen(result_str[i])); + fail_if(eina_unicode_strcmp(buf, result_str[i]) != 0); + free(buf); + } + + eina_shutdown(); +} +END_TEST + START_TEST(eina_unicode_utf8) { int ind; @@ -586,6 +612,7 @@ eina_test_ustr(TCase *tc) tcase_add_test(tc,eina_unicode_strnlen_test); tcase_add_test(tc,eina_unicode_strdup_test); tcase_add_test(tc,eina_unicode_strstr_test); + tcase_add_test(tc, eina_unicode_escape_test); tcase_add_test(tc,eina_unicode_utf8); tcase_add_test(tc,eina_unicode_utf8_conversion); --