0
20-defensive/tf-20.py
Normal file → Executable file
0
20-defensive/tf-20.py
Normal file → Executable file
0
21-tantrum/tf-21.py
Normal file → Executable file
0
21-tantrum/tf-21.py
Normal file → Executable file
27
33-restful/autorun
Normal file
27
33-restful/autorun
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
2
|
||||||
|
../pride-and-prejudice.txt
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
3
|
||||||
|
1
|
||||||
0
34-the-c-flow/tf-34.py
Normal file → Executable file
0
34-the-c-flow/tf-34.py
Normal file → Executable file
25
test/test.sh
25
test/test.sh
@@ -1,7 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function msg() {
|
function msg() {
|
||||||
echo $(date +%T) "$@"
|
echo "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function date_diff() {
|
||||||
|
date -u -d @"$(($2 - $1))" +"%-Hh %-Mm %-Ss"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Move to a predictable place.
|
# Move to a predictable place.
|
||||||
@@ -17,15 +21,21 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
files=$(echo *.txt)
|
files=$(echo *.txt)
|
||||||
|
suite_start=$(date +"%s")
|
||||||
for dir in $styles_to_test ; do
|
for dir in $styles_to_test ; do
|
||||||
cd $dir
|
cd $dir
|
||||||
for file in $files ; do
|
for file in $files ; do
|
||||||
for exe in * ; do
|
for exe in * ; do
|
||||||
if [ -x $exe ]; then
|
if [ -x $exe ]; then
|
||||||
msg testing $(basename $dir)/$exe with $file
|
msg $(date +%T) testing $(basename $dir)/$exe with $file
|
||||||
expected=$mydir/$file
|
expected=$mydir/$file
|
||||||
actual=$(./$exe ../$file)
|
test_start=$(date +"%s")
|
||||||
|
if [ -e $dir/autorun ] ; then
|
||||||
|
actual=$(./$exe <autorun | grep \# | awk '{print $2,$3,$4}')
|
||||||
|
else
|
||||||
|
actual=$(./$exe ../$file | grep -)
|
||||||
|
fi
|
||||||
|
test_end=$(date +"%s")
|
||||||
echo "$actual" | diff -b $expected - > /dev/null
|
echo "$actual" | diff -b $expected - > /dev/null
|
||||||
result=$?
|
result=$?
|
||||||
total=$((total+1))
|
total=$((total+1))
|
||||||
@@ -36,17 +46,18 @@ for dir in $styles_to_test ; do
|
|||||||
echo "$actual" | paste $expected - | column -t
|
echo "$actual" | paste $expected - | column -t
|
||||||
echo
|
echo
|
||||||
failures=$(($failures+1))
|
failures=$(($failures+1))
|
||||||
msg $exe FAILED!
|
msg $exe FAILED in $(date_diff $test_start $test_end)!
|
||||||
else
|
else
|
||||||
msg passed.
|
msg $exe passed in $(date_diff $test_start $test_end).
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
cd $mydir
|
cd $mydir
|
||||||
done
|
done
|
||||||
|
suite_end=$(date +"%s")
|
||||||
|
|
||||||
msg $(date +%T) Ran $total tests with $failures failures.
|
msg Ran $total tests with $failures failures in $(date_diff $suite_start $suite_end).
|
||||||
if [ $failures -ne 0 ]; then
|
if [ $failures -ne 0 ]; then
|
||||||
msg FAILED!
|
msg FAILED!
|
||||||
exit $failures
|
exit $failures
|
||||||
|
|||||||
Reference in New Issue
Block a user