New presentation and organization

This commit is contained in:
Gu://em_ 2026-06-19 11:11:29 +02:00
parent 018bae577a
commit 9731ba9a7a
24 changed files with 73 additions and 189 deletions

1
tests/Makefile.empty Normal file
View file

@ -0,0 +1 @@
empty_target:

View file

@ -0,0 +1,35 @@
SIMPLE_VAR = coucou
SIMPLE_VAR_COMMENT = the comment is gone # comment
# the following line starts with a space then a tab
SPACES_BEFORE_TAB = var_beginning var_end
sparse_rule: depa depb
command 1
command 2
B = B_var_beginning B_var_end
packed_rule: depa depb
command 1
command 2
silent_rule: depa depb
@ command 1
@command 2
rule_comment: depa depb # comment
command_space_rule: depa depb
echo spaces before
echo spaces after
echo this is a # comment
simple_rule: simple_dep
no_dep_rule:
variable_rule: beginning $(SIMPLE_VAR) end
echo "shouldn't be expanded: $(SIMPLE_VAR)"

1
tests/Makefile.test3 Normal file
View file

@ -0,0 +1 @@
VAR = 1

7
tests/Makefile.test4 Normal file
View file

@ -0,0 +1,7 @@
rule1:
echo Toto
echo Tata
echo Tutu
rule2:
@echo Toto encore

4
tests/Makefile.vars Normal file
View file

@ -0,0 +1,4 @@
V=2
main:
echo $V

View file

@ -0,0 +1,36 @@
SIMPLE_VAR = coucou
SIMPLE_VAR_COMMENT = the comment is gone # comment
$(SIMPLE_VAR) = 1
# the following line starts with a space then a tab
SPACES_BEFORE_TAB = var_beginning var_end
sparse_rule: depa depb
command 1
command 2
B = B_var_beginning B_var_end
packed_rule: depa depb
command 1
command 2
silent_rule: depa depb
@ command 1
@command 2
rule_comment: depa depb # comment
command_space_rule: depa depb
echo spaces before
echo spaces after
echo this is a # comment
simple_rule: simple_dep
no_dep_rule:
variable_rule: beginning $(SIMPLE_VAR) end
echo "shouldn't be expanded: $(SIMPLE_VAR)"

77
tests/run.sh Normal file
View file

@ -0,0 +1,77 @@
#!/bin/sh
###########################################
# PIERRE PAGNOUX EXPERIENCE TESTSUITE #
###########################################
#----------------- COLOR -----------------#
# 0 - No style | 1 - Bold
RED="\e[0;31m"
BRED="\e[1;31m"
GRN="\e[0;32m"
BGRN="\e[1;32m"
YEL="\e[0;33m"
BYEL="\e[1;33m"
BLU="\e[0;34m"
BBLU="\e[1;34m"
PUR="\e[0;35m"
BPUR="\e[1;35m"
CYA="\e[0;36m"
BCYA="\e[1;36m"
WHI="\e[0;37m"
BWHI="\e[1;37m"
GRE="\e[2;37m"
#----------------- GLOBV -----------------#
ref_out=/tmp/ref_out.out
my_out=/tmp/my_out.out
#----------------- TESTS -----------------#
tit_wrap()
{
echo -e $@$WHI
}
func_test()
{
tit_wrap - $PUR $1
shift
printf $@ > $ref_out
../../tinyprintf $@ > $my_out
diff $ref_out $my_out > /tmp/null
if [ $? -eq 0 ]; then
tit_wrap $GRN GOOD
else
tit_wrap $RED EXPECTED: $BRED$(cat $ref_out) \|$RED GOT: $BRED$(cat $my_out)
fi
}
func_file()
{
for file in *; do
if [ -f $file ]; then
func_test $file $(cat $file)
fi
done
}
func_dir()
{
cd tests
for dir in *; do
if [ -d $dir ]; then
tit_wrap == $dir ==
cd $dir
func_file
cd ..
fi
done
cd ..
}
# func_dir
echo "Tests should be here"