diff options
Diffstat (limited to 'tests/printf_tester_tests.c')
| -rw-r--r-- | tests/printf_tester_tests.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/printf_tester_tests.c b/tests/printf_tester_tests.c index 7bdf9de..936dbbc 100644 --- a/tests/printf_tester_tests.c +++ b/tests/printf_tester_tests.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/06 18:15:31 by cacharle #+# #+# */ -/* Updated: 2020/02/06 18:15:32 by cacharle ### ########.fr */ +/* Updated: 2020/02/06 19:02:48 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,7 +18,9 @@ void test_printf_tester(void) int t = 50; char c = 'a'; +#ifdef FT_PRINTF_TEST_BONUS ASSERT_PRINTF("p0 % .3s\n", "cccc"); +#endif ASSERT_PRINTF("pp %.50d\n", 10000); ASSERT_PRINTF("p1 %.4s\n", "cccc"); ASSERT_PRINTF("p2 %.10s\n", "cccc"); @@ -118,8 +120,10 @@ void test_printf_tester(void) /* ASSERT_PRINTF("%d\n", printf("1chiffre 1 %d chiffre 2 %d\n", 42, -42)); */ /* ASSERT_PRINTF("%d\n", printf("2chiffre 1 % d chiffre 2 % d\n", 42, -42)); */ /* ASSERT_PRINTF("%d\n\n", printf("4chiffre 1 %-12d chiffre 2 %-12d\n\n", 42, -42)); */ +#ifdef FT_PRINTF_TEST_BONUS ASSERT_PRINTF("% i\n", -60); ASSERT_PRINTF("% i\n", -60); +#endif ASSERT_PRINTF("%1p\n", &t); ASSERT_PRINTF("%1p\n", &t); ASSERT_PRINTF("t1 %050d\n", 10); @@ -141,7 +145,9 @@ void test_printf_tester(void) /* ASSERT_PRINTF("%d\n\n", printf("15chiffre 1 %.d chiffre 2 %.d\n\n", 42, -42)); */ /* ASSERT_PRINTF("%d\n\n", printf("4caractere 1 %12c caractere 2 %12c\n\n", 'a', 'c')); */ ASSERT_PRINTF("1caractere 1 %c caractere 2 %c\n\n", 'a', 'c'); +#ifdef FT_PRINTF_TEST_BONUS ASSERT_PRINTF("3caractere 1 % c caractere 2 % c\n\n", 'a', 'c'); +#endif /* ASSERT_PRINTF("%d\n\n", printf("1hexa-maj 1 %X hexa-maj 2 %X\n\n", 42, -42)); */ /* ASSERT_PRINTF("%d\n\n", printf("3hexa-maj 1 % X hexa-maj 2 % X\n\n", 42, -42)); */ /* ASSERT_PRINTF("%d\n\n", printf("4hexa-maj 1 %12X hexa-maj 2 %int12X\n\n", 42, -42)); */ @@ -212,11 +218,13 @@ void test_printf_tester(void) ASSERT_PRINTF("percent 2 %12%"); ASSERT_PRINTF("percent 3 %-12%"); ASSERT_PRINTF("percent 4 %0%"); +#ifdef FT_PRINTF_TEST_BONUS ASSERT_PRINTF("percent 5 % %"); ASSERT_PRINTF("percent 6 % 15%"); ASSERT_PRINTF("percent 7 % 12%"); ASSERT_PRINTF("percent 8 % *%", 13); ASSERT_PRINTF("%n", &t); +#endif ASSERT_PRINTF("%d\n", t); ASSERT_PRINTF("%n", NULL); ASSERT_PRINTF("%d\n", t); @@ -224,7 +232,9 @@ void test_printf_tester(void) ASSERT_PRINTF("%d\n", t); ASSERT_PRINTF("%s %n", "hello world", &t); ASSERT_PRINTF("%d\n", t); +#ifdef FT_PRINTF_TEST_BONUS ASSERT_PRINTF("% .1s %n", "hey", &t); +#endif ASSERT_PRINTF("%d\n", t); ASSERT_PRINTF("%40s %n", "co", &t); ASSERT_PRINTF("%d\n", t); |
