FIX: Norminette OK
This commit is contained in:
@@ -1,62 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ft_lltoa.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2025/11/07 13:06:35 by dgaillet #+# #+# */
|
|
||||||
/* Updated: 2025/12/07 12:29:25 by dgaillet ### ########lyon.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "libft.h"
|
|
||||||
|
|
||||||
static size_t count_digits(long long n)
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
|
|
||||||
size = 0;
|
|
||||||
if (n <= 0)
|
|
||||||
size++;
|
|
||||||
while (n)
|
|
||||||
{
|
|
||||||
n /= 10;
|
|
||||||
size++;
|
|
||||||
}
|
|
||||||
return (size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void insert_char(char *str, unsigned long long nbr, size_t index)
|
|
||||||
{
|
|
||||||
while (nbr)
|
|
||||||
{
|
|
||||||
str[index--] = nbr % 10 + '0';
|
|
||||||
nbr /= 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char *ft_lltoa(long long n)
|
|
||||||
{
|
|
||||||
unsigned long long nbr;
|
|
||||||
char *str;
|
|
||||||
size_t size;
|
|
||||||
|
|
||||||
nbr = n;
|
|
||||||
if (n < 0)
|
|
||||||
nbr = n * -1;
|
|
||||||
size = count_digits(n);
|
|
||||||
str = malloc(sizeof(char) * (size + 1));
|
|
||||||
if (!str)
|
|
||||||
return (NULL);
|
|
||||||
str[size] = '\0';
|
|
||||||
if (nbr == 0)
|
|
||||||
str[0] = '0';
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (n < 0)
|
|
||||||
str[0] = '-';
|
|
||||||
insert_char(str, nbr, size - 1);
|
|
||||||
}
|
|
||||||
return (str);
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* 00_launcher.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/01/25 12:05:05 by dgaillet #+# #+# */
|
||||||
|
/* Updated: 2026/01/25 12:05:17 by dgaillet ### ########lyon.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "../tests.h"
|
#include "../tests.h"
|
||||||
|
|
||||||
int strncmp_launcher(void)
|
int strncmp_launcher(void)
|
||||||
@@ -11,5 +23,4 @@ int strncmp_launcher(void)
|
|||||||
res = launch_tests(testlist, "ft_strncmp");
|
res = launch_tests(testlist, "ft_strncmp");
|
||||||
clear_tests(&testlist);
|
clear_tests(&testlist);
|
||||||
return (res);
|
return (res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* 01_ok.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/01/25 12:05:24 by dgaillet #+# #+# */
|
||||||
|
/* Updated: 2026/01/25 12:05:25 by dgaillet ### ########lyon.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "../tests.h"
|
#include "../tests.h"
|
||||||
|
|
||||||
int strncmp_ok_test(void)
|
int strncmp_ok_test(void)
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* 02_ko.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2026/01/25 12:05:30 by dgaillet #+# #+# */
|
||||||
|
/* Updated: 2026/01/25 12:05:32 by dgaillet ### ########lyon.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "../tests.h"
|
#include "../tests.h"
|
||||||
|
|
||||||
int strncmp_ko_test(void)
|
int strncmp_ko_test(void)
|
||||||
|
|||||||
@@ -35,5 +35,4 @@ int atoi_sigbus_test(void);
|
|||||||
int strncmp_ok_test(void);
|
int strncmp_ok_test(void);
|
||||||
int strncmp_ko_test(void);
|
int strncmp_ko_test(void);
|
||||||
|
|
||||||
|
|
||||||
#endif // !TESTS_H
|
#endif // !TESTS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user