ajout tests NULL dans main
This commit is contained in:
84
main.c
84
main.c
@@ -1,8 +1,8 @@
|
|||||||
#include "ft_printf.h"
|
|
||||||
#include <stdio.h> // for printf
|
#include <stdio.h> // for printf
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <fcntl.h> // for dup() and dup2()
|
#include <fcntl.h> // for dup() and dup2()
|
||||||
|
|
||||||
|
int ft_printf(char *string, ...);
|
||||||
|
|
||||||
// macro to print :
|
// macro to print :
|
||||||
// first the string,
|
// first the string,
|
||||||
@@ -87,6 +87,8 @@
|
|||||||
close(outf); \
|
close(outf); \
|
||||||
close(outft);
|
close(outft);
|
||||||
|
|
||||||
|
int ft_compare(int fd1, int fd2, int *error, int output);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** this is the main function of tests, with a loooooot of tests, enjoy ;)
|
** this is the main function of tests, with a loooooot of tests, enjoy ;)
|
||||||
** if you call the executable without arguments, it will print the usage
|
** if you call the executable without arguments, it will print the usage
|
||||||
@@ -123,41 +125,42 @@ int main(int ac, char **av)
|
|||||||
|
|
||||||
if (ac == 1)
|
if (ac == 1)
|
||||||
{
|
{
|
||||||
printf("USAGE:\n"); //124G
|
printf("USAGE:\n");
|
||||||
printf("call ./ft_printf with arguments to launch tests :\n");
|
printf("call ./ft_printf with arguments to launch tests :\n");
|
||||||
printf("./ft_printf 'test' \n"); //167G
|
printf("./ft_printf 'test' \n");
|
||||||
printf("........... 'all' \n"); //254G
|
printf("........... 'all' \n");
|
||||||
printf("........... ... 'noflag' \n"); //256G
|
printf("........... ... 'noflag' \n");
|
||||||
printf("........... ... '0' \n"); //286G
|
printf("........... ... '0' \n");
|
||||||
printf("........... ... '-' \n"); //300G
|
printf("........... ... '-' \n");
|
||||||
printf("........... ... 'width' \n"); //315G
|
printf("........... ... 'width' \n");
|
||||||
printf("........... ... 'precision' \n"); //335G
|
printf("........... ... 'precision' \n");
|
||||||
printf("........... ... '*' \n"); //376G
|
printf("........... ... '*' \n");
|
||||||
printf("........... ... 'd' \n"); //414G
|
printf("........... ... 'd' \n");
|
||||||
printf("........... ... 'i' \n"); //440G
|
printf("........... ... 'i' \n");
|
||||||
printf("........... ... 'u' \n"); //465G
|
printf("........... ... 'u' \n");
|
||||||
printf("........... ... 'x' \n"); //490G
|
printf("........... ... 'x' \n");
|
||||||
printf("........... ... 'X' \n"); //500G
|
printf("........... ... 'X' \n");
|
||||||
printf("........... ... 'c' \n"); //511G
|
printf("........... ... 'c' \n");
|
||||||
printf("........... ... 's' \n"); //668G
|
printf("........... ... 's' \n");
|
||||||
printf("........... ... 'p' \n"); //685G
|
printf("........... ... 'p' \n");
|
||||||
printf("........... ... '%%' \n"); //795G
|
printf("........... ... '%%' \n");
|
||||||
printf("........... ... 'repetition'\n"); //716G
|
printf("........... ... 'NULL' \n");
|
||||||
printf("........... 'bonus' \n"); //738G
|
printf("........... ... 'repetition'\n");
|
||||||
printf("........... ..... '#' \n"); //
|
printf("........... 'bonus' \n");
|
||||||
printf("........... ..... ''' \n"); //
|
printf("........... ..... '#' \n");
|
||||||
printf("........... ..... ' ' \n"); //
|
printf("........... ..... ''' \n");
|
||||||
printf("........... ..... '+' \n"); //
|
printf("........... ..... ' ' \n");
|
||||||
printf("........... ..... 'e' \n"); //
|
printf("........... ..... '+' \n");
|
||||||
printf("........... ..... 'f' \n"); //
|
printf("........... ..... 'e' \n");
|
||||||
printf("........... ..... 'g' \n"); //
|
printf("........... ..... 'f' \n");
|
||||||
printf("........... ..... 'n' \n"); //
|
printf("........... ..... 'g' \n");
|
||||||
printf("........... ..... 'h' \n"); //
|
printf("........... ..... 'n' \n");
|
||||||
printf("........... ..... 'hh' \n"); //
|
printf("........... ..... 'h' \n");
|
||||||
printf("........... ..... 'l' \n"); //
|
printf("........... ..... 'hh' \n");
|
||||||
printf("........... ..... 'll' \n"); //
|
printf("........... ..... 'l' \n");
|
||||||
printf("........... ..... 'repetition'\n"); //
|
printf("........... ..... 'll' \n");
|
||||||
printf("........... 'error' \n"); //
|
printf("........... ..... 'repetition'\n");
|
||||||
|
printf("........... 'error' \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ////////////////////////////////////////////////////////////////// */
|
/* ////////////////////////////////////////////////////////////////// */
|
||||||
@@ -243,8 +246,8 @@ int main(int ac, char **av)
|
|||||||
// PRINT("%+4.4d", 12);
|
// PRINT("%+4.4d", 12);
|
||||||
// PRINT("%.4d", -12);
|
// PRINT("%.4d", -12);
|
||||||
// PRINT("%+.4d", -12);
|
// PRINT("%+.4d", -12);
|
||||||
// PRINT("%+4.4d", -12);
|
|
||||||
// PRINT("%+10.7i % 010i %-#7.10x %7p %10c %7.10s", 122, -122, 122, "122", 122, "-122")
|
// PRINT("%+10.7i % 010i %-#7.10x %7p %10c %7.10s", 122, -122, 122, "122", 122, "-122")
|
||||||
|
printf("%s\n", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ////////////////////////////////////////////////////////////////// */
|
/* ////////////////////////////////////////////////////////////////// */
|
||||||
@@ -714,6 +717,15 @@ int main(int ac, char **av)
|
|||||||
PRINT("%%%%%i%%%%", 1);
|
PRINT("%%%%%i%%%%", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ac == 2 || !strcmp(av[2], "repetition"))
|
||||||
|
{
|
||||||
|
printf("\n----------------------------------------------------------------\n");
|
||||||
|
printf("with char NULL\n");
|
||||||
|
printf("----------------------------------------------------------------\n\n");
|
||||||
|
|
||||||
|
PRINT("%s", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (ac == 2 || !strcmp(av[2], "repetition"))
|
if (ac == 2 || !strcmp(av[2], "repetition"))
|
||||||
{
|
{
|
||||||
printf("\n----------------------------------------------------------------\n");
|
printf("\n----------------------------------------------------------------\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user