summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.de.marchi@gmail.com>2013-09-24 12:13:49 -0300
committerLucas De Marchi <lucas.de.marchi@gmail.com>2013-09-25 01:08:58 -0300
commit069eb30fd2940bf65b378a8c214e3a338084b8c4 (patch)
tree3b07e49df84a86e0e34827ea4575cfe04223ebb1
parent549f64b1e23af936c346c42d6ef496e7aa0aa165 (diff)
eina: add test cases for eina_str_printfdevs/lucas/fix-eina-newfuncs
-rw-r--r--src/tests/eina/eina_test_str.c46
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)
339END_TEST 339END_TEST
340#endif 340#endif
341 341
342static size_t _eina_str_printf_length(const char *fmt, ...)
343{
344 va_list ap;
345 size_t ret;
346
347 va_start(ap, fmt);
348 ret = eina_str_vprintf_length(fmt, ap);
349 va_end(ap);
350
351 return ret;
352}
353
354START_TEST(str_printf_length)
355{
356 size_t len;
357 eina_init();
358
359 len = _eina_str_printf_length("test%d", 5);
360 fail_if(len != 5);
361
362 len = _eina_str_printf_length("");
363 fail_if(len != 0);
364
365 eina_shutdown();
366}
367END_TEST
368
369START_TEST(str_printf_dup)
370{
371 char *s;
372 eina_init();
373
374 s = eina_str_printf_dup("test%d", 5);
375 fail_if(s == NULL);
376 free(s);
377
378 s = eina_str_printf_dup("");
379 fail_if(s == NULL);
380 free(s);
381
382 eina_shutdown();
383}
384END_TEST
385
342void 386void
343eina_test_str(TCase *tc) 387eina_test_str(TCase *tc)
344{ 388{
@@ -349,4 +393,6 @@ eina_test_str(TCase *tc)
349#ifdef HAVE_ICONV 393#ifdef HAVE_ICONV
350 tcase_add_test(tc, str_convert); 394 tcase_add_test(tc, str_convert);
351#endif 395#endif
396 tcase_add_test(tc, str_printf_length);
397 tcase_add_test(tc, str_printf_dup);
352} 398}