first cut at very simple tester
This commit is contained in:
1
initial-utilities/wcat/tests/1.desc
Normal file
1
initial-utilities/wcat/tests/1.desc
Normal file
@@ -0,0 +1 @@
|
||||
basic test: a one-line file
|
||||
0
initial-utilities/wcat/tests/1.err
Normal file
0
initial-utilities/wcat/tests/1.err
Normal file
1
initial-utilities/wcat/tests/1.in
Normal file
1
initial-utilities/wcat/tests/1.in
Normal file
@@ -0,0 +1 @@
|
||||
simple test
|
||||
1
initial-utilities/wcat/tests/1.out
Normal file
1
initial-utilities/wcat/tests/1.out
Normal file
@@ -0,0 +1 @@
|
||||
simple test
|
||||
1
initial-utilities/wcat/tests/1.rc
Normal file
1
initial-utilities/wcat/tests/1.rc
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
initial-utilities/wcat/tests/1.run
Normal file
1
initial-utilities/wcat/tests/1.run
Normal file
@@ -0,0 +1 @@
|
||||
./wcat tests/1.in
|
||||
1
initial-utilities/wcat/tests/2.desc
Normal file
1
initial-utilities/wcat/tests/2.desc
Normal file
@@ -0,0 +1 @@
|
||||
simple multi-file test
|
||||
0
initial-utilities/wcat/tests/2.err
Normal file
0
initial-utilities/wcat/tests/2.err
Normal file
1
initial-utilities/wcat/tests/2.in.a
Normal file
1
initial-utilities/wcat/tests/2.in.a
Normal file
@@ -0,0 +1 @@
|
||||
this line is from one file
|
||||
1
initial-utilities/wcat/tests/2.in.b
Normal file
1
initial-utilities/wcat/tests/2.in.b
Normal file
@@ -0,0 +1 @@
|
||||
this line is from another file
|
||||
2
initial-utilities/wcat/tests/2.out
Normal file
2
initial-utilities/wcat/tests/2.out
Normal file
@@ -0,0 +1,2 @@
|
||||
this line is from one file
|
||||
this line is from another file
|
||||
1
initial-utilities/wcat/tests/2.rc
Normal file
1
initial-utilities/wcat/tests/2.rc
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
initial-utilities/wcat/tests/2.run
Normal file
1
initial-utilities/wcat/tests/2.run
Normal file
@@ -0,0 +1 @@
|
||||
./wcat tests/2.in.a tests/2.in.b
|
||||
1
initial-utilities/wcat/tests/3.desc
Normal file
1
initial-utilities/wcat/tests/3.desc
Normal file
@@ -0,0 +1 @@
|
||||
empty file
|
||||
0
initial-utilities/wcat/tests/3.err
Normal file
0
initial-utilities/wcat/tests/3.err
Normal file
0
initial-utilities/wcat/tests/3.in
Normal file
0
initial-utilities/wcat/tests/3.in
Normal file
0
initial-utilities/wcat/tests/3.out
Normal file
0
initial-utilities/wcat/tests/3.out
Normal file
1
initial-utilities/wcat/tests/3.rc
Normal file
1
initial-utilities/wcat/tests/3.rc
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
initial-utilities/wcat/tests/3.run
Normal file
1
initial-utilities/wcat/tests/3.run
Normal file
@@ -0,0 +1 @@
|
||||
./wcat tests/3.in
|
||||
1
initial-utilities/wcat/tests/4.desc
Normal file
1
initial-utilities/wcat/tests/4.desc
Normal file
@@ -0,0 +1 @@
|
||||
no input file at all
|
||||
0
initial-utilities/wcat/tests/4.err
Normal file
0
initial-utilities/wcat/tests/4.err
Normal file
0
initial-utilities/wcat/tests/4.out
Normal file
0
initial-utilities/wcat/tests/4.out
Normal file
1
initial-utilities/wcat/tests/4.rc
Normal file
1
initial-utilities/wcat/tests/4.rc
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
initial-utilities/wcat/tests/4.run
Normal file
1
initial-utilities/wcat/tests/4.run
Normal file
@@ -0,0 +1 @@
|
||||
./wcat
|
||||
1
initial-utilities/wcat/tests/5.desc
Normal file
1
initial-utilities/wcat/tests/5.desc
Normal file
@@ -0,0 +1 @@
|
||||
long file
|
||||
0
initial-utilities/wcat/tests/5.err
Normal file
0
initial-utilities/wcat/tests/5.err
Normal file
1000000
initial-utilities/wcat/tests/5.in
Normal file
1000000
initial-utilities/wcat/tests/5.in
Normal file
File diff suppressed because it is too large
Load Diff
1000000
initial-utilities/wcat/tests/5.out
Normal file
1000000
initial-utilities/wcat/tests/5.out
Normal file
File diff suppressed because it is too large
Load Diff
1
initial-utilities/wcat/tests/5.rc
Normal file
1
initial-utilities/wcat/tests/5.rc
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
initial-utilities/wcat/tests/5.run
Normal file
1
initial-utilities/wcat/tests/5.run
Normal file
@@ -0,0 +1 @@
|
||||
./wcat tests/5.in
|
||||
1
initial-utilities/wcat/tests/6.desc
Normal file
1
initial-utilities/wcat/tests/6.desc
Normal file
@@ -0,0 +1 @@
|
||||
bad file on command line (does not exist)
|
||||
0
initial-utilities/wcat/tests/6.err
Normal file
0
initial-utilities/wcat/tests/6.err
Normal file
1
initial-utilities/wcat/tests/6.out
Normal file
1
initial-utilities/wcat/tests/6.out
Normal file
@@ -0,0 +1 @@
|
||||
wcat: cannot open file
|
||||
1
initial-utilities/wcat/tests/6.rc
Normal file
1
initial-utilities/wcat/tests/6.rc
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
1
initial-utilities/wcat/tests/6.run
Normal file
1
initial-utilities/wcat/tests/6.run
Normal file
@@ -0,0 +1 @@
|
||||
./wcat tests/6.in
|
||||
1
initial-utilities/wcat/tests/7.desc
Normal file
1
initial-utilities/wcat/tests/7.desc
Normal file
@@ -0,0 +1 @@
|
||||
many files on command line, but one of them does not exist
|
||||
0
initial-utilities/wcat/tests/7.err
Normal file
0
initial-utilities/wcat/tests/7.err
Normal file
3
initial-utilities/wcat/tests/7.out
Normal file
3
initial-utilities/wcat/tests/7.out
Normal file
@@ -0,0 +1,3 @@
|
||||
this one has stuff in it
|
||||
this one does too
|
||||
wcat: cannot open file
|
||||
1
initial-utilities/wcat/tests/7.rc
Normal file
1
initial-utilities/wcat/tests/7.rc
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
1
initial-utilities/wcat/tests/7.run
Normal file
1
initial-utilities/wcat/tests/7.run
Normal file
@@ -0,0 +1 @@
|
||||
./wcat tests/7a.in tests/7b.in tests/7c.in tests/7d.in
|
||||
1
initial-utilities/wcat/tests/7a.in
Normal file
1
initial-utilities/wcat/tests/7a.in
Normal file
@@ -0,0 +1 @@
|
||||
this one has stuff in it
|
||||
1
initial-utilities/wcat/tests/7b.in
Normal file
1
initial-utilities/wcat/tests/7b.in
Normal file
@@ -0,0 +1 @@
|
||||
this one does too
|
||||
1
initial-utilities/wcat/tests/7d.in
Normal file
1
initial-utilities/wcat/tests/7d.in
Normal file
@@ -0,0 +1 @@
|
||||
this one does but should not get printed
|
||||
10
initial-utilities/wcat/tests/filegen.py
Executable file
10
initial-utilities/wcat/tests/filegen.py
Executable file
@@ -0,0 +1,10 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
import random
|
||||
import string
|
||||
|
||||
for i in range(1000000):
|
||||
x = ''
|
||||
for i in range(40):
|
||||
x += random.choice(string.letters + ' ')
|
||||
print(x)
|
||||
49
tester/run-tests.sh
Executable file
49
tester/run-tests.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# run_test test_number
|
||||
run_test () {
|
||||
testfile=tests/$1.run
|
||||
# cat $testfile
|
||||
$(cat $testfile) > tests-out/$1.out 2> tests-out/$1.err
|
||||
return 0
|
||||
}
|
||||
|
||||
# check_test test_number out/err
|
||||
check_test () {
|
||||
outdiff=$(diff tests/$1.$2 tests-out/$1.$2)
|
||||
outerr=$?
|
||||
if (( $outerr != 0 )); then
|
||||
builtin echo -e "\e[31mtest $testnum: standard $2 incorrect\e[0m"
|
||||
echo "should be:"
|
||||
cat tests/$1.$2
|
||||
echo "is:"
|
||||
cat tests-out/$1.$2
|
||||
exit 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
(( testnum = 1 ))
|
||||
|
||||
while true; do
|
||||
if [[ ! -f tests/$testnum.run ]]; then
|
||||
exit 0
|
||||
fi
|
||||
run_test $testnum
|
||||
check_test $testnum out
|
||||
check_test $testnum err
|
||||
builtin echo -e "\e[32mtest $testnum: passed\e[0m"
|
||||
(( testnum = $testnum + 1 ))
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user