aboutsummaryrefslogtreecommitdiff
path: root/tests/printf_tester_tests.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-02-06 19:26:06 +0100
committerCharles <sircharlesaze@gmail.com>2020-02-06 19:26:06 +0100
commit65e8a36e62d7b27ec708d736b96104f2a976092d (patch)
tree724d2384aa15f1a34d4a47a157ba814cbdc043bc /tests/printf_tester_tests.c
parentdb86fa3cb48a54ea614baee6dc02308be1649571 (diff)
parente2ea3bf1c721d0c7027f488e19ecd5e5f67af7c1 (diff)
downloadft_printf_test-65e8a36e62d7b27ec708d736b96104f2a976092d.tar.gz
ft_printf_test-65e8a36e62d7b27ec708d736b96104f2a976092d.tar.bz2
ft_printf_test-65e8a36e62d7b27ec708d736b96104f2a976092d.zip
Merge branch 'nobonus'
Diffstat (limited to 'tests/printf_tester_tests.c')
-rw-r--r--tests/printf_tester_tests.c12
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);