diff options
author | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2013-09-24 12:13:49 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2013-09-25 01:08:58 -0300 |
commit | 069eb30fd2940bf65b378a8c214e3a338084b8c4 (patch) | |
tree | 3b07e49df84a86e0e34827ea4575cfe04223ebb1 | |
parent | 549f64b1e23af936c346c42d6ef496e7aa0aa165 (diff) | |
download | efl-devs/lucas/fix-eina-newfuncs.tar.gz |
eina: add test cases for eina_str_printfdevs/lucas/fix-eina-newfuncs
-rw-r--r-- | src/tests/eina/eina_test_str.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_str.c b/src/tests/eina/eina_test_str.c index 1d95f21b1a..b2fbef0819 100644 --- a/src/tests/eina/eina_test_str.c +++ b/src/tests/eina/eina_test_str.c @@ -339,6 +339,50 @@ START_TEST(str_convert) END_TEST #endif +static size_t _eina_str_printf_length(const char *fmt, ...) +{ + va_list ap; + size_t ret; + + va_start(ap, fmt); + ret = eina_str_vprintf_length(fmt, ap); + va_end(ap); + + return ret; +} + +START_TEST(str_printf_length) +{ + size_t len; + eina_init(); + + len = _eina_str_printf_length("test%d", 5); + fail_if(len != 5); + + len = _eina_str_printf_length(""); + fail_if(len != 0); + + eina_shutdown(); +} +END_TEST + +START_TEST(str_printf_dup) +{ + char *s; + eina_init(); + + s = eina_str_printf_dup("test%d", 5); + fail_if(s == NULL); + free(s); + + s = eina_str_printf_dup(""); + fail_if(s == NULL); + free(s); + + eina_shutdown(); +} +END_TEST + void eina_test_str(TCase *tc) { @@ -349,4 +393,6 @@ eina_test_str(TCase *tc) #ifdef HAVE_ICONV tcase_add_test(tc, str_convert); #endif + tcase_add_test(tc, str_printf_length); + tcase_add_test(tc, str_printf_dup); } |