Evals w/ limits
This commit is contained in:
24
Makefile
24
Makefile
@@ -6,7 +6,7 @@
|
||||
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2022/01/18 15:11:16 by gbaconni #+# #+# #
|
||||
# Updated: 2022/04/29 10:12:47 by gbaconni ### ########.fr #
|
||||
# Updated: 2022/04/29 23:22:57 by gbaconni ### lausanne.ch #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
#
|
||||
@@ -22,6 +22,13 @@ GIT_REPO = git@vogsphere.42lausanne.ch:vogsphere/intra-uuid-fd8d00fc-8c22-400e-a
|
||||
PDF_FR = https://cdn.intra.42.fr/pdf/pdf/50142/fr.subject.pdf
|
||||
PDF_EN = https://cdn.intra.42.fr/pdf/pdf/50141/en.subject.pdf
|
||||
|
||||
INT_MIN = "-2147483648"
|
||||
INT_MAX = "2147483647"
|
||||
UINT_MAX = "4294967295"
|
||||
LONG_MIN = "-9223372036854775808"
|
||||
LONG_MAX = "9223372036854775807"
|
||||
ULONG_MAX = "18446744073709551615"
|
||||
|
||||
NAME = ft_printf
|
||||
|
||||
LIBFTPRINTF = libftprintf
|
||||
@@ -104,14 +111,23 @@ test: bonus
|
||||
@$(PREFIX) ./$(NAME) "%s" "42 Lausanne"
|
||||
@$(PREFIX) ./$(NAME) "%s" ""
|
||||
@$(PREFIX) ./$(NAME) "%d" 42
|
||||
@$(PREFIX) ./$(NAME) "%i" 2147483647
|
||||
@$(PREFIX) ./$(NAME) "%i" -2147483646
|
||||
@$(PREFIX) ./$(NAME) "%u" 4294967295
|
||||
@$(PREFIX) ./$(NAME) "%i" $(INT_MIN)
|
||||
@$(PREFIX) ./$(NAME) "%i" $(INT_MAX)
|
||||
@$(PREFIX) ./$(NAME) "%u" $(UINT_MAX)
|
||||
@$(PREFIX) ./$(NAME) "%x" $(LONG_MIN)
|
||||
@$(PREFIX) ./$(NAME) "%X" $(LONG_MIN)
|
||||
@$(PREFIX) ./$(NAME) "%x" $(LONG_MAX)
|
||||
@$(PREFIX) ./$(NAME) "%X" $(LONG_MAX)
|
||||
@$(PREFIX) ./$(NAME) "%x" $(ULONG_MAX)
|
||||
@$(PREFIX) ./$(NAME) "%X" $(ULONG_MAX)
|
||||
@$(PREFIX) ./$(NAME) "%x" 42
|
||||
@$(PREFIX) ./$(NAME) "%X" 42
|
||||
@$(PREFIX) ./$(NAME) "%%" ""
|
||||
@$(PREFIX) ./$(NAME) "%p" ""
|
||||
@$(PREFIX) ./$(NAME) "%p" "\n"
|
||||
@$(PREFIX) ./$(NAME) "%p" $(LONG_MIN)
|
||||
@$(PREFIX) ./$(NAME) "%p" $(LONG_MAX)
|
||||
@$(PREFIX) ./$(NAME) "%p" $(ULONG_MAX)
|
||||
@$(PREFIX) ./$(NAME) "Forty Two" ""
|
||||
@$(PREFIX) ./$(NAME) "\t\r\n" ""
|
||||
@$(PREFIX) ./$(NAME) "%1d" 42
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
/* By: gbaconni <gbaconni@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/16 13:51:16 by gbaconni #+# #+# */
|
||||
/* Updated: 2022/04/18 09:13:04 by gbaconni ### lausanne.ch */
|
||||
/* Updated: 2022/04/29 23:39:15 by gbaconni ### lausanne.ch */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_printf.h"
|
||||
|
||||
static long ft_ltoa_base_len(long n, long nbase);
|
||||
static long long ft_ltoa_base_len(long long n, long long nbase);
|
||||
|
||||
char *ft_ltoa_base(long n, char *base)
|
||||
{
|
||||
char *s;
|
||||
int i;
|
||||
long nbr;
|
||||
long nbase;
|
||||
long long i;
|
||||
long long nbr;
|
||||
long long nbase;
|
||||
|
||||
nbase = ft_strlen(base);
|
||||
s = (char *) ft_calloc(ft_ltoa_base_len(n, nbase) + 1, sizeof(char));
|
||||
@@ -42,9 +42,9 @@ char *ft_ltoa_base(long n, char *base)
|
||||
return (ft_strrev(s));
|
||||
}
|
||||
|
||||
static long ft_ltoa_base_len(long n, long nbase)
|
||||
static long long ft_ltoa_base_len(long long n, long long nbase)
|
||||
{
|
||||
size_t len;
|
||||
long long len;
|
||||
|
||||
len = 0;
|
||||
if (n < 0 || n == 0)
|
||||
|
||||
10
main.c
10
main.c
@@ -6,14 +6,14 @@
|
||||
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/04/13 06:58:46 by gbaconni #+# #+# */
|
||||
/* Updated: 2022/04/29 17:50:00 by gbaconni ### ########.fr */
|
||||
/* Updated: 2022/04/29 22:52:28 by gbaconni ### lausanne.ch */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h> // printf
|
||||
#include <string.h> // strlen
|
||||
#include <ctype.h> // isdigit
|
||||
#include <assert.h> // assert
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "libftprintf/ft_printf.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user