From 7051eaf1bf773fa3a7c583ea0906318be68fac95 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 5 Sep 2025 10:47:02 +0200 Subject: [PATCH 1/5] fix(char): fixing the isascii / isprint - Correcting the behavour of is ascii to the original given by the original function --- char/ft_isascii.c | 4 ++-- char/ft_isprint.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/char/ft_isascii.c b/char/ft_isascii.c index 5bcccc3..8ed7e6d 100644 --- a/char/ft_isascii.c +++ b/char/ft_isascii.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/06 14:04:26 by rparodi #+# #+# */ -/* Updated: 2025/09/04 11:41:42 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 10:40:03 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,6 +21,6 @@ int ft_isascii(int c) if (c == 0) return (1); if (c > 0 && c <= 127) - return (c); + return (1); return (0); } diff --git a/char/ft_isprint.c b/char/ft_isprint.c index 7da8b4f..c4c38c4 100644 --- a/char/ft_isprint.c +++ b/char/ft_isprint.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/06 14:06:53 by rparodi #+# #+# */ -/* Updated: 2025/09/04 11:41:49 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 10:44:13 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,6 +19,6 @@ int ft_isprint(int c) { if (c >= 32 && c <= 126) - return (c); + return (1); return (0); } From 0282b523263bb3713559a77a592d729c50f3b2d2 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 5 Sep 2025 10:47:44 +0200 Subject: [PATCH 2/5] feat(test/char): adding the test for ft_isascii - isascii now is checked by the unitary test --- test/char/test_isascii.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/char/test_isascii.c diff --git a/test/char/test_isascii.c b/test/char/test_isascii.c new file mode 100644 index 0000000..932b79e --- /dev/null +++ b/test/char/test_isascii.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* test_isascii.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/09/04 16:54:42 by rparodi #+# #+# */ +/* Updated: 2025/09/05 10:40:18 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "char.h" +#include "color.h" +#include +#include +#include + +int main(void) +{ + unsigned char c; + + c = 0; + while (c <= 128) + { + if (ft_isascii(c) != isascii(c)) + { + printf("%s✘ Found %i, excepted %i%s\n", CLR_RED, ft_isascii(c), + isascii(c), RESET); + exit(1); + } + else + printf("%s✔%s ", CLR_GREEN, RESET); + c++; + } +} From 764097af738fc9badfb45f9faf56be1aa2ef661f Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 5 Sep 2025 10:48:48 +0200 Subject: [PATCH 3/5] feat(test/char): adding the unitary test for ft_isprint - isprint have now the unitary test --- test/char/test_isprint.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/char/test_isprint.c diff --git a/test/char/test_isprint.c b/test/char/test_isprint.c new file mode 100644 index 0000000..d3fca7e --- /dev/null +++ b/test/char/test_isprint.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* test_isprint.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/09/04 16:54:42 by rparodi #+# #+# */ +/* Updated: 2025/09/05 10:43:55 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "char.h" +#include "color.h" +#include +#include +#include + +int main(void) +{ + unsigned char c; + + c = 0; + while (c <= 128) + { + if (ft_isprint(c) != isprint(c)) + { + printf("%s✘ Found %i, excepted %i%s\n", CLR_RED, ft_isprint(c), + isprint(c), RESET); + exit(1); + } + else + printf("%s✔%s ", CLR_GREEN, RESET); + c++; + } +} From a7b156aaa6071de31452dad5a50550f5d4622a47 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 5 Sep 2025 10:49:07 +0200 Subject: [PATCH 4/5] feat(test/char): adding the unitary test for ft_tolower - tolower now have the test --- test/char/test_tolower.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/char/test_tolower.c diff --git a/test/char/test_tolower.c b/test/char/test_tolower.c new file mode 100644 index 0000000..73f05aa --- /dev/null +++ b/test/char/test_tolower.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* test_tolower.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/09/04 16:54:42 by rparodi #+# #+# */ +/* Updated: 2025/09/05 10:35:53 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "char.h" +#include "color.h" +#include +#include +#include + +int main(void) +{ + unsigned char c; + + c = 0; + while (c <= 128) + { + if (ft_tolower(c) != tolower(c)) + { + printf("%s✘ Found %i, excepted %i%s\n", CLR_RED, ft_tolower(c), + tolower(c), RESET); + exit(1); + } + else + printf("%s✔%s ", CLR_GREEN, RESET); + c++; + } +} From 453b4d3b92c5b532b0d696de26614f0c306ee5a3 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 5 Sep 2025 10:49:19 +0200 Subject: [PATCH 5/5] feat(test/char): adding the unitary test for ft_tolower - toupper now have the test --- test/char/test_toupper.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/char/test_toupper.c diff --git a/test/char/test_toupper.c b/test/char/test_toupper.c new file mode 100644 index 0000000..b2b1d61 --- /dev/null +++ b/test/char/test_toupper.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* test_toupper.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/09/04 16:54:42 by rparodi #+# #+# */ +/* Updated: 2025/09/05 10:37:26 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "char.h" +#include "color.h" +#include +#include +#include + +int main(void) +{ + unsigned char c; + + c = 0; + while (c <= 128) + { + if (ft_toupper(c) != toupper(c)) + { + printf("%s✘ Found %i, excepted %i%s\n", CLR_RED, ft_toupper(c), + toupper(c), RESET); + exit(1); + } + else + printf("%s✔%s ", CLR_GREEN, RESET); + c++; + } +}