Repair stdin functionality, move stdin test to others
authorLukas Jiriste <ljiriste@student.42prague.com>
Fri, 27 Oct 2023 09:55:41 +0000 (11:55 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Fri, 27 Oct 2023 09:55:41 +0000 (11:55 +0200)
Move stdin test to other tests so it runs for every BUFFER_SIZE tested.
Compare correct files while testing (correct/.stdin instead of correct/-).
Add missing " in Makefile.

Makefile
test

index 2162dc38debd7f187a16e91472847e20bd8be6eb..9142d4dd41023a82326ad2f1fc8dfdc89cb4727a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ OBJS := $(SRCS:%.c=$(OBJDIR)%.o)
 GNLOBJS := $(GNLSRCS:%.c=$(OBJDIR)%.o)
 GNLBONUSOBJS = $(GNLBONUS:%.c=$(OBJDIR)%.o)
 
-TESTFILES := $(shell find $(TESTDIR) -type f -not -path "*/.* | sort) $(TESTDIR).stdin
+TESTFILES := $(shell find $(TESTDIR) -type f -not -path "*/.*" | sort) $(TESTDIR).stdin
 CORFILES := $(TESTFILES:$(TESTDIR)%=$(CORDIR)%)
 
 NAME = tester
diff --git a/test b/test
index 9d7aa8824cdf89cfe02bc8213fedeccb3312e754..8b6fe2908e4460196091a18c9fa8f3f5d473fc1b 100755 (executable)
--- a/test
+++ b/test
@@ -50,21 +50,6 @@ then
 
        make --silent all_tests SEP="$SEP"
        wait
-
-       valgrind --quiet --leak-check=full --log-file='tmp' ./tester - <test_files/.stdin > /dev/null
-       wait
-       if $(cmp -s ./correct/- ./results/-)
-       then
-               printf "\033[32m"
-               printf "stdin: OK\n"
-               printf "$(<tmp)\n"
-       else
-               printf "\033[31m"
-               printf "stdin: KO\n"
-               printf "diff -y ./correct/"$file" ./results/"$file"\n"
-               printf "$(diff -y ./correct/"$file" ./results/"$file")\n"
-               printf "$(<tmp)\n"
-       fi
        
        for file in $(ls test_files/)
        do
@@ -89,6 +74,22 @@ then
                printf "\033[0m\nTrying BUFFER_SIZE = $BS\n"
                make --silent BUFFER_SIZE=$BS
                wait
+
+               valgrind --quiet --leak-check=full --log-file='tmp' ./tester - <test_files/.stdin > /dev/null
+               wait
+               if $(cmp -s "./correct/.stdin" "./results/-")
+               then
+                       printf "\033[32m"
+                       printf "stdin: OK\n"
+                       printf "$(<tmp)\n"
+               else
+                       printf "\033[31m"
+                       printf "stdin: KO\n"
+                       printf "diff -y ./correct/.stdin ./results/-\n"
+                       printf "$(diff -y ./correct/.stdin ./results/-)\n"
+                       printf "$(<tmp)\n"
+               fi
+
                for file in $(ls test_files/)
                do
                        valgrind --quiet --leak-check=full --log-file='tmp' ./tester "$file" > /dev/null