Desde vogsphere 250929_1801, probando adaptación a tener tests en repo aparte

This commit is contained in:
lalgarra 2025-09-30 18:53:31 +02:00
commit a8bcf5201d
9 changed files with 126 additions and 0 deletions

71
Makefile Normal file
View file

@ -0,0 +1,71 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/09/29 11:35:48 by lalgarra #+# #+# #
# Updated: 2025/09/29 17:42:30 by lalgarra ### ########.fr #
# #
# **************************************************************************** #
LIBDIR = ../repo_libft_algarra
#CFLAGS += -Wall -Wextra -Werror -g3 -fsanitize=address
CFLAGS += -Wall -Wextra -Werror -g3 -iquote $(LIBDIR) -L$(LIBDIR) -lft
TESTS:= isalpha_test isdigit_test isalnum_test isascii_test
all: $(TESTS)
run:
for i in $(TESTS); do \
echo ./$$i; \
done
foo:
$(foreach E, $(TESTS), \
$(eval X = $(subst _test,_expected.output,$(E))) \
$(eval A = $(subst _test,_actual.output,$(E))) \
echo ./$(E) redir $(A); \
echo less diff -a $(X) $(A); \
)
#
#
#OBJECTS = $(SOURCES:.c=.o)
#
#build: $(OBJECTS)
# ar rcs $(NAME) $(OBJECTS)
#
#clean:
##removes objects (.o)#
# @echo "Deleting '.o' files..."
# @rm -f $(OBJECTS)
# @echo "Files '.o' deleted"
#
#fclean: clean
##removes objects (.o) and library#
# @echo "Deleting lib..."
# @rm -f $(NAME)
# @echo "Lib deleted"
#
#all: $(NAME)
## builds all
#
#re: clean all
## cleans and rebuild all
#
#isalpha_test: isalpha_test.c $(NAME)
# $(CC) -o isalpha_test.out isalpha_test.c $(CFLAGS) -L. -lft
#
#isdigit_test: isdigit_test.c $(NAME)
# $(CC) -o isdigit_test.out isdigit_test.c $(CFLAGS) -L. -lft
#
#isalnum_test: isalnum_test.c $(NAME)
# $(CC) -o isalnum_test.out isalnum_test.c $(CFLAGS) -L. -lft
#
#isascii_test: isascii_test.c $(NAME)
# $(CC) -o isascii_test.out isascii_test.c $(CFLAGS) -L. -lft
#
#clean_tests:
# @rm -f *_test.out *_test.o

BIN
isalnum_expected.output Normal file

Binary file not shown.

13
isalnum_test.c Normal file
View file

@ -0,0 +1,13 @@
#include "libft.h"
#include<stdio.h>
int main(void)
{
int c;
for (c = 0; c < 256; c++)
{
printf("'%c' (%i); isalnum(c): %i\r\n", c, c, isalnum(c));
}
return (0);
}

BIN
isalpha_expected.output Normal file

Binary file not shown.

13
isalpha_test.c Normal file
View file

@ -0,0 +1,13 @@
#include "libft.h"
#include<stdio.h>
int main(void)
{
int c;
for (c = 0; c < 256; c++)
{
printf("'%c' (%i); isalpha(c): %i\r\n", c, c, isalpha(c));
}
return (0);
}

BIN
isascii_expected.output Normal file

Binary file not shown.

16
isascii_test.c Normal file
View file

@ -0,0 +1,16 @@
/*
#include<ctype.h>
*/
#include "libft.h"
#include<stdio.h>
int main(void)
{
int c;
for (c = 0; c < 256; c++)
{
printf("'%c' (%i); isascii(c): %i\r\n", c, c, isascii(c));
}
return (0);
}

BIN
isdigit_expected.output Normal file

Binary file not shown.

13
isdigit_test.c Normal file
View file

@ -0,0 +1,13 @@
#include "libft.h"
#include<stdio.h>
int main(void)
{
int c;
for (c = 0; c < 256; c++)
{
printf("'%c' (%i); isdigit(c): %i\r\n", c, c, isdigit(c));
}
return (0);
}