pieuvre/tests.sh

42 lines
959 B
Bash
Raw Permalink Normal View History

2024-05-20 09:57:28 +02:00
#!/bin/bash
make
2024-05-20 10:57:55 +02:00
echo_title () {
echo -e "\033[0;34m$@\033[0m"
}
echo_title "=== Alpha-équivalence ==="
for file in tests/alpha_equiv/*.lam; do
2024-05-20 09:57:28 +02:00
echo "-- $file"
./pieuvre -alpha $file >/dev/null
done
2024-05-20 10:57:55 +02:00
echo_title "=== Bêta-réduction ==="
for file in tests/lam/*.lam; do
2024-05-20 09:57:28 +02:00
echo "-- $file"
./pieuvre -reduce $file >/dev/null
done
2024-05-20 10:57:55 +02:00
echo_title "=== Preuves ==="
for file in tests/8pus/*.8pus; do
2024-05-20 09:57:28 +02:00
echo "-- $file"
./pieuvre $file >/dev/null
2024-05-20 10:57:55 +02:00
done
echo_title "-== Preuves avec erreurs ==-"
for file in tests/8pus/bad/*.8pus; do
# On vérifie deux choses:
# - Un message d'erreur s'affiche bien
# - Le code de sortie est bien 0
echo "-- $file"
error=$(./pieuvre $file 2>&1 1>/dev/null)
retVal=$?
if [ $retVal -ne 0 ]; then
echo -e "\033[0;31mNon-0 exit code, see stderr:\033[0m"
echo $error
elif [[ $error == "" ]]; then
echo -e "\033[0;31mNo message in stderr\033[0m"
fi
2024-05-20 09:57:28 +02:00
done