Moar testsgit add test_printf_bonus.c
This commit is contained in:
parent
78e31ce9f0
commit
f8f15172a6
1 changed files with 55 additions and 1 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ */
|
/* By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/10/15 18:54:32 by lalgarra #+# #+# */
|
/* Created: 2025/10/15 18:54:32 by lalgarra #+# #+# */
|
||||||
/* Updated: 2025/10/21 18:06:39 by lalgarra ### ########.fr */
|
/* Updated: 2025/10/21 18:50:51 by lalgarra ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -402,6 +402,57 @@ static void test21()
|
||||||
ft_printf("ret=%i\n", ret);
|
ft_printf("ret=%i\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test22()
|
||||||
|
{
|
||||||
|
char prefix[228];
|
||||||
|
char sfmt[228];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test22: ");
|
||||||
|
strcpy(sfmt, "%%01x,%%04x,%%010x:%01x,%04x,%010x--eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, 0, 9, INT_MIN);
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, 0, 9, INT_MIN);
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test23()
|
||||||
|
{
|
||||||
|
char prefix[238];
|
||||||
|
char sfmt[238];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test23: ");
|
||||||
|
strcpy(sfmt, "%%.2x,%%.10x:%.2x,%.10x--eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, 1, LONG_MAX);
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, 1, LONG_MAX);
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test24()
|
||||||
|
{
|
||||||
|
char prefix[128];
|
||||||
|
char sfmt[128];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test24: ");
|
||||||
|
strcpy(sfmt, "%%23s,%%-16s,%%.3s,%%.0s:%23s,%-16s,%.3s,%.0s--eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, NULL, "nark nark", "hello", "bye");
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, NULL, "nark nark", "hello", "bye");
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
static void test50()
|
static void test50()
|
||||||
{
|
{
|
||||||
char prefix[128];
|
char prefix[128];
|
||||||
|
|
@ -459,6 +510,9 @@ int main(void)
|
||||||
test19();
|
test19();
|
||||||
test20();
|
test20();
|
||||||
test21();
|
test21();
|
||||||
|
test22();
|
||||||
|
test23();
|
||||||
|
test24();
|
||||||
test50();
|
test50();
|
||||||
test99();
|
test99();
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue