-
Notifications
You must be signed in to change notification settings - Fork 0
/
printfest.c
64 lines (58 loc) · 3.03 KB
/
printfest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cvidon <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/03 10:11:59 by cvidon #+# #+# */
/* Updated: 2022/01/28 18:42:32 by clem9nt 888 ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
#include <limits.h>
#include <stdio.h>
#define RET fprintf(stdout, " > %i\n", ret)
/*
** @brief ft_printf tester.
*/
int main(void)
{
int ret;
char *null;
null = NULL;
fprintf(stdout, "Printf testing...\n");
ft_printf ("%");
ft_printf ("", "");
fprintf(stdout, "\n ---PCT---\n\n");
ret = ft_printf ("%% %%%%"); RET;
ret = fprintf(stdout, "%% %%%%"); RET;
fprintf(stdout, "\n ---CHR---\n\n");
ret = ft_printf ("%c %c %c %c %c %c", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
ret = fprintf(stdout, "%c %c %c %c %c %c", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
fprintf(stdout, "\n ---STR---\n\n");
ret = ft_printf ("%s %s %s", "string", "", null); RET;
ret = fprintf(stdout, "%s %s %s", "string", "", null); RET;
fprintf(stdout, "\n ---NBR---\n\n");
ret = ft_printf ("%i %i %i %i %i %i", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
ret = fprintf(stdout, "%i %i %i %i %i %i", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
fprintf(stdout, "\n ---UNS---\n\n");
ret = ft_printf ("%u %u %u %u %u %u", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
ret = fprintf(stdout, "%u %u %u %u %u %u", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
fprintf(stdout, "\n ---HX1---\n\n");
ret = ft_printf ("%x %x %x %x %x %x", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
ret = fprintf(stdout, "%x %x %x %x %x %x", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
fprintf(stdout, "\n ---HX2---\n\n");
ret = ft_printf ("%X %X %X %X %X %X", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
ret = fprintf(stdout, "%X %X %X %X %X %X", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
fprintf(stdout, "\n ---HX2---\n\n");
ret = ft_printf ("%X %X %X %X %X %X", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
ret = fprintf(stdout, "%X %X %X %X %X %X", 'X', 0, 42, -42, INT_MIN, INT_MAX); RET;
fprintf(stdout, "\n ---PTR---\n\n");
ret = ft_printf ("%p %p %p", (void *)null, (void *)&ret, NULL); RET;
ret = fprintf(stdout, "%p %p", (void *)null, (void *)&ret); RET;
fprintf(stdout, "\n ---MIX---\n\n");
ret = ft_printf ("- %% %c %s %i %u %x %X %x %p ", 97, "b", 0, -1, -2, -3, -4, (void *)null); RET;
ret = fprintf(stdout, "- %% %c %s %i %u %x %X %x %p ", 97, "b", 0, -1, -2, -3, -4, (void *)null); RET;
return (0);
}