summaryrefslogtreecommitdiff
path: root/tests/regress
diff options
context:
space:
mode:
Diffstat (limited to 'tests/regress')
-rwxr-xr-xtests/regress95
1 files changed, 95 insertions, 0 deletions
diff --git a/tests/regress b/tests/regress
new file mode 100755
index 00000000..9a6c4412
--- /dev/null
+++ b/tests/regress
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+TMPDIR=/tmp
+TESTS=tests
+UTILS=utils
+CASES=$TESTS/cases
+
+result=0
+
+generate=false
+if [ "$1" = "--generate" ]; then
+ generate=true
+fi
+
+runtest() {
+ num=$1
+ shift
+ if [ $generate = true ]; then
+ echo generating $num
+ ./ledger "$@" > $TESTS/baseline/$num 2> $TMPDIR/errors-$$.out
+ cat $TMPDIR/errors-$$.out >> $TESTS/baseline/$num
+ rm -f $TMPDIR/*-$$.out
+ elif [ -r $TESTS/baseline/$num ]; then
+ ./ledger "$@" > $TMPDIR/test-$$.out 2> $TMPDIR/errors-$$.out
+ cat $TMPDIR/errors-$$.out >> $TMPDIR/test-$$.out
+
+ diff $TESTS/baseline/$num $TMPDIR/test-$$.out \
+ > $TMPDIR/result-$$.out 2>&1
+ if [ -s $TMPDIR/result-$$.out ]; then
+ echo Error: Regression $num failed
+ echo ":: regression $num: ./ledger $@" >> errors.out
+ cat $TMPDIR/result-$$.out >> errors.out
+ result=`expr $result + 1`
+ fi
+ rm -f $TMPDIR/*-$$.out
+ fi
+}
+
+echo Running Ledger regression tests...
+
+runtest 1032 -f $CASES/1032.dat -S t bal
+
+runtest 1031 -f $CASES/1030.dat reg
+runtest 1030 -f $CASES/1030.dat bal
+
+runtest 1029 -f $CASES/1002.dat entry 2006/10/20 "stock option"
+runtest 1028 -f $CASES/1002.dat entry 2006/10/20 "stock option" -20
+runtest 1027 -f $CASES/1002.dat entry 2006/10/20 "stock option" opti
+runtest 1026 -f $CASES/1002.dat entry 2006/10/20 "stock option" time
+runtest 1025 -f $CASES/1002.dat entry 2006/10/20 "stock option" gain
+runtest 1024 -f $CASES/1002.dat entry 2006/10/20 "stock option" opti -20
+runtest 1023 -f $CASES/1002.dat entry 2006/10/20 "stock option" time -20
+runtest 1022 -f $CASES/1002.dat entry 2006/10/20 "stock option" gain -20
+
+runtest 1021 -f $CASES/1002.dat entry 2006/10/20 "stock optionx"
+runtest 1020 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" -20
+runtest 1019 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" opti
+runtest 1018 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" time
+runtest 1017 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" gain
+runtest 1016 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" opti -20
+runtest 1015 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" time -20
+runtest 1014 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" gain -20
+
+runtest 1013 -f $CASES/1002.dat entry 2006/10/20 "stock option" xopti
+runtest 1012 -f $CASES/1002.dat entry 2006/10/20 "stock option" xtime
+runtest 1011 -f $CASES/1002.dat entry 2006/10/20 "stock option" xgain
+runtest 1010 -f $CASES/1002.dat entry 2006/10/20 "stock option" xopti -20
+runtest 1009 -f $CASES/1002.dat entry 2006/10/20 "stock option" xtime -20
+runtest 1008 -f $CASES/1002.dat entry 2006/10/20 "stock option" xgain -20
+
+runtest 1007 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" xopti
+runtest 1006 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" xtime
+runtest 1005 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" xgain
+runtest 1004 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" xopti -20
+runtest 1003 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" xtime -20
+runtest 1002 -f $CASES/1002.dat entry 2006/10/20 "stock optionx" xgain -20
+
+runtest 1001 -f $CASES/1001.dat bal
+
+if [ -f $UTILS/standard.dat ]; then
+ runtest 10 -f $UTILS/standard.dat --truncate=trailing -M -r -s -n reg rent
+ runtest 9 -f $UTILS/standard.dat --truncate=trailing -M -r -s reg rent
+ runtest 8 -f $UTILS/standard.dat --truncate=trailing -M -r -n reg rent
+ runtest 7 -f $UTILS/standard.dat --truncate=trailing -M -r reg rent
+ runtest 6 -f $UTILS/standard.dat --truncate=trailing -M reg rent
+ runtest 5 -f $UTILS/standard.dat --truncate=trailing -r -s -n reg rent
+ runtest 4 -f $UTILS/standard.dat --truncate=trailing -r -s reg rent
+ runtest 3 -f $UTILS/standard.dat --truncate=trailing -r -n reg rent
+ runtest 2 -f $UTILS/standard.dat --truncate=trailing -r reg rent
+ runtest 1 -f $UTILS/standard.dat --truncate=trailing reg rent
+fi
+
+echo Running Ledger regression tests...done
+
+exit $result