diff options
author | Martin Michlmayr <tbm@cyrius.com> | 2012-03-25 14:11:59 +0100 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2012-03-25 14:11:59 +0100 |
commit | 8962d9c904d5630b508ca2b10f2bf66e7f32a30b (patch) | |
tree | 98d35d154607222d9df3ffcc12ac633fec60dbd0 /test | |
parent | a47625be3571262f0c36324d6793c55645172dc1 (diff) | |
download | fork-ledger-8962d9c904d5630b508ca2b10f2bf66e7f32a30b.tar.gz fork-ledger-8962d9c904d5630b508ca2b10f2bf66e7f32a30b.tar.bz2 fork-ledger-8962d9c904d5630b508ca2b10f2bf66e7f32a30b.zip |
Add more baseline tests
Diffstat (limited to 'test')
-rw-r--r-- | test/baseline/cmd-convert.test | 35 | ||||
-rw-r--r-- | test/baseline/cmd-convert1.dat | 3 | ||||
-rw-r--r-- | test/baseline/cmd-convert2.dat | 2 | ||||
-rw-r--r-- | test/baseline/cmd-convert3.dat | 2 | ||||
-rw-r--r-- | test/baseline/cmd-convert4.dat | 2 | ||||
-rw-r--r-- | test/baseline/cmd-echo.test | 12 | ||||
-rw-r--r-- | test/baseline/cmd-entry.test | 43 | ||||
-rw-r--r-- | test/baseline/cmd-org.test | 28 | ||||
-rw-r--r-- | test/baseline/cmd-pricemap.test | 36 | ||||
-rw-r--r-- | test/baseline/cmd-select.test | 62 | ||||
-rw-r--r-- | test/baseline/cmd-source.test | 26 | ||||
-rw-r--r-- | test/baseline/cmd-stats.test | 31 | ||||
-rw-r--r-- | test/baseline/cmd-xact.test | 43 |
13 files changed, 325 insertions, 0 deletions
diff --git a/test/baseline/cmd-convert.test b/test/baseline/cmd-convert.test new file mode 100644 index 00000000..181165df --- /dev/null +++ b/test/baseline/cmd-convert.test @@ -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 + diff --git a/test/baseline/cmd-convert1.dat b/test/baseline/cmd-convert1.dat new file mode 100644 index 00000000..542a19e3 --- /dev/null +++ b/test/baseline/cmd-convert1.dat @@ -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,, diff --git a/test/baseline/cmd-convert2.dat b/test/baseline/cmd-convert2.dat new file mode 100644 index 00000000..190095c3 --- /dev/null +++ b/test/baseline/cmd-convert2.dat @@ -0,0 +1,2 @@ +date,amount,desc, +01/01/2011,20.00 EUR,test, diff --git a/test/baseline/cmd-convert3.dat b/test/baseline/cmd-convert3.dat new file mode 100644 index 00000000..7c31d986 --- /dev/null +++ b/test/baseline/cmd-convert3.dat @@ -0,0 +1,2 @@ +date,amount, +01/01/2011,, diff --git a/test/baseline/cmd-convert4.dat b/test/baseline/cmd-convert4.dat new file mode 100644 index 00000000..644f6806 --- /dev/null +++ b/test/baseline/cmd-convert4.dat @@ -0,0 +1,2 @@ +date,amount, +bogus,$10, diff --git a/test/baseline/cmd-echo.test b/test/baseline/cmd-echo.test new file mode 100644 index 00000000..af3d06ec --- /dev/null +++ b/test/baseline/cmd-echo.test @@ -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 + diff --git a/test/baseline/cmd-entry.test b/test/baseline/cmd-entry.test new file mode 100644 index 00000000..0ecfa5eb --- /dev/null +++ b/test/baseline/cmd-entry.test @@ -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 + diff --git a/test/baseline/cmd-org.test b/test/baseline/cmd-org.test new file mode 100644 index 00000000..12a380f5 --- /dev/null +++ b/test/baseline/cmd-org.test @@ -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 + diff --git a/test/baseline/cmd-pricemap.test b/test/baseline/cmd-pricemap.test new file mode 100644 index 00000000..6fbaa2fe --- /dev/null +++ b/test/baseline/cmd-pricemap.test @@ -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 + diff --git a/test/baseline/cmd-select.test b/test/baseline/cmd-select.test new file mode 100644 index 00000000..c8ce7008 --- /dev/null +++ b/test/baseline/cmd-select.test @@ -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 [0m 20.00 EUR +12-Feb-28 F [0m -20.00 EUR +12-Feb-29 Test [0m 10.01 EUR +12-Feb-29 F [0m -10.01 EUR +12-Mar-24 C [0m 30.00 EUR +12-Mar-24 D [0m -30.00 EUR +12-Mar-25 E [0m 40.00 GBP +12-Mar-25 F [0m -40.00 GBP +end test + +test select "date, account, amount from posts where account =~ /^e/" +12-Feb-28 E [0m 20.00 EUR +12-Mar-25 E [0m 40.00 GBP +end test + +test select "date, account, amount from posts where account =~ /e/" +12-Feb-28 E [0m 20.00 EUR +12-Feb-29 Test [0m 10.01 EUR +12-Mar-25 E [0m 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 [0m 20.00 EUR +12-Feb-29 Test [0m 10.01 EUR +12-Mar-25 E [0m 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 + diff --git a/test/baseline/cmd-source.test b/test/baseline/cmd-source.test new file mode 100644 index 00000000..e78ae6fd --- /dev/null +++ b/test/baseline/cmd-source.test @@ -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 + diff --git a/test/baseline/cmd-stats.test b/test/baseline/cmd-stats.test new file mode 100644 index 00000000..ac8e1383 --- /dev/null +++ b/test/baseline/cmd-stats.test @@ -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 + diff --git a/test/baseline/cmd-xact.test b/test/baseline/cmd-xact.test new file mode 100644 index 00000000..f473c3dd --- /dev/null +++ b/test/baseline/cmd-xact.test @@ -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 + |