Testing %-Nc (being N an integer)
This commit is contained in:
parent
af6faffeb5
commit
a632729214
1 changed files with 56 additions and 2 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* test_printf.c :+: :+: :+: */
|
/* test_printf_bonus.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* 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/18 16:07:28 by lalgarra ### ########.fr */
|
/* Updated: 2025/10/19 22:18:48 by lalgarra ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -129,6 +129,57 @@ static void test05()
|
||||||
ft_printf("ret=%i\n", ret);
|
ft_printf("ret=%i\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test06()
|
||||||
|
{
|
||||||
|
char prefix[128];
|
||||||
|
char sfmt[128];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test06: ");
|
||||||
|
strcpy(sfmt, "%%-1c, %%-2c, %%-3c: %-1c, %-2c, %-3c --eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, '0', 0, '1');
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, '0', 0, '1');
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test07()
|
||||||
|
{
|
||||||
|
char prefix[128];
|
||||||
|
char sfmt[128];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test07: ");
|
||||||
|
strcpy(sfmt, "%%-1c, %%-2c, %%-3c: %-1c, %-2c, %-3c --eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, '2', '1', 0);
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, '2', '1', 0);
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test08()
|
||||||
|
{
|
||||||
|
char prefix[128];
|
||||||
|
char sfmt[128];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test08: ");
|
||||||
|
strcpy(sfmt, "%%-1c, %%-2c, %%-3c: %-1c, %-2c, %-3c --eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, 0, '1', '2');
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, 0, '1', '2');
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
static void test50()
|
static void test50()
|
||||||
{
|
{
|
||||||
char prefix[128];
|
char prefix[128];
|
||||||
|
|
@ -170,6 +221,9 @@ int main(void)
|
||||||
test03();
|
test03();
|
||||||
test04();
|
test04();
|
||||||
test05();
|
test05();
|
||||||
|
test06();
|
||||||
|
test07();
|
||||||
|
test08();
|
||||||
test50();
|
test50();
|
||||||
test99();
|
test99();
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue