summaryrefslogtreecommitdiff
path: root/tests/regress
blob: 9a6c44125fea838a66ee546746162c9f15685a21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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