aboutsummaryrefslogtreecommitdiff
path: root/tests/printf_tester_tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/printf_tester_tests.c')
-rw-r--r--tests/printf_tester_tests.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/tests/printf_tester_tests.c b/tests/printf_tester_tests.c
index b68d779..936dbbc 100644
--- a/tests/printf_tester_tests.c
+++ b/tests/printf_tester_tests.c
@@ -1,3 +1,15 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* printf_tester_tests.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/06 18:15:31 by cacharle #+# #+# */
+/* Updated: 2020/02/06 19:02:48 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
#include <stdlib.h>
#include "../header.h"
@@ -6,7 +18,9 @@ void test_printf_tester(void)
int t = 50;
char c = 'a';
-// ASSERT_PRINTF("p0 % .3s\n", "cccc");
+#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");
@@ -106,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)); */
-/* ASSERT_PRINTF("% i\n", -60);
- ASSERT_PRINTF("% i\n", -60);*/
+#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);
@@ -129,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');
-// ASSERT_PRINTF("3caractere 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)); */
@@ -160,7 +178,7 @@ void test_printf_tester(void)
ASSERT_PRINTF("04 Test de chiffre sans h : %d, et %d\n", 432767, -432767);
/* ASSERT_PRINTF("%d\n", printf("03 This is a float : %f\n\n", 45.236)); */
/* ASSERT_PRINTF("%d\n", printf("02 This is a float : %.3f\n\n", 45.236)); */
- /* ASSERT_PRINTF("%d\n", printf("01 This is a float : %3f\n\n", 45.236)); */
+ /* ASSERT_PRINTF("%d\n", printf("01 This is a float : %3f\n\n", 45.236)); */
/* ASSERT_PRINTF("%d\n", printf("000 This is a float : %f\n\n", -45.236)); */
/* ASSERT_PRINTF("%d\n", printf("0 This is a float : %.3f\n\n", -45.236)); */
/* ASSERT_PRINTF("%d\n", printf("00 This is a float : %3f\n\n", -45.236)); */
@@ -200,11 +218,13 @@ void test_printf_tester(void)
ASSERT_PRINTF("percent 2 %12%");
ASSERT_PRINTF("percent 3 %-12%");
ASSERT_PRINTF("percent 4 %0%");
-// ASSERT_PRINTF("percent 5 % %");
-// ASSERT_PRINTF("percent 6 % 15%");
-// ASSERT_PRINTF("percent 7 % 12%");
-// ASSERT_PRINTF("percent 8 % *%", 13);
-// ASSERT_PRINTF("%n", &t);
+#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);
@@ -212,11 +232,13 @@ void test_printf_tester(void)
ASSERT_PRINTF("%d\n", t);
ASSERT_PRINTF("%s %n", "hello world", &t);
ASSERT_PRINTF("%d\n", t);
-// ASSERT_PRINTF("% .1s %n", "hey", &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);
- /* ASSERT_PRINTF("%050 d%n", 500, &t); */
+ ASSERT_PRINTF("%050d%n", 500, &t);
ASSERT_PRINTF("%d\n", t);
/* ASSERT_PRINTF("%d\n\n", printf("1string 1 %s string 2 %s\n\n", "toto", "bonjour")); */
/* ASSERT_PRINTF("%d\n\n", printf("3string 1 % s string 2 % s\n\n", "toto", "bonjour")); */