mirror of
https://github.com/usatiuk/psil.git
synced 2025-10-28 18:57:48 +01:00
simple tests
This commit is contained in:
12
clitests/fib.psil
Normal file
12
clitests/fib.psil
Normal file
@@ -0,0 +1,12 @@
|
||||
(define (fib n)
|
||||
(if (> n 0)
|
||||
(if (> n 1)
|
||||
(+ (fib (- n 1))
|
||||
(fib (- n 2)))
|
||||
1)
|
||||
0)
|
||||
)
|
||||
|
||||
(fib 10)
|
||||
(fib 11)
|
||||
(fib 12)
|
||||
3
clitests/fib.psil.ex
Normal file
3
clitests/fib.psil.ex
Normal file
@@ -0,0 +1,3 @@
|
||||
55
|
||||
89
|
||||
144
|
||||
31
clitests/testall.sh
Executable file
31
clitests/testall.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#! /bin/bash
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
FAILED=()
|
||||
|
||||
PSIL="../cmake-build-debug/src/psil"
|
||||
|
||||
for FILE in *.psil; do
|
||||
echo "TESTING $FILE"
|
||||
$PSIL -f $FILE --repl- > $FILE.res
|
||||
if [ $? -ne 0 ]; then
|
||||
FAILED+=("test-"$FILE)
|
||||
continue
|
||||
fi
|
||||
|
||||
diff -w $FILE.res $FILE.ex
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
FAILED+=("test-"$FILE)
|
||||
continue
|
||||
fi
|
||||
|
||||
rm $FILE.res
|
||||
done
|
||||
|
||||
if [ ${#FAILED[@]} -eq 0 ]; then
|
||||
echo "ALL TESTS PASSED"
|
||||
else
|
||||
echo "FAILED: ${FAILED[@]}"
|
||||
exit -1
|
||||
fi
|
||||
Reference in New Issue
Block a user