Add more baseline tests

This commit is contained in:
Martin Michlmayr 2012-03-25 14:11:59 +01:00
parent a47625be35
commit 8962d9c904
13 changed files with 325 additions and 0 deletions

View file

@ -0,0 +1,35 @@
test -f /dev/null --input-date-format "%m/%d/%Y" convert test/baseline/cmd-convert1.dat
2011/12/12=2011/12/13 * (100) Test ;test
Expenses:Unknown $10
Equity:Unknown $-10 = $20
2011/12/12=2011/12/12 * ;
Expenses:Unknown $10
Equity:Unknown
end test
test -f /dev/null --input-date-format "%m/%d/%Y" convert test/baseline/cmd-convert2.dat
2011/01/01 * test
Expenses:Unknown 20.00 EUR
Equity:Unknown
end test
test -f /dev/null --input-date-format "%m/%d/%Y" convert test/baseline/cmd-convert3.dat -> 1
__ERROR__
While parsing file "test/baseline/cmd-convert3.dat", line 1:
While parsing CSV line:
01/01/2011,,
Error: No quantity specified for amount
end test
test -f /dev/null convert test/baseline/cmd-convert4.dat -> 1
__ERROR__
While parsing file "test/baseline/cmd-convert4.dat", line 1:
While parsing CSV line:
bogus,$10,
Error: Invalid date: bogus
end test

View file

@ -0,0 +1,3 @@
date,posted,code,payee,amount,total,note,
12/12/2011,12/13/2011,100,Test,$10,$20,test,
12/12/2011,12/12/2011,,,$10,,

View file

@ -0,0 +1,2 @@
date,amount,desc,
01/01/2011,20.00 EUR,test,

View file

@ -0,0 +1,2 @@
date,amount,
01/01/2011,,

View file

@ -0,0 +1,2 @@
date,amount,
bogus,$10,

View file

@ -0,0 +1,12 @@
test echo foo
foo
end test
test echo "foo bar"
foo bar
end test
test echo "foo\nbar"
foo\nbar
end test

View file

@ -0,0 +1,43 @@
2012-03-23 * Test 1
A $10.00
B
2012-03-24 * Test 2
; Payee: Test 3
C 20.00 EUR
D
2012-03-25 * Test 4
E 30.00 GBP
F
test entry "Test 1"
2012/03/25 Test 1
A $10.00
B
end test
test entry "Test 2"
2012/03/25 Test 2
C 20.00 EUR
D
end test
; I think this output is wrong, see bug #737
test entry "Test 3"
2012/03/25 Test 4
E 30.00 GBP
F
end test
test entry "Test 4"
2012/03/25 Test 4
E 30.00 GBP
F
end test
test entry no:such:account -> 1
__ERROR__
Error: No accounts, and no past transaction matching 'no:such:account'
end test

View file

@ -0,0 +1,28 @@
2012-03-24 * Test 2
; Payee: Test 3
C 20.00 EUR
D
2012-03-25 * (99) Test 4
E 30.00 GBP
F
2012-03-26 * (test) Test 5
G 1 AAA @ $10.00
H
test org
|Date|Code|Payee|X|Account|Amount|Total|Note|
|-|
|||<20>|||<r>|<r>|<20>|
|12-Mar-24||Test 3|*|C|20.00 EUR|20.00 EUR| Payee: Test 3
|||Test 3|*|D|-20.00 EUR|0.00 EUR| Payee: Test 3
|12-Mar-25|99|Test 4|*|E|30.00 GBP|30.00 GBP|
||||*|F|-30.00 GBP|0.00 GBP|
|12-Mar-26|test|Test 5|*|G|1 AAA|0.00 GBP|
|||||||1 AAA|
||||*|H|$-10|0.00 GBP|
|||||||$-10|
|||||||1 AAA|
end test

View file

@ -0,0 +1,36 @@
P 2012-03-25 EUR 0.83 GBP
P 2012-03-25 EUR 1.32 $
P 2012-03-25 USD 0.75 EUR
P 2012-03-25 AAA $10.00
2012-03-23 * Test 1
C 20.00 EUR @@ 16.71 GBP
D
2012-03-24 * Test 2
E 30.00 GBP
F
2012-03-25 * Test 3
G 1 AAA @ $10.00
H
test pricemap
graph G {
0[label=""];
1[label="s"];
2[label="%"];
3[label="m"];
4[label="h"];
5[label="GBP"];
6[label="EUR"];
7[label="$"];
8[label="USD"];
9[label="AAA"];
6--5 ;
6--7 ;
8--6 ;
9--7 ;
}
end test

View file

@ -0,0 +1,62 @@
2012-02-28 * Test 1
E 20.00 EUR
F
2012-02-29 * Test 2
Test 10.01 EUR
F
2012-03-24 Test 3
C 30.00 EUR
D
2012-03-25 (test) Test 4
; Payee: Test 5
E 40.00 GBP
F
test select "date, account, amount" from posts
12-Feb-28 E  20.00 EUR
12-Feb-28 F  -20.00 EUR
12-Feb-29 Test  10.01 EUR
12-Feb-29 F  -10.01 EUR
12-Mar-24 C  30.00 EUR
12-Mar-24 D  -30.00 EUR
12-Mar-25 E  40.00 GBP
12-Mar-25 F  -40.00 GBP
end test
test select "date, account, amount from posts where account =~ /^e/"
12-Feb-28 E  20.00 EUR
12-Mar-25 E  40.00 GBP
end test
test select "date, account, amount from posts where account =~ /e/"
12-Feb-28 E  20.00 EUR
12-Feb-29 Test  10.01 EUR
12-Mar-25 E  40.00 GBP
end test
; leave out "from posts" since it is the default
test select "date, account, amount where account =~ /e/"
12-Feb-28 E  20.00 EUR
12-Feb-29 Test  10.01 EUR
12-Mar-25 E  40.00 GBP
end test
test select "date, payee, amount from posts where account =~ /e/ and commodity =~ /GBP/"
12-Mar-25 Test 5 40.00 GBP
end test
test select "date, payee, amount * 2 from posts where account =~ /e/ and commodity =~ /GBP/"
12-Mar-25 Test 5 80.00 GBP
end test
test select "date, code, amount from posts where account =~ /e/ and commodity =~ /GBP/"
12-Mar-25 test 40.00 GBP
end test
test select "date, code * 2, amount from posts where account =~ /e/ and commodity =~ /GBP/"
12-Mar-25 testtest 40.00 GBP
end test

View file

@ -0,0 +1,26 @@
2012-02-28 * Test
E 30.00 EUR
F
G
2012-03-24 Test
C 30.00 EUR
D
C
2012/03/xx
E 30.00 EUR
F
test source -> 3
__ERROR__
While parsing file "$FILE", line 4:
Error: Only one posting with null amount allowed per transaction
While parsing file "$FILE", line 9:
Error: Only one posting with null amount allowed per transaction
While parsing file "$FILE", line 11:
While parsing transaction:
> 2012/03/xx
Error: Invalid date: 2012/03/xx
end test

View file

@ -0,0 +1,31 @@
2012-02-28 * Test
E 30.00 EUR
F
2012-02-29 * Test
E 30.00 EUR
F
2012-03-24 Test
A 30.00 EUR
B
test stats --now "2012-03-31"
Time period: 12-Feb-28 to 12-Mar-24 (25 days)
Files these postings came from:
$sourcepath/test/baseline/cmd-stats.test
Unique payees: 1
Unique accounts: 4
Number of postings: 6 (0.24 per day)
Uncleared postings: 2
Days since last post: 7
Posts in last 7 days: 2
Posts in last 30 days: 2
Posts seen this month: 2
end test

View file

@ -0,0 +1,43 @@
2012-03-23 * Test 1
A $10.00
B
2012-03-24 * Test 2
; Payee: Test 3
C 20.00 EUR
D
2012-03-25 * Test 4
E 30.00 GBP
F
test xact "Test 1"
2012/03/25 Test 1
A $10.00
B
end test
test xact "Test 2"
2012/03/25 Test 2
C 20.00 EUR
D
end test
; I think this output is wrong, see bug #737
test xact "Test 3"
2012/03/25 Test 4
E 30.00 GBP
F
end test
test xact "Test 4"
2012/03/25 Test 4
E 30.00 GBP
F
end test
test xact no:such:account -> 1
__ERROR__
Error: No accounts, and no past transaction matching 'no:such:account'
end test