feat(test/char): adding the first char tests

This commit is contained in:
Raphael 2025-09-04 18:53:33 +02:00
parent 75ac0ede8a
commit ad0f9d001e
No known key found for this signature in database
3 changed files with 109 additions and 0 deletions

36
test/char/test_isalnum.c Normal file
View file

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_isalnum.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/04 16:54:42 by rparodi #+# #+# */
/* Updated: 2025/09/04 18:50:17 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "char.h"
#include "color.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
unsigned char c;
c = 0;
while (c <= 128)
{
if (ft_isalnum(c) != isalnum(c))
{
printf("%s✘ Found %i, excepted %i%s\n", CLR_RED, ft_isalnum(c),
isalnum(c), RESET);
exit(1);
}
else
printf("%s✔%s ", CLR_GREEN, RESET);
c++;
}
}

36
test/char/test_isalpha.c Normal file
View file

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_isalpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/04 18:41:04 by rparodi #+# #+# */
/* Updated: 2025/09/04 18:49:58 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "char.h"
#include "color.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
unsigned char c;
c = 0;
while (c <= 128)
{
if (ft_isalpha(c) != isalpha(c))
{
printf("%s✘ Found %i, excepted %i%s\n", CLR_RED, ft_isalpha(c),
isalpha(c), RESET);
exit(1);
}
else
printf("%s✔%s ", CLR_GREEN, RESET);
c++;
}
}

37
test/char/test_isdigit.c Normal file
View file

@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_isdigit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/04 16:54:42 by rparodi #+# #+# */
/* Updated: 2025/09/04 18:50:04 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "char.h"
#include "color.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
unsigned char c;
c = 0;
while (c <= 128)
{
if (ft_isdigit(c) != isdigit(c))
{
printf("%s✘ Found %i, excepted %i%s\n", CLR_RED, ft_isdigit(c),
isdigit(c), RESET);
exit(1);
}
else
printf("%s✔%s ", CLR_GREEN, RESET);
c++;
}
puts("\n");
}