From dd7eb9d8f8b8b7ba56a6b3f7e64f57a1419b064c Mon Sep 17 00:00:00 2001 From: Fernando Gonzalez-Morales <542@holbertonschool.com> Date: Mon, 22 Oct 2018 21:40:42 +0000 Subject: [PATCH] Closes #14. Ready for check 0 --- holberton.h | 1 + printf.c | 24 ------------------------ tests/small_tests.c | 25 +++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 24 deletions(-) create mode 100644 tests/small_tests.c diff --git a/holberton.h b/holberton.h index 5d751f6..eafd1e6 100644 --- a/holberton.h +++ b/holberton.h @@ -14,5 +14,6 @@ typedef struct printer int _putchar(char c); +int _printf(const char *format, ...); #endif diff --git a/printf.c b/printf.c index a4117c2..fe4b8d3 100644 --- a/printf.c +++ b/printf.c @@ -1,4 +1,3 @@ -#include /* for testing only */ #include /* va_list, va_start, va_arg, va_end macros */ #include /* NULL macro */ #include "holberton.h" /* _putchar */ @@ -77,26 +76,3 @@ int _printf(const char *format, ...) return (count); } -/* TODO: REMOVE BEFORE PUSHING TO MASTER! */ -/** - * main - tests _printf against stdio::printf - * Return: 0 on SUCCESS - */ -int main(void) -{ - int a, b; - - a = printf("a\n"); - b = _printf("a\n"); - printf("(%d, %d)\n", a, b); - - a = printf("%c\n", 'A'); - b = _printf("%c\n", 'A'); - printf("(%d, %d)\n", a, b); - - a = printf("%s\n", "Holberton"); - b = _printf("%s\n", "Holberton"); - printf("(%d, %d)\n", a, b); - - return (0); -} diff --git a/tests/small_tests.c b/tests/small_tests.c new file mode 100644 index 0000000..c0e1ff8 --- /dev/null +++ b/tests/small_tests.c @@ -0,0 +1,25 @@ +#include +#include "../holberton.h" + +/** + * main - tests _printf against stdio::printf + * Return: 0 on SUCCESS + */ +int main(void) +{ + int a, b; + + a = printf("a\n"); + b = _printf("a\n"); + printf("(%d, %d)\n", a, b); + + a = printf("%c\n", 'A'); + b = _printf("%c\n", 'A'); + printf("(%d, %d)\n", a, b); + + a = printf("%s\n", "Holberton"); + b = _printf("%s\n", "Holberton"); + printf("(%d, %d)\n", a, b); + + return (0); +}