Tests 11, 12: %p needs correction
This commit is contained in:
parent
6e8d779d57
commit
6f3b51567d
1 changed files with 39 additions and 2 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/20 19:30:05 by lalgarra ### ########.fr */
|
/* Updated: 2025/10/20 19:48:21 by lalgarra ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
static char *get_begin(void)
|
static char *get_begin(void)
|
||||||
{
|
{
|
||||||
|
|
@ -204,7 +205,7 @@ static void test10()
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
strcpy(prefix, "test10: ");
|
strcpy(prefix, "test10: ");
|
||||||
strcpy(sfmt, "%%.2s %%.3s %%.4s %%.5s %%.1s: %.2s %.3s %.4s %.5s %.1s--eof; ");
|
strcpy(sfmt, "%%.2sx%%.3sx%%.4sx%%.5sx%%.1s:x%.2sx%.3sx%.4sx%.5sx%.1s--eof; ");
|
||||||
printf("%s printf(): ", prefix);
|
printf("%s printf(): ", prefix);
|
||||||
ret = printf(sfmt, " - ", "", "4", "", "2 ");
|
ret = printf(sfmt, " - ", "", "4", "", "2 ");
|
||||||
printf("ret=%i\n", ret);
|
printf("ret=%i\n", ret);
|
||||||
|
|
@ -214,6 +215,40 @@ static void test10()
|
||||||
ft_printf("ret=%i\n", ret);
|
ft_printf("ret=%i\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test11()
|
||||||
|
{
|
||||||
|
char prefix[128];
|
||||||
|
char sfmt[128];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test11: ");
|
||||||
|
strcpy(sfmt, "%%-11p, %%-12p:%-11p,%-12p--eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, INT_MIN, INT_MAX);
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, INT_MIN, INT_MAX);
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test12()
|
||||||
|
{
|
||||||
|
char prefix[128];
|
||||||
|
char sfmt[128];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test12: ");
|
||||||
|
strcpy(sfmt, "%%-13p, %%-14p:%-13p,%-14p--eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, ULONG_MAX, -ULONG_MAX);
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, ULONG_MAX, -ULONG_MAX);
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
static void test50()
|
static void test50()
|
||||||
{
|
{
|
||||||
char prefix[128];
|
char prefix[128];
|
||||||
|
|
@ -260,6 +295,8 @@ int main(void)
|
||||||
test08();
|
test08();
|
||||||
test09();
|
test09();
|
||||||
test10();
|
test10();
|
||||||
|
test11();
|
||||||
|
test12();
|
||||||
test50();
|
test50();
|
||||||
test99();
|
test99();
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue