diff options
Diffstat (limited to 'test')
168 files changed, 4556 insertions, 71 deletions
diff --git a/test/ConfirmTests.py b/test/ConfirmTests.py index 6fc04336..dffa74a6 100755 --- a/test/ConfirmTests.py +++ b/test/ConfirmTests.py @@ -13,6 +13,8 @@ harness = LedgerHarness(sys.argv) tests = sys.argv[3] if not os.path.isdir(tests) and not os.path.isfile(tests): + sys.stderr.write("'%s' is not a directory or file (cwd %s)" % + (tests, os.getcwd())) sys.exit(1) commands = [ diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py index c0dbe368..b8900971 100755 --- a/test/LedgerHarness.py +++ b/test/LedgerHarness.py @@ -34,6 +34,7 @@ class LedgerHarness: failed = 0 verify = False gmalloc = False + python = False def __init__(self, argv): if not os.path.isfile(argv[1]): @@ -43,12 +44,13 @@ class LedgerHarness: print "Cannot find source path at '%s'" % argv[2] sys.exit(1) - self.ledger = argv[1] - self.sourcepath = argv[2] + self.ledger = os.path.abspath(argv[1]) + self.sourcepath = os.path.abspath(argv[2]) self.succeeded = 0 self.failed = 0 self.verify = '--verify' in argv self.gmalloc = '--gmalloc' in argv + self.python = '--python' in argv def run(self, command, verify=None, gmalloc=None, columns=True): env = os.environ.copy() @@ -77,8 +79,16 @@ class LedgerHarness: command = re.sub('\$ledger', '%s%s %s' % \ (self.ledger, insert, '--args-only'), command) + valgrind = '/usr/bin/valgrind' + if not os.path.isfile(valgrind): + valgrind = '/opt/local/bin/valgrind' + + if os.path.isfile(valgrind) and '--verify' in insert: + command = valgrind + ' -q ' + command + return Popen(command, shell=True, close_fds=True, env=env, - stdin=PIPE, stdout=PIPE, stderr=PIPE) + stdin=PIPE, stdout=PIPE, stderr=PIPE, + cwd=self.sourcepath) def read(self, fd): text = "" @@ -108,8 +118,10 @@ class LedgerHarness: sys.stdout.write(".") self.succeeded += 1 - def failure(self): + def failure(self, name=None): sys.stdout.write("E") + if name: + sys.stdout.write("[%s]" % name) self.failed += 1 def exit(self): diff --git a/test/PyUnitTests.py b/test/PyUnitTests.py index a77d99ad..2aed48b9 100755 --- a/test/PyUnitTests.py +++ b/test/PyUnitTests.py @@ -1,6 +1,13 @@ -#!/bin/sh +#!/bin/bash + +set -e + +PYTHONPATH="%builddir%/.libs":$PYTHONPATH \ +LD_LIBRARY_PATH="%builddir%/.libs":$LD_LIBRARY_PATH \ +DYLD_LIBRARY_PATH="%builddir%/.libs":$DYLD_LIBRARY_PATH \ + %python% "%builddir%"/test/python/ConvertedTests.py PYTHONPATH="%builddir%/.libs":$PYTHONPATH \ LD_LIBRARY_PATH="%builddir%/.libs":$LD_LIBRARY_PATH \ DYLD_LIBRARY_PATH="%builddir%/.libs":$DYLD_LIBRARY_PATH \ - %python% "%builddir%"/test/python/UnitTests.py + %python% "%srcdir%"/test/python/UnitTests.py diff --git a/test/RegressTests.py b/test/RegressTests.py index 28a6c709..7d67eb21 100755 --- a/test/RegressTests.py +++ b/test/RegressTests.py @@ -31,6 +31,8 @@ harness = LedgerHarness(args) tests = args[3] if not os.path.isdir(tests) and not os.path.isfile(tests): + sys.stderr.write("'%s' is not a directory or file (cwd %s)" % + (tests, os.getcwd())) sys.exit(1) class RegressFile(object): @@ -40,6 +42,7 @@ class RegressFile(object): def transform_line(self, line): line = re.sub('\$sourcepath', harness.sourcepath, line) + line = re.sub('\$FILE', os.path.abspath(self.filename), line) return line def read_test(self): @@ -90,7 +93,7 @@ class RegressFile(object): def notify_user(self, msg, test): print msg print "--" - print test['command'], + print self.transform_line(test['command']), print "--" def run_test(self, test): @@ -98,7 +101,8 @@ class RegressFile(object): if test['command'].find("-f - ") != -1: use_stdin = True else: - test['command'] = (('$ledger -f "%s" ' % self.filename) + + test['command'] = (('$ledger -f "%s" ' % + os.path.abspath(self.filename)) + test['command']) p = harness.run(test['command'], @@ -130,9 +134,7 @@ class RegressFile(object): printed = False index = 0 if test['error'] is not None: - for line in unified_diff([re.sub('\$FILE', self.filename, line) - for line in test['error']], - harness.readlines(p.stderr)): + for line in unified_diff(test['error'], harness.readlines(p.stderr)): index += 1 if index < 3: continue @@ -148,14 +150,16 @@ class RegressFile(object): if success: harness.success() else: - harness.failure() + harness.failure(os.path.basename(self.filename)) + print "STDERR:" + print p.stderr.read() else: if success: print if test['exitcode']: self.notify_user("FAILURE in exit code (%d != %d) from %s:" % (test['exitcode'], p.returncode, self.filename), test) - harness.failure() + harness.failure(os.path.basename(self.filename)) def run_tests(self): test = self.read_test() @@ -179,7 +183,10 @@ if __name__ == '__main__': if os.path.isdir(tests): tests = [os.path.join(tests, x) - for x in os.listdir(tests) if x.endswith('.test')] + for x in os.listdir(tests) + if (x.endswith('.test') and + (not '_py.test' in x or (harness.python and + not harness.verify)))] if pool: pool.map(do_test, tests, 1) else: diff --git a/test/baseline/cmd-accounts.test b/test/baseline/cmd-accounts.test new file mode 100644 index 00000000..be6365fd --- /dev/null +++ b/test/baseline/cmd-accounts.test @@ -0,0 +1,38 @@ +2011-01-01 * Opening balance + Assets:Bank 10.00 GBP + Equity:Opening balance + +2012-01-02 * List XXX before AAA to test sorting + Assets:XXX 5.00 GBP + Assets:Bank + +2012-01-03 * List AAA after XXX to test sorting + Assets:AAA 3.00 GBP + Assets:Bank + +2012-01-03 * Account name with UTF-8 + Assets:♚ 3.00 GBP + Assets:Testing123ÕßDone + +test accounts +Assets:Bank +Equity:Opening balance +Assets:XXX +Assets:AAA +Assets:♚ +Assets:Testing123ÕßDone +end test + +test accounts assets:a +Assets:AAA +end test + +test accounts b +Assets:Bank +Equity:Opening balance +end test + +test accounts ß +Assets:Testing123ÕßDone +end test + diff --git a/test/baseline/cmd-balance.test b/test/baseline/cmd-balance.test new file mode 100644 index 00000000..064a046d --- /dev/null +++ b/test/baseline/cmd-balance.test @@ -0,0 +1,85 @@ + +2012-01-01 * Opening balances + Assets:A 10.00 + Equity:Opening balances -10.00 + +2012-01-02 * A to B + Assets:A -10.00 + Assets:B 10.00 + +2012-01-03 * B partly to C + Assets:B -5.00 + Assets:C 5.00 + +2012-01-04 * Borrow + Assets:A 10.00 + Liabilities:A -10.00 + +2012-01-05 * Return A + Assets:A -10.00 + Liabilities:A 10.00 + +test bal + 10 Assets + 5 B + 5 C + -10 Equity:Opening balances +-------------------- + 0 +end test + +test bal -n + 10 Assets + -10 Equity +-------------------- + 0 +end test + +test bal -n -E + 10 Assets + -10 Equity + 0 Liabilities +-------------------- + 0 +end test + +test bal -E + 10 Assets + 0 A + 5 B + 5 C + -10 Equity:Opening balances + 0 Liabilities:A +-------------------- + 0 +end test + +test bal --flat + 5 Assets:B + 5 Assets:C + -10 Equity:Opening balances +-------------------- + 0 +end test + +test bal --flat -E + 0 Assets:A + 5 Assets:B + 5 Assets:C + -10 Equity:Opening balances + 0 Liabilities:A +-------------------- + 0 +end test + +test bal -E --flat --no-total + 0 Assets:A + 5 Assets:B + 5 Assets:C + -10 Equity:Opening balances + 0 Liabilities:A +end test + +test bal -n --flat +end test + diff --git a/test/baseline/cmd-budget.test b/test/baseline/cmd-budget.test new file mode 100644 index 00000000..91d5a901 --- /dev/null +++ b/test/baseline/cmd-budget.test @@ -0,0 +1,65 @@ +~ Monthly + Expenses:Phone 10.00 GBP + Expenses:Rent 550.00 GBP + Assets + +2012-01-10 * Phone expense on holidays + Expenses:Phone 12.00 EUR @@ 10.00 GBP + Assets:Cash -10.00 GBP + +2012-01-31 * Rent expense + Expenses:Rent 550.00 GBP + Assets:Cash -550.00 GBP + +2012-02-28 * Phone expense + Expenses:Phone 20.00 GBP + Assets:Cash -20.00 GBP + +2012-02-29 * Rent expense + Expenses:Rent 530.00 GBP + Assets:Cash -530.00 GBP + +2012-03-10 * Phone expense + Expenses:Phone 15.00 GBP + Assets:Cash -15.00 GBP + +2012-03-31 * Rent expense + Expenses:Rent 570.00 GBP + Assets:Cash -570.00 GBP + +test budget -X GBP -p "in january 2012" + -560.00 GBP -560.00 GBP 0 100% Assets + 560.00 GBP 560.00 GBP 0 100% Expenses + 10.00 GBP 10.00 GBP 0 100% Phone + 550.00 GBP 550.00 GBP 0 100% Rent +------------ ------------ ------------ ----- + 0 0 0 0 +end test + +test budget -X GBP -p "in feb 2012" + -550.00 GBP -560.00 GBP 10.00 GBP 98% Assets + 550.00 GBP 560.00 GBP -10.00 GBP 98% Expenses + 20.00 GBP 10.00 GBP 10.00 GBP 200% Phone + 530.00 GBP 550.00 GBP -20.00 GBP 96% Rent +------------ ------------ ------------ ----- + 0 0 0 0 +end test + +test budget -X GBP -p "in march 2012" + -585.00 GBP -560.00 GBP -25.00 GBP 104% Assets + 585.00 GBP 560.00 GBP 25.00 GBP 104% Expenses + 15.00 GBP 10.00 GBP 5.00 GBP 150% Phone + 570.00 GBP 550.00 GBP 20.00 GBP 104% Rent +------------ ------------ ------------ ----- + 0 0 0 0 +end test + +test budget -X GBP --now "2012-03-31" +-1695.00 GBP -1680.00 GBP -15.00 GBP 101% Assets + 1695.00 GBP 1680.00 GBP 15.00 GBP 101% Expenses + 45.00 GBP 30.00 GBP 15.00 GBP 150% Phone + 1650.00 GBP 1650.00 GBP 0 100% Rent +------------ ------------ ------------ ----- + 0 0 0 0 +end test + diff --git a/test/baseline/cmd-cleared.test b/test/baseline/cmd-cleared.test new file mode 100644 index 00000000..501d207f --- /dev/null +++ b/test/baseline/cmd-cleared.test @@ -0,0 +1,36 @@ +2012-02-23 * Test 1 + A 10.00 + B + +2012-02-24 Test 1 + C 15.00 + D + +; leave E/F uncleared +2012-02-25 Test 1 + E 20.00 + F + +; have a cleared posting last for C +2012-02-26 * Test 1 + C 30.00 + G + +; have an uncleared posting last for A +2012-02-27 Test 1 + A 40.00 + H + +test cleared + 50 10 12-Feb-23 A + -10 -10 12-Feb-23 B + 45 30 12-Feb-26 C + -15 0 D + 20 0 E + -20 0 F + -30 -30 12-Feb-26 G + -40 0 H +---------------- ---------------- --------- + 0 0 +end test + diff --git a/test/baseline/cmd-commodities.test b/test/baseline/cmd-commodities.test new file mode 100644 index 00000000..0ce6f7a0 --- /dev/null +++ b/test/baseline/cmd-commodities.test @@ -0,0 +1,30 @@ +2011-01-01 * Opening balance + Assets:Bank 10.00 GBP + Equity:Opening balance + +2011-03-04 * Buy AAA + Assets:Broker 2 AAA @ 0.90 GBP + Assets:Bank -1.80 GBP + +2011-03-05 * Buy AA2 + Assets:Broker 2 "AA2" @ 1.00 GBP + Assets:Bank + +2011-03-06 * Get Miles&More airmiles + Assets:Rewards 1000 "M&M" + Income:Rewards + +test commodities +GBP +AAA +"AA2" +"M&M" +end test + +test commodities Assets:Rewards +"M&M" +end test + +test commodities no:such:account +end test + 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-csv.test b/test/baseline/cmd-csv.test new file mode 100644 index 00000000..110e3d58 --- /dev/null +++ b/test/baseline/cmd-csv.test @@ -0,0 +1,53 @@ + +2012-01-01 * Opening balances + Assets:A 10.00 + Equity:Opening balances -10.00 + +2012-01-02 * Cleared posting + Assets:A -10.00 + Assets:B 10.00 + +2012-01-03 Uncleared posting + Assets:B -5.00 + Assets:C 5.00 + +2012-01-04=2012-01-05 * aux date + Assets:A 10.00 + Liabilities:A -10.00 + +2012-01-05 * (100) Code + Assets:A -10.00 + Liabilities:A 10.00 + +2012-01-06 * (100) Specify commodity + Assets:A $-10.00 + Liabilities:A $10.00 + +2012-01-07 * (100) Specify commodity + Assets:A -10.00 EUR + Liabilities:A 10.00 EUR + +2012-01-08 * (100) With note + ;This is an xact note + Assets:A -10.00 EUR + Liabilities:A 10.00 EUR + +test csv +"2012/01/01","","Opening balances","Assets:A","","10","*","" +"2012/01/01","","Opening balances","Equity:Opening balances","","-10","*","" +"2012/01/02","","Cleared posting","Assets:A","","-10","*","" +"2012/01/02","","Cleared posting","Assets:B","","10","*","" +"2012/01/03","","Uncleared posting","Assets:B","","-5","","" +"2012/01/03","","Uncleared posting","Assets:C","","5","","" +"2012/01/04","","aux date","Assets:A","","10","*","" +"2012/01/04","","aux date","Liabilities:A","","-10","*","" +"2012/01/05","100","Code","Assets:A","","-10","*","" +"2012/01/05","100","Code","Liabilities:A","","10","*","" +"2012/01/06","100","Specify commodity","Assets:A","$","-10","*","" +"2012/01/06","100","Specify commodity","Liabilities:A","$","10","*","" +"2012/01/07","100","Specify commodity","Assets:A","EUR","-10","*","" +"2012/01/07","100","Specify commodity","Liabilities:A","EUR","10","*","" +"2012/01/08","100","With note","Assets:A","EUR","-10","*","This is an xact note" +"2012/01/08","100","With note","Liabilities:A","EUR","10","*","This is an xact note" +end test + 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..0de39b9c --- /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 --now 2012/03/25 entry "Test 1" +2012/03/25 Test 1 + A $10.00 + B +end test + +test --now 2012/03/25 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 --now 2012/03/25 entry "Test 3" +2012/03/25 Test 4 + E 30.00 GBP + F +end test + +test --now 2012/03/25 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-payees.test b/test/baseline/cmd-payees.test new file mode 100644 index 00000000..64d6bcf5 --- /dev/null +++ b/test/baseline/cmd-payees.test @@ -0,0 +1,48 @@ +2011-03-01 * Z + A 10 + B + +2011-03-02 * A + C 10 + D + +2011-03-03 * 9 + B 10 + E + +2011-03-04 * B + B 10 + E + +2011-03-05 * 1 + B 10 + E + +2011-03-06 * 2 + ; Payee: 3 + E 10 + F + +test payees +1 +3 +9 +A +B +Z +end test + +test payees a +Z +end test + +test payees no:such:account +end test + +test payees "^B$" +1 +9 +B +Z +end test + diff --git a/test/baseline/cmd-pricedb.test b/test/baseline/cmd-pricedb.test new file mode 100644 index 00000000..4a220054 --- /dev/null +++ b/test/baseline/cmd-pricedb.test @@ -0,0 +1,39 @@ +2012-01-01 * Opening balance + A 10.00 GBP + B + +2012-01-02 * Test + A 10.00 GBP @@ 12.00 EUR + B + +2012-01-03 * Test + B 12.00 EUR @@ 15.80 USD + C + +2012-01-04 * Test + C 15.80 USD @ 0.63 GBP + D + +test pricedb +P 2012/01/02 00:00:00 GBP 1.20 EUR +P 2012/01/03 00:00:00 EUR 1.3166666667 USD +P 2012/01/04 00:00:00 USD 0.63 GBP +end test + +test pricedb EUR +P 2012/01/03 00:00:00 EUR 1.3166666667 USD +end test + +test pricedb GBP +P 2012/01/02 00:00:00 GBP 1.20 EUR +end test + +test pricedb USD +P 2012/01/04 00:00:00 USD 0.63 GBP +end test + +test pricedb U +P 2012/01/03 00:00:00 EUR 1.3166666667 USD +P 2012/01/04 00:00:00 USD 0.63 GBP +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-prices.test b/test/baseline/cmd-prices.test new file mode 100644 index 00000000..ee2b4ba1 --- /dev/null +++ b/test/baseline/cmd-prices.test @@ -0,0 +1,39 @@ +2012-01-01 * Opening balance + A 10.00 GBP + B + +2012-01-02 * Test + A 10.00 GBP @@ 12.00 EUR + B + +2012-01-03 * Test + B 12.00 EUR @@ 15.80 USD + C + +2012-01-04 * Test + C 15.80 USD @ 0.63 GBP + D + +test prices +2012/01/02 GBP 1.20 EUR +2012/01/03 EUR 1.3166666667 USD +2012/01/04 USD 0.63 GBP +end test + +test prices EUR +2012/01/03 EUR 1.3166666667 USD +end test + +test prices USD +2012/01/04 USD 0.63 GBP +end test + +test prices GBP +2012/01/02 GBP 1.20 EUR +end test + +test prices U +2012/01/03 EUR 1.3166666667 USD +2012/01/04 USD 0.63 GBP +end test + diff --git a/test/baseline/cmd-register.test b/test/baseline/cmd-register.test new file mode 100644 index 00000000..afb78fb0 --- /dev/null +++ b/test/baseline/cmd-register.test @@ -0,0 +1,40 @@ +2012-01-10 * Phone expense on holidays + Expenses:Phone 12.00 EUR @@ 10.00 GBP + Assets:Cash -10.00 GBP + +2012-01-31 * Rent expense + Expenses:Rent 550.00 GBP + Assets:Cash -550.00 GBP + +2012-02-01 * Buy AAA + Assets:Investment 1 AAA @ 10.00 GBP + Assets:Cash -10.00 GBP + +test reg +12-Jan-10 Phone expense on ho.. Expenses:Phone 12.00 EUR 12.00 EUR + Assets:Cash -10.00 GBP 12.00 EUR + -10.00 GBP +12-Jan-31 Rent expense Expenses:Rent 550.00 GBP 12.00 EUR + 540.00 GBP + Assets:Cash -550.00 GBP 12.00 EUR + -10.00 GBP +12-Feb-01 Buy AAA Assets:Investment 1 AAA 1 AAA + 12.00 EUR + -10.00 GBP + Assets:Cash -10.00 GBP 1 AAA + 12.00 EUR + -20.00 GBP +end test + +test r :inve +12-Feb-01 Buy AAA Assets:Investment 1 AAA 1 AAA +end test + +test reg :inve +12-Feb-01 Buy AAA Assets:Investment 1 AAA 1 AAA +end test + +test register :inve +12-Feb-01 Buy AAA Assets:Investment 1 AAA 1 AAA +end test + diff --git a/test/baseline/cmd-script.test b/test/baseline/cmd-script.test new file mode 100644 index 00000000..b33dd82d --- /dev/null +++ b/test/baseline/cmd-script.test @@ -0,0 +1,21 @@ +test eval 'foo(w, u)=(z=w+u;z*2); (a=1 + 1; foo(10, 15))' +50 +end test + +test eval 'foo(x, y, z)=print(x, y, z); bar(x)=x; foo(1, 2, 3); bar(3)' +123 +3 +end test + +test eval 'total_expr=$100;amount_expr=$15;x=total_expr;x=x/5;x=amount_expr-x*5;x' +$-85 +end test + +test eval 'foo = x, y, z -> print(x, y, z); foo(1, 2, 3)' +123 +1 +end test + +test eval 'foo(x,y)=y(1, 2, 3);foo(amount_expr, (s,d,t -> t))' +3 +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..95a10924 --- /dev/null +++ b/test/baseline/cmd-source.test @@ -0,0 +1,64 @@ +~ xxx + +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 + +2012-03-25 * Test + G AAA + H + +2012-03-26 * Test + I 1,00.00 EUR + J -100.00 EUR + +2012-03-27 * Test + K 100.00 EUR + L -200.00 EUR + +test source -> 7 +__ERROR__ +While parsing file "$FILE", line 1: +While parsing periodic transaction: +> ~ xxx +Error: Unexpected date period token 'xxx' +While parsing file "$FILE", line 6: +Error: Only one posting with null amount allowed per transaction +While parsing file "$FILE", line 11: +Error: Only one posting with null amount allowed per transaction +While parsing file "$FILE", line 13: +While parsing transaction: +> 2012/03/xx +Error: Invalid date: 2012/03/xx +While parsing file "$FILE", line 18: +While parsing posting: + G AAA + ^^^ +Error: No quantity specified for amount +While parsing file "$FILE", line 22: +While parsing posting: + I 1,00.00 EUR + ^^^^^^^^^^^ +Error: Incorrect use of thousand-mark comma +While parsing file "$FILE", line 27: +While balancing transaction from "$FILE", lines 25-27: +> 2012-03-27 * Test +> K 100.00 EUR +> L -200.00 EUR +Unbalanced remainder is: + -100.00 EUR +Amount to balance against: + 100.00 EUR +Error: Transaction does not balance +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..6f4ee014 --- /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 --now 2012/03/25 xact "Test 1" +2012/03/25 Test 1 + A $10.00 + B +end test + +test --now 2012/03/25 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 --now 2012/03/25 xact "Test 3" +2012/03/25 Test 4 + E 30.00 GBP + F +end test + +test --now 2012/03/25 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 + diff --git a/test/baseline/dir-account.test b/test/baseline/dir-account.test new file mode 100644 index 00000000..e8c3fc54 --- /dev/null +++ b/test/baseline/dir-account.test @@ -0,0 +1,45 @@ +--explicit +--pedantic + +commodity $ + format $1,000.00 + +account Assets:Cash + check abs(amount) <= 20 + check commodity == '$' + default + +account Expenses:Food + alias food + payee KFC + +2012-02-27 KFC + Expenses:Unknown $20.00 + Assets:Cash + +2012-02-28 KFC + food $20.00 + Assets:Cash + +2012-02-29 KFC + food $25.00 + Assets:Cash + +2012-02-29 KFC + food $25.00 + Assets:Cash + +test reg +12-Feb-27 KFC Expenses:Food $20.00 $20.00 + Assets:Cash $-20.00 0 +12-Feb-28 KFC Expenses:Food $20.00 $20.00 + Assets:Cash $-20.00 0 +12-Feb-29 KFC Expenses:Food $25.00 $25.00 + Assets:Cash $-25.00 0 +12-Feb-29 KFC Expenses:Food $25.00 $25.00 + Assets:Cash $-25.00 0 +__ERROR__ +Warning: "$FILE", line 26: Transaction check failed: (abs(amount) <= {20}) +Warning: "$FILE", line 30: Transaction check failed: (abs(amount) <= {20}) +end test + diff --git a/test/baseline/dir-apply.dat b/test/baseline/dir-apply.dat new file mode 100644 index 00000000..bcdcacf1 --- /dev/null +++ b/test/baseline/dir-apply.dat @@ -0,0 +1,3 @@ +2012-03-12 KFC + Expenses:Food $40 + Assets:Cash diff --git a/test/baseline/dir-apply.test b/test/baseline/dir-apply.test new file mode 100644 index 00000000..7d9e91d9 --- /dev/null +++ b/test/baseline/dir-apply.test @@ -0,0 +1,34 @@ +apply account Master Account + +2012-03-12 KFC + Expenses:Food $20 + Assets:Cash + +end apply account + +apply account Master Account + +2012-03-12 KFC + Expenses:Food $20 + Assets:Cash + +end apply + +apply account Master Account + +2012-03-12 KFC + Expenses:Food $20 + Assets:Cash + +end + +apply account Master Account +include dir-apply.dat +end + +test reg food +12-Mar-12 KFC Master A:Expenses:Food $20 $20 +12-Mar-12 KFC Master A:Expenses:Food $20 $40 +12-Mar-12 KFC Master A:Expenses:Food $20 $60 +12-Mar-12 KFC Master A:Expenses:Food $40 $100 +end test diff --git a/test/baseline/dir-commodity-alias.test b/test/baseline/dir-commodity-alias.test new file mode 100644 index 00000000..4de7f406 --- /dev/null +++ b/test/baseline/dir-commodity-alias.test @@ -0,0 +1,23 @@ +commodity $ + alias USD + +2012-03-12 * $ + A $10.00 + B + +2012-03-12 * USD + A 15.00 USD + B + +test bal + 25.00 $ A + -25.00 $ B +-------------------- + 0 +end test + +test reg a +12-Mar-12 $ A 10.00 $ 10.00 $ +12-Mar-12 USD A 15.00 $ 25.00 $ +end test + diff --git a/test/baseline/dir-commodity-value.test b/test/baseline/dir-commodity-value.test new file mode 100644 index 00000000..5e8fe789 --- /dev/null +++ b/test/baseline/dir-commodity-value.test @@ -0,0 +1,24 @@ +commodity $ + value 10 EUR + +commodity USD + alias FOO + value 25 EUR + +2012-03-06 KFC + Expenses:Food $20.00 + Assets:Cash + +2012-03-08 KFC + Expenses:Food USD 750,00 + Assets:Cash + +2012-03-10 KFC + Expenses:Food USD 750,00 + Assets:Cash + +test reg food -X EUR --now=2012-03-15 +12-Mar-06 KFC Expenses:Food 200 EUR 200 EUR +12-Mar-08 KFC Expenses:Food 18750 EUR 18950 EUR +12-Mar-10 KFC Expenses:Food 18750 EUR 37700 EUR +end test diff --git a/test/baseline/dir-commodity.test b/test/baseline/dir-commodity.test new file mode 100644 index 00000000..fc925648 --- /dev/null +++ b/test/baseline/dir-commodity.test @@ -0,0 +1,21 @@ +account A +account B +commodity GBP + +2012-03-25 GBP + A 10.00 GBP + B + +2012-03-26 EUR + A 20.00 EUR + B + +test bal --pedantic -> 1 +__ERROR__ +While parsing file "$FILE", line 10: +While parsing posting: + A 20.00 EUR + ^^^^^^^^^ +Error: Unknown commodity 'EUR' +end test + diff --git a/test/baseline/dir-import_py.test b/test/baseline/dir-import_py.test new file mode 100644 index 00000000..ee9f6001 --- /dev/null +++ b/test/baseline/dir-import_py.test @@ -0,0 +1,23 @@ +import os + +tag PATH + check os.path.isfile(value) + +2012-02-29 KFC + ; PATH: test/baseline/feat-import_py.test + Expenses:Food $20 + Assets:Cash + +2012-02-29 KFC + ; PATH: test/baseline/feat-import_noexist.test + Expenses:Food $20 + Assets:Cash + +test reg +12-Feb-29 KFC Expenses:Food $20 $20 + Assets:Cash $-20 0 +12-Feb-29 KFC Expenses:Food $20 $20 + Assets:Cash $-20 0 +__ERROR__ +Warning: "$sourcepath/test/baseline/dir-import_py.test", line 14: Metadata check failed for (PATH: test/baseline/feat-import_noexist.test): ((os.path).isfile(value)) +end test diff --git a/test/baseline/dir-payee.test b/test/baseline/dir-payee.test new file mode 100644 index 00000000..b81bbc2b --- /dev/null +++ b/test/baseline/dir-payee.test @@ -0,0 +1,12 @@ +payee KFC + alias Kentucky Fried Chicken + +2012-03-25 * Kentucky Fried Chicken + A 10 + B + +test reg +12-Mar-25 KFC A 10 10 + B -10 0 +end test + diff --git a/test/baseline/dir-python_py.test b/test/baseline/dir-python_py.test new file mode 100644 index 00000000..99ff4b1b --- /dev/null +++ b/test/baseline/dir-python_py.test @@ -0,0 +1,28 @@ +python + import os + def check_path(path): + return os.path.isfile(path) + +tag PATH + check check_path(value) + check os.path.isfile(value) + +2012-02-29 KFC + ; PATH: test/baseline/feat-import_py.test + Expenses:Food $20 + Assets:Cash + +2012-02-29 KFC + ; PATH: test/baseline/feat-import_noexist.test + Expenses:Food $20 + Assets:Cash + +test reg +12-Feb-29 KFC Expenses:Food $20 $20 + Assets:Cash $-20 0 +12-Feb-29 KFC Expenses:Food $20 $20 + Assets:Cash $-20 0 +__ERROR__ +Warning: "$sourcepath/test/baseline/dir-python_py.test", line 18: Metadata check failed for (PATH: test/baseline/feat-import_noexist.test): check_path(value) +Warning: "$sourcepath/test/baseline/dir-python_py.test", line 18: Metadata check failed for (PATH: test/baseline/feat-import_noexist.test): ((os.path).isfile(value)) +end test diff --git a/test/baseline/dir-tag.test b/test/baseline/dir-tag.test new file mode 100644 index 00000000..cf668f29 --- /dev/null +++ b/test/baseline/dir-tag.test @@ -0,0 +1,21 @@ +tag Happy + check value == 'Valley' + +2012-02-27 * KFC + ; Happy: Valley + Expenses:Unknown $20.00 + ; Happy: Summer + Assets:Cash + +2012-02-28 * KFC + food $20.00 + Assets:Cash + +test reg +12-Feb-27 KFC Expenses:Unknown $20.00 $20.00 + Assets:Cash $-20.00 0 +12-Feb-28 KFC food $20.00 $20.00 + Assets:Cash $-20.00 0 +__ERROR__ +Warning: "$sourcepath/test/baseline/dir-tag.test", line 8: Metadata check failed for (Happy: Summer): (value == "Valley") +end test diff --git a/test/baseline/feat-annotations.test b/test/baseline/feat-annotations.test new file mode 100644 index 00000000..18f5d7d9 --- /dev/null +++ b/test/baseline/feat-annotations.test @@ -0,0 +1,37 @@ +2012-03-09 KFC + Expenses:Food 10 CHIK @ $50 + Assets:Cash + +2012-03-09 KFC + Assets:Cash $75 + Expenses:Food -10 CHIK {{$50}} @ $75 + Equity:Capital Gains $-25 + +2012-03-09 KFC + Expenses:Food 10 CHIK + Assets:Cash $-50 + +2012-03-09 KFC + Assets:Cash $75 + Expenses:Food -10 CHIK {{$50}} + Equity:Capital Gains $-25 + +test print +2012/03/09 KFC + Expenses:Food 10 CHIK @ $50 + Assets:Cash + +2012/03/09 KFC + Assets:Cash $75 + Expenses:Food -10 CHIK {$5} @ $75 + Equity:Capital Gains $-25 + +2012/03/09 KFC + Expenses:Food 10 CHIK + Assets:Cash $-50 + +2012/03/09 KFC + Assets:Cash $75 + Expenses:Food -10 CHIK {$5} + Equity:Capital Gains $-25 +end test diff --git a/test/baseline/feat-balance_assert.test b/test/baseline/feat-balance_assert.test new file mode 100644 index 00000000..a03cbb0e --- /dev/null +++ b/test/baseline/feat-balance_assert.test @@ -0,0 +1,13 @@ +2012-01-01 Opening Balance + Assets:Checking $100 + Equity + +2012-01-01 Reconciliation + [Assets:Checking] = $100 + +test balance + $100 Assets:Checking + $-100 Equity +-------------------- + 0 +end test diff --git a/test/baseline/feat-check.test b/test/baseline/feat-check.test index a5f0c8ad..a9db1ec4 100644 --- a/test/baseline/feat-check.test +++ b/test/baseline/feat-check.test @@ -13,6 +13,6 @@ test bal -------------------- 0 __ERROR__ -Warning: Transaction check failed: (account =~ /Foo/) -Warning: Check failed: account("Assets:Checking").all(account =~ /Expense/) +Warning: "$sourcepath/test/baseline/feat-check.test", line 6: Transaction check failed: (account =~ /Foo/) +Warning: "$sourcepath/test/baseline/feat-check.test", line 8: Check failed: account("Assets:Checking").all(account =~ /Expense/) end test diff --git a/test/baseline/feat-fixated-prices.test b/test/baseline/feat-fixated-prices.test index f4370870..4767d866 100644 --- a/test/baseline/feat-fixated-prices.test +++ b/test/baseline/feat-fixated-prices.test @@ -1,3 +1,5 @@ +P 1989/01/15 12:00:00 GAL $3 + 1990/01/01 Payee Expenses:Gas 100 GAL {=$2} Liabilities:MasterCard $-200 diff --git a/test/baseline/feat-fixated-prices_2.test b/test/baseline/feat-fixated-prices_2.test index b7b71c83..ecbdfe9a 100644 --- a/test/baseline/feat-fixated-prices_2.test +++ b/test/baseline/feat-fixated-prices_2.test @@ -1,10 +1,10 @@ -fixed XCD $0.374531835206 +apply fixed XCD $0.374531835206 2008/04/08 KFC Expenses:Food XCD 43.00 Assets:Cash -end fixed +end apply fixed test reg 08-Apr-08 KFC Expenses:Food XCD 43.00 XCD 43.00 diff --git a/test/baseline/feat-import_py.test b/test/baseline/feat-import_py.test new file mode 100644 index 00000000..6bd77586 --- /dev/null +++ b/test/baseline/feat-import_py.test @@ -0,0 +1,23 @@ +--import featimport.py + +tag PATH + check check_path(value) + +2012-02-29 KFC + ; PATH: test/baseline/feat-import_py.test + Expenses:Food $20 + Assets:Cash + +2012-02-29 KFC + ; PATH: test/baseline/feat-import_noexist.test + Expenses:Food $20 + Assets:Cash + +test reg +12-Feb-29 KFC Expenses:Food $20 $20 + Assets:Cash $-20 0 +12-Feb-29 KFC Expenses:Food $20 $20 + Assets:Cash $-20 0 +__ERROR__ +Warning: "$sourcepath/test/baseline/feat-import_py.test", line 14: Metadata check failed for (PATH: test/baseline/feat-import_noexist.test): check_path(value) +end test diff --git a/test/baseline/feat-option_py.test b/test/baseline/feat-option_py.test new file mode 100644 index 00000000..1b2a0c79 --- /dev/null +++ b/test/baseline/feat-option_py.test @@ -0,0 +1,14 @@ +python + def option_pyfirst(context): + print "In --pyfirst (from %s)" % context + + def option_pysecond(context, val): + print "In --pysecond=%s (from %s)" % (val, context) + +--pyfirst +--pysecond Hey + +test reg +In --pyfirst (from $FILE) +In --pysecond=Hey (from $FILE) +end test diff --git a/test/baseline/feat-value-expr.test b/test/baseline/feat-value-expr.test new file mode 100644 index 00000000..01f9780b --- /dev/null +++ b/test/baseline/feat-value-expr.test @@ -0,0 +1,99 @@ +;; A valuation function receives three arguments: +;; +;; 'source' A string identifying the commodity whose price +;; is being asked for (example: "EUR") +;; +;; 'date' The reference date the price should be relative. +;; +;; 'target' A string identifying the "target" commodity, or +;; the commodity the returned price should be in. +;; This argument is null if -V was used instead of -X. +;; +;; The valuation function should return an amount. If you've written your +;; function in Python, you can return something like Amount("$100"). If the +;; function returns an explicit value, that value is always used, regardless +;; of the commodity, the date, or the desired target commodity. + +define myfunc_seven(s, d, t) = 7 EUR + +;; In order to specific a fixed price, but still valuate that price into the +;; target commodity, use something like this: + +define myfunc_five(s, d, t) = market(5 EUR, d, t) + +;; The 'value' directive sets the valuation used for all commodities used in +;; the rest of the daat stream. This is the fallback, if nothing more +;; specific is found. + +value myfunc_seven + +;; You can set a specific valuation function on a per-commodity basis. +;; Instead of defining a function, you can also pass a lambda. + +commodity $ + value s, d, t -> 6 EUR + +;; Each account can also provide a default valuation function for any +;; commodities transferred to that account. + +account Expenses:Food5 + value myfunc_five + +;; The metadata field "Value", if found, overrides the valuation function on a +;; transaction-wide or per-posting basis. + += @XACT and Food + ; Value:: 8 EUR + (Equity) $1 + += @POST and Dining + (Expenses:Food9) $1 + ; Value:: 9 EUR + +;; Lastly, you can specify the valuation function/value for any specific +;; amount using the (( )) commodity annotation. + +2012-03-02 KFC + Expenses:Food2 $1 ((2 EUR)) + Assets:Cash2 + +2012-03-03 KFC + Expenses:Food3 $1 + ; Value:: 3 EUR + Assets:Cash3 + +2012-03-04 KFC + ; Value:: 4 EUR + Expenses:Food4 $1 + Assets:Cash4 + +2012-03-05 KFC + Expenses:Food5 $1 + Assets:Cash5 + +2012-03-06 KFC + Expenses:Food6 $1 + Assets:Cash6 + +2012-03-07 KFC + Expenses:Food7 1 CAD + Assets:Cas7 + +2012-03-08 XACT + Expenses:Food8 $1 + Assets:Cash8 + +2012-03-09 POST + Expenses:Dining9 $1 + Assets:Cash9 + +test reg -V food +12-Mar-02 KFC Expenses:Food2 2 EUR 2 EUR +12-Mar-03 KFC Expenses:Food3 3 EUR 5 EUR +12-Mar-04 KFC Expenses:Food4 4 EUR 9 EUR +12-Mar-05 KFC Expenses:Food5 5 EUR 14 EUR +12-Mar-06 KFC Expenses:Food6 6 EUR 20 EUR +12-Mar-07 KFC Expenses:Food7 7 EUR 27 EUR +12-Mar-08 XACT Expenses:Food8 8 EUR 35 EUR +12-Mar-09 POST (Expenses:Food9) 9 EUR 44 EUR +end test diff --git a/test/baseline/feat-value_py.test b/test/baseline/feat-value_py.test new file mode 100644 index 00000000..5efe315d --- /dev/null +++ b/test/baseline/feat-value_py.test @@ -0,0 +1,23 @@ +python + def print_type(val): + print type(val), val + +eval print_type(true) +eval print_type([2010/08/10]) +eval print_type(10) +eval print_type($10.00) +eval print_type($10.00 + CAD 30) +eval print_type("Hello!") +eval print_type(/Hello!/) +;eval print_type((1, 2, 3)) + +test reg +<type 'bool'> True +<type 'datetime.date'> 2010-08-10 +<class 'ledger.Amount'> 10 +<class 'ledger.Amount'> $10.00 +<class 'ledger.Balance'> $10.00 +CAD 30 +<type 'unicode'> Hello! +<class 'ledger.Value'> Hello! +end test diff --git a/test/baseline/featimport.py b/test/baseline/featimport.py new file mode 100644 index 00000000..9edd9ba3 --- /dev/null +++ b/test/baseline/featimport.py @@ -0,0 +1,4 @@ +import os + +def check_path(path_value): + return os.path.isfile(str(path_value)) diff --git a/test/baseline/featoption.py b/test/baseline/featoption.py new file mode 100644 index 00000000..caa4f2bc --- /dev/null +++ b/test/baseline/featoption.py @@ -0,0 +1,5 @@ +def option_pyfirst(context): + print "In --pyfirst (from %s)" % context + +def option_pysecond(context, val): + print "In --pysecond=%sh (from %s)" % (val, context) diff --git a/test/baseline/opt-auto-match.dat b/test/baseline/opt-auto-match.dat new file mode 100644 index 00000000..bfbf71eb --- /dev/null +++ b/test/baseline/opt-auto-match.dat @@ -0,0 +1,4 @@ +date,amount,desc, +2012/03/01,10,Food, +2012/03/02,10,Phone, +2012/03/02,10,Dining, diff --git a/test/baseline/opt-auto-match.test b/test/baseline/opt-auto-match.test new file mode 100644 index 00000000..7c3fb40a --- /dev/null +++ b/test/baseline/opt-auto-match.test @@ -0,0 +1,30 @@ +2012-01-01 * Opening balance + Assets:Cash 100.00 EUR + Equity:Opening Balance + +2012-01-02 * Food + Expenses:Food 25.00 EUR + Assets:Cash -25.00 EUR + +2012-01-03 * Phone + Expenses:Phone 10.00 EUR + Assets:Cash -10.00 EUR + +2012-01-04 * Dining + Expenses:Food 20.00 EUR + Liabilities:CC -20.00 EUR + +test --input-date-format "%Y-%m-%d" --auto-match convert test/baseline/opt-auto-match.dat +2012/03/01 * Food + Assets:Cash 10 + Equity:Unknown + +2012/03/02 * Phone + Assets:Cash 10 + Equity:Unknown + +2012/03/02 * Dining + Liabilities:CC 10 + Equity:Unknown +end test + diff --git a/test/baseline/opt-effective.test b/test/baseline/opt-aux-date.test index 9d1e73d0..9d1e73d0 100644 --- a/test/baseline/opt-effective.test +++ b/test/baseline/opt-aux-date.test diff --git a/test/baseline/opt-bold-if.test b/test/baseline/opt-bold-if.test index e69de29b..1f6f4c21 100644 --- a/test/baseline/opt-bold-if.test +++ b/test/baseline/opt-bold-if.test @@ -0,0 +1,16 @@ +2012-01-01 * Opening balance + Assets:Cash 100.00 EUR + Equity:Opening Balance + +2012-01-02 * Test + ; :test: + Expenses:Food 100.00 EUR + Assets:Cash -100.00 EUR + +test reg --bold-if 'has_tag("test")' +12-Jan-01 Opening balance Assets:Cash 100.00 EUR 100.00 EUR + Equity:Opening Balance -100.00 EUR 0 +[1m12-Jan-02[0m [1mTest [0m [1mExpenses:Food [0m [1m 100.00 EUR[0m [1m 100.00 EUR[0m + [1m [0m [1mAssets:Cash [0m [1m -100.00 EUR[0m [1m 0[0m +end test + diff --git a/test/baseline/opt-budget-format.test b/test/baseline/opt-budget-format.test index e69de29b..d2b84f98 100644 --- a/test/baseline/opt-budget-format.test +++ b/test/baseline/opt-budget-format.test @@ -0,0 +1,21 @@ +~ Monthly + Expenses:Phone 10.00 GBP + Expenses:Rent 550.00 GBP + Assets + +2012-02-28 * Phone expense + Expenses:Phone 20.00 GBP + Assets:Cash -20.00 GBP + +2012-02-29 * Rent expense + Expenses:Rent 530.00 GBP + Assets:Cash -530.00 GBP + +test budget --now 2012-02-29 --budget-format "%(justify(scrub(display_total), 0))\n" +(-550.00 GBP, 560.00 GBP) +(550.00 GBP, -560.00 GBP) +(20.00 GBP, -10.00 GBP) +(530.00 GBP, -550.00 GBP) +(0, 0) +end test + diff --git a/test/baseline/opt-check-payees.test b/test/baseline/opt-check-payees.test new file mode 100644 index 00000000..923729e7 --- /dev/null +++ b/test/baseline/opt-check-payees.test @@ -0,0 +1,37 @@ +account Assets:Cash +account Expenses:Phone +account Expenses:Rent +account Expenses:Food +commodity EUR +commodity GBP +payee Phone +tag food + +2012-03-20 Phone + Expenses:Phone 20.00 GBP + Assets:Cash + +2012-03-21 Rent + Expenses:Rent 550.00 GBP + Assets:Cash + +2012-03-22 Food + ; :food: + Expenses:Food 20.00 EUR + Assets:Cash + +test bal --explicit --strict --check-payees + -20.00 EUR + -570.00 GBP Assets:Cash + 20.00 EUR + 570.00 GBP Expenses + 20.00 EUR Food + 20.00 GBP Phone + 550.00 GBP Rent +-------------------- + 0 +__ERROR__ +Warning: "$FILE", line 14: Unknown payee 'Rent' +Warning: "$FILE", line 18: Unknown payee 'Food' +end test + diff --git a/test/baseline/opt-count.test b/test/baseline/opt-count.test index e69de29b..9c5495c8 100644 --- a/test/baseline/opt-count.test +++ b/test/baseline/opt-count.test @@ -0,0 +1,43 @@ +2012-02-28 Phone expense + Expenses:Phone 20.00 GBP + Assets:Cash -20.00 GBP + +2012-02-29 * Rent expense + Expenses:Rent 530.00 GBP + Assets:Cash -530.00 GBP + +2012-03-03 Phone expense + Expenses:Phone 12.00 EUR + Assets:Cash -12.00 EUR + +2012-03-04 * Bed and breakfast + ; Payee: Rent expense + ; :bnb: + Expenses:Rent 30.00 EUR + Assets:Cash -30.00 EUR + +test accounts --count +2 Expenses:Phone +4 Assets:Cash +2 Expenses:Rent +end test + +test commodities --count +4 GBP +4 EUR +end test + +test payees --count +4 Phone expense +4 Rent expense +end test + +test commodities :rent --count +1 GBP +1 EUR +end test + +test payees tag bnb --count +2 Rent expense +end test + diff --git a/test/baseline/opt-day-break.test b/test/baseline/opt-day-break.test new file mode 100644 index 00000000..18dde546 --- /dev/null +++ b/test/baseline/opt-day-break.test @@ -0,0 +1,12 @@ +i 05/10/2011 08:58:37 682 +o 05/12/2011 11:25:21 + +test reg --base +11-May-10 (682) 181604s 181604s +end test + +test reg --base --day-break +11-May-10 (682) 54083s 54083s +11-May-11 (682) 86400s 140483s +11-May-12 (682) 41121s 181604s +end test diff --git a/test/baseline/opt-dc.test b/test/baseline/opt-dc.test new file mode 100644 index 00000000..24a564dd --- /dev/null +++ b/test/baseline/opt-dc.test @@ -0,0 +1,16 @@ +2012-03-10 Employer + Assets:Cash $100 + Income:Employer + +2012-03-10 KFC + Expenses:Food $20 + Assets:Cash + +2012-03-10 KFC - Rebate + Assets:Cash + Expenses:Food $-5 + +2012-03-10 KFC - Food & Rebate + Expenses:Food $20 + Expenses:Food $-5 + Assets:Cash diff --git a/test/baseline/opt-decimal-comma.test b/test/baseline/opt-decimal-comma.test index e69de29b..e056c914 100644 --- a/test/baseline/opt-decimal-comma.test +++ b/test/baseline/opt-decimal-comma.test @@ -0,0 +1,22 @@ +2012-01-01 * Opening balance + Assets:Cash 100,00 EUR + Equity:Opening Balance + +2012-01-02 * Test + Expenses:Food 10,00 EUR + Assets:Cash -10,00 EUR + +2012-01-03 * Test + Expenses:Food €10,00 + Assets:Cash €-10,00 + +test --decimal-comma bal + 90,00 EUR + €-10,00 Assets:Cash + -100,00 EUR Equity:Opening Balance + 10,00 EUR + €10,00 Expenses:Food +-------------------- + 0 +end test + diff --git a/test/baseline/opt-deviation.test b/test/baseline/opt-deviation.test index df216b9c..a677ff6e 100644 --- a/test/baseline/opt-deviation.test +++ b/test/baseline/opt-deviation.test @@ -190,7 +190,7 @@ Expenses:Books $120.00 Assets:Cash -test reg --deviation books +test reg -A --deviation books 08-Jan-01 January Expenses:Books $10.00 0 08-Jan-31 End of January Expenses:Books $10.00 0 08-Feb-01 February Expenses:Books $20.00 $6.67 diff --git a/test/baseline/opt-equity.test b/test/baseline/opt-equity.test index d8695759..35ea6b1e 100644 --- a/test/baseline/opt-equity.test +++ b/test/baseline/opt-equity.test @@ -1,9 +1,58 @@ -2007/02/02 RD VMMXX - Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 - Income:Dividends:Vanguard:VMMXX $-0.35 +D 1000.00 GBP + +2011-03-04 Buy shares + Assets:Broker 2 AAA @ 0.90 GBP + Assets:Bank + +2011-03-05 Buy shares + Assets:Broker 2 AAA @ 1.00 GBP + Assets:Bank + +test equity +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Assets:Broker 4 AAA + Equity:Opening Balances -4 AAA + Equity:Opening Balances 3.80 GBP +end test test equity assets -2007/02/02 Opening Balances - Assets:Investments:Vanguard:VMMXX 0.350 VMMXX - Equity:Opening Balances -0.350 VMMXX +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Assets:Broker 4 AAA + Equity:Opening Balances -4 AAA + Equity:Opening Balances 3.80 GBP end test + +test equity assets:bank +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Equity:Opening Balances +end test + +test equity assets:broker +2011/03/05 Opening Balances + Assets:Broker 4 AAA + Equity:Opening Balances +end test + +test equity --lot-prices +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Assets:Broker 2 AAA {0.90 GBP} + Assets:Broker 2 AAA {1.00 GBP} + Equity:Opening Balances -2 AAA {0.90 GBP} + Equity:Opening Balances -2 AAA {1.00 GBP} + Equity:Opening Balances 3.80 GBP +end test + +test equity --lots +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Assets:Broker 2 AAA {0.90 GBP} [2011/03/04] + Assets:Broker 2 AAA {1.00 GBP} [2011/03/05] + Equity:Opening Balances -2 AAA {0.90 GBP} [2011/03/04] + Equity:Opening Balances -2 AAA {1.00 GBP} [2011/03/05] + Equity:Opening Balances 3.80 GBP +end test + diff --git a/test/baseline/opt-exchange.test b/test/baseline/opt-exchange.test index cfc48c3f..f5d73f78 100644 --- a/test/baseline/opt-exchange.test +++ b/test/baseline/opt-exchange.test @@ -53,6 +53,63 @@ test reg --exchange=' C, A ' Assets:Brokerage -75 A 75 A 09-Jan-01 January 1st, 2009 (3) Assets:Brokerage 100 A 175 A Assets:Brokerage -100 A 75 A +09-Jan-02 Commodities revalued <Revalued> 225 A + -1800 C 300 A + -1800 C +09-Jan-02 January 2nd, 2009 Assets:Brokerage 500 C 300 A + -1300 C + Assets:Brokerage -500 C 300 A + -1800 C +09-Jan-03 January 3rd, 2009 Assets:Brokerage 600 C 300 A + -1200 C + Assets:Brokerage -600 C 300 A + -1800 C +09-Jan-04 January 4th, 2009 Assets:Brokerage 300 A 600 A + -1800 C + Assets:Brokerage -2400 C 600 A + -4200 C +09-Jan-05 January 5th, 2009 Assets:Brokerage 1280 C 600 A + -2920 C + Assets:Brokerage -1280 C 600 A + -4200 C +09-Jan-06 Commodities revalued <Revalued> 2040 C 600 A + -2160 C +09-Jan-06 January 6th, 2009 Assets:Brokerage 155 A 755 A + -2160 C + Assets:Brokerage -186 C 755 A + -2346 C +09-Jan-07 Commodities revalued <Revalued> -86 C 755 A + -2432 C +09-Jan-07 January 7th, 2009 Assets:Brokerage 155 A 910 A + -2432 C + Assets:Brokerage -200 C 910 A + -2632 C +09-Jan-08 Commodities revalued <Revalued> -5613 C 910 A + -8245 C +09-Jan-08 January 8th, 2009 Assets:Brokerage 155 A 1065 A + -8245 C + Assets:Brokerage -200 C 1065 A + -8445 C +09-Jan-09 Commodities revalued <Revalued> -2800 C 1065 A + -11245 C +09-Jan-09 January 9th, 2009 Assets:Brokerage 200 C 1065 A + -11045 C + Assets:Brokerage -155 A 910 A + -11045 C +09-Jan-10 January 10th, 2009 Assets:Brokerage 200 C 910 A + -10845 C + Assets:Brokerage -155 A 755 A + -10845 C +end test + + +test reg --exchange=' C!, A ' +09-Jan-01 January 1st, 2009 (1) Assets:Brokerage 100 A 100 A + Assets:Brokerage -50 A 50 A +09-Jan-01 January 1st, 2009 (2) Assets:Brokerage 100 A 150 A + Assets:Brokerage -75 A 75 A +09-Jan-01 January 1st, 2009 (3) Assets:Brokerage 100 A 175 A + Assets:Brokerage -100 A 75 A 09-Jan-02 Commodities revalued <Revalued> 0 600 C 09-Jan-02 January 2nd, 2009 Assets:Brokerage 500 C 1100 C Assets:Brokerage -500 C 600 C diff --git a/test/baseline/opt-explicit.test b/test/baseline/opt-explicit.test new file mode 100644 index 00000000..defae179 --- /dev/null +++ b/test/baseline/opt-explicit.test @@ -0,0 +1,34 @@ +account Assets:Cash +account Expenses:Phone +account Expenses:Rent +commodity GBP + +2012-03-20 Phone + Expenses:Phone 20.00 GBP + Assets:Cash + +2012-03-21 Rent + Expenses:Rent 550.00 GBP + Assets:Cash + +2012-03-22 Food + ; :food: + Expenses:Food 20.00 EUR + Assets:Cash + +test bal --explicit --strict + -20.00 EUR + -570.00 GBP Assets:Cash + 20.00 EUR + 570.00 GBP Expenses + 20.00 EUR Food + 20.00 GBP Phone + 550.00 GBP Rent +-------------------- + 0 +__ERROR__ +Warning: "$FILE", line 16: Unknown account 'Expenses:Food' +Warning: "$FILE", line 16: Unknown commodity 'EUR' +Warning: "$FILE", line 17: Unknown metadata tag 'food' +end test + diff --git a/test/baseline/opt-file.test b/test/baseline/opt-file.test new file mode 100644 index 00000000..e01d929d --- /dev/null +++ b/test/baseline/opt-file.test @@ -0,0 +1,12 @@ +test -f opt-file-does-not-exist.dat bal -> 1 +__ERROR__ +Error: Cannot read journal file "opt-file-does-not-exist.dat" +end test + +test -f test/baseline/opt-file1.dat -f test/baseline/opt-file2.dat bal + 10 A + -10 C +-------------------- + 0 +end test + diff --git a/test/baseline/opt-file1.dat b/test/baseline/opt-file1.dat new file mode 100644 index 00000000..394882cd --- /dev/null +++ b/test/baseline/opt-file1.dat @@ -0,0 +1,4 @@ +2012-03-22 * Test 1 + A 10.00 + B + diff --git a/test/baseline/opt-file2.dat b/test/baseline/opt-file2.dat new file mode 100644 index 00000000..569993f8 --- /dev/null +++ b/test/baseline/opt-file2.dat @@ -0,0 +1,4 @@ +2012-03-22 * Test 2 + B 10.00 + C + diff --git a/test/baseline/opt-forecast-years.test b/test/baseline/opt-forecast-years.test index e69de29b..6b1053f5 100644 --- a/test/baseline/opt-forecast-years.test +++ b/test/baseline/opt-forecast-years.test @@ -0,0 +1,202 @@ +~ Monthly + Expenses:Rent 500.00 GBP + Assets + +test --now 2012-01-01 --forecast "T<200000.00 GBP" reg :rent +12-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 500.00 GBP +12-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 1000.00 GBP +12-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 1500.00 GBP +12-May-01 Forecast transaction Expenses:Rent 500.00 GBP 2000.00 GBP +12-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 2500.00 GBP +12-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 3000.00 GBP +12-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 3500.00 GBP +12-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 4000.00 GBP +12-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 4500.00 GBP +12-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 5000.00 GBP +12-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 5500.00 GBP +13-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 6000.00 GBP +13-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 6500.00 GBP +13-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 7000.00 GBP +13-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 7500.00 GBP +13-May-01 Forecast transaction Expenses:Rent 500.00 GBP 8000.00 GBP +13-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 8500.00 GBP +13-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 9000.00 GBP +13-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 9500.00 GBP +13-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 10000.00 GBP +13-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 10500.00 GBP +13-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 11000.00 GBP +13-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 11500.00 GBP +14-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 12000.00 GBP +14-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 12500.00 GBP +14-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 13000.00 GBP +14-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 13500.00 GBP +14-May-01 Forecast transaction Expenses:Rent 500.00 GBP 14000.00 GBP +14-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 14500.00 GBP +14-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 15000.00 GBP +14-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 15500.00 GBP +14-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 16000.00 GBP +14-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 16500.00 GBP +14-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 17000.00 GBP +14-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 17500.00 GBP +15-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 18000.00 GBP +15-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 18500.00 GBP +15-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 19000.00 GBP +15-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 19500.00 GBP +15-May-01 Forecast transaction Expenses:Rent 500.00 GBP 20000.00 GBP +15-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 20500.00 GBP +15-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 21000.00 GBP +15-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 21500.00 GBP +15-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 22000.00 GBP +15-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 22500.00 GBP +15-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 23000.00 GBP +15-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 23500.00 GBP +16-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 24000.00 GBP +16-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 24500.00 GBP +16-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 25000.00 GBP +16-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 25500.00 GBP +16-May-01 Forecast transaction Expenses:Rent 500.00 GBP 26000.00 GBP +16-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 26500.00 GBP +16-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 27000.00 GBP +16-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 27500.00 GBP +16-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 28000.00 GBP +16-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 28500.00 GBP +16-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 29000.00 GBP +16-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 29500.00 GBP +end test + +test --now 2012-01-01 --forecast-years 1 --forecast "T<200000.00 GBP" reg :rent +12-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 500.00 GBP +12-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 1000.00 GBP +12-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 1500.00 GBP +12-May-01 Forecast transaction Expenses:Rent 500.00 GBP 2000.00 GBP +12-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 2500.00 GBP +12-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 3000.00 GBP +12-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 3500.00 GBP +12-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 4000.00 GBP +12-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 4500.00 GBP +12-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 5000.00 GBP +12-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 5500.00 GBP +end test + +test --now 2012-01-01 --forecast-years 10 --forecast "T<200000.00 GBP" reg :rent +12-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 500.00 GBP +12-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 1000.00 GBP +12-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 1500.00 GBP +12-May-01 Forecast transaction Expenses:Rent 500.00 GBP 2000.00 GBP +12-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 2500.00 GBP +12-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 3000.00 GBP +12-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 3500.00 GBP +12-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 4000.00 GBP +12-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 4500.00 GBP +12-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 5000.00 GBP +12-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 5500.00 GBP +13-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 6000.00 GBP +13-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 6500.00 GBP +13-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 7000.00 GBP +13-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 7500.00 GBP +13-May-01 Forecast transaction Expenses:Rent 500.00 GBP 8000.00 GBP +13-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 8500.00 GBP +13-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 9000.00 GBP +13-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 9500.00 GBP +13-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 10000.00 GBP +13-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 10500.00 GBP +13-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 11000.00 GBP +13-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 11500.00 GBP +14-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 12000.00 GBP +14-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 12500.00 GBP +14-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 13000.00 GBP +14-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 13500.00 GBP +14-May-01 Forecast transaction Expenses:Rent 500.00 GBP 14000.00 GBP +14-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 14500.00 GBP +14-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 15000.00 GBP +14-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 15500.00 GBP +14-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 16000.00 GBP +14-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 16500.00 GBP +14-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 17000.00 GBP +14-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 17500.00 GBP +15-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 18000.00 GBP +15-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 18500.00 GBP +15-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 19000.00 GBP +15-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 19500.00 GBP +15-May-01 Forecast transaction Expenses:Rent 500.00 GBP 20000.00 GBP +15-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 20500.00 GBP +15-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 21000.00 GBP +15-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 21500.00 GBP +15-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 22000.00 GBP +15-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 22500.00 GBP +15-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 23000.00 GBP +15-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 23500.00 GBP +16-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 24000.00 GBP +16-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 24500.00 GBP +16-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 25000.00 GBP +16-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 25500.00 GBP +16-May-01 Forecast transaction Expenses:Rent 500.00 GBP 26000.00 GBP +16-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 26500.00 GBP +16-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 27000.00 GBP +16-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 27500.00 GBP +16-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 28000.00 GBP +16-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 28500.00 GBP +16-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 29000.00 GBP +16-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 29500.00 GBP +17-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 30000.00 GBP +17-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 30500.00 GBP +17-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 31000.00 GBP +17-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 31500.00 GBP +17-May-01 Forecast transaction Expenses:Rent 500.00 GBP 32000.00 GBP +17-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 32500.00 GBP +17-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 33000.00 GBP +17-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 33500.00 GBP +17-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 34000.00 GBP +17-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 34500.00 GBP +17-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 35000.00 GBP +17-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 35500.00 GBP +18-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 36000.00 GBP +18-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 36500.00 GBP +18-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 37000.00 GBP +18-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 37500.00 GBP +18-May-01 Forecast transaction Expenses:Rent 500.00 GBP 38000.00 GBP +18-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 38500.00 GBP +18-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 39000.00 GBP +18-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 39500.00 GBP +18-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 40000.00 GBP +18-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 40500.00 GBP +18-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 41000.00 GBP +18-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 41500.00 GBP +19-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 42000.00 GBP +19-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 42500.00 GBP +19-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 43000.00 GBP +19-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 43500.00 GBP +19-May-01 Forecast transaction Expenses:Rent 500.00 GBP 44000.00 GBP +19-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 44500.00 GBP +19-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 45000.00 GBP +19-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 45500.00 GBP +19-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 46000.00 GBP +19-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 46500.00 GBP +19-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 47000.00 GBP +19-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 47500.00 GBP +20-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 48000.00 GBP +20-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 48500.00 GBP +20-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 49000.00 GBP +20-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 49500.00 GBP +20-May-01 Forecast transaction Expenses:Rent 500.00 GBP 50000.00 GBP +20-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 50500.00 GBP +20-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 51000.00 GBP +20-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 51500.00 GBP +20-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 52000.00 GBP +20-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 52500.00 GBP +20-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 53000.00 GBP +20-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 53500.00 GBP +21-Jan-01 Forecast transaction Expenses:Rent 500.00 GBP 54000.00 GBP +21-Feb-01 Forecast transaction Expenses:Rent 500.00 GBP 54500.00 GBP +21-Mar-01 Forecast transaction Expenses:Rent 500.00 GBP 55000.00 GBP +21-Apr-01 Forecast transaction Expenses:Rent 500.00 GBP 55500.00 GBP +21-May-01 Forecast transaction Expenses:Rent 500.00 GBP 56000.00 GBP +21-Jun-01 Forecast transaction Expenses:Rent 500.00 GBP 56500.00 GBP +21-Jul-01 Forecast transaction Expenses:Rent 500.00 GBP 57000.00 GBP +21-Aug-01 Forecast transaction Expenses:Rent 500.00 GBP 57500.00 GBP +21-Sep-01 Forecast transaction Expenses:Rent 500.00 GBP 58000.00 GBP +21-Oct-01 Forecast transaction Expenses:Rent 500.00 GBP 58500.00 GBP +21-Nov-01 Forecast transaction Expenses:Rent 500.00 GBP 59000.00 GBP +21-Dec-01 Forecast transaction Expenses:Rent 500.00 GBP 59500.00 GBP +end test + diff --git a/test/baseline/opt-group-by.test b/test/baseline/opt-group-by.test index e69de29b..1f6c6adf 100644 --- a/test/baseline/opt-group-by.test +++ b/test/baseline/opt-group-by.test @@ -0,0 +1,114 @@ +2012-03-20 * Test GBP + A -10.00 GBP + B + +2012-03-20 * Test EUR + A -10.00 EUR + B + +2012-03-22 * Test GBP + A -10.00 GBP + B + +2012-03-22 * Test EUR + A -10.00 EUR + B + +2012-03-25 * Test GBP + A -10.00 GBP + B + +2012-03-25 * Test EUR + A -10.00 EUR + B + +test reg --group-by payee +Test EUR +12-Mar-20 Test EUR A -10.00 EUR -10.00 EUR + B 10.00 EUR 0 +12-Mar-22 Test EUR A -10.00 EUR -10.00 EUR + B 10.00 EUR 0 +12-Mar-25 Test EUR A -10.00 EUR -10.00 EUR + B 10.00 EUR 0 + +Test GBP +12-Mar-20 Test GBP A -10.00 GBP -10.00 GBP + B 10.00 GBP 0 +12-Mar-22 Test GBP A -10.00 GBP -10.00 GBP + B 10.00 GBP 0 +12-Mar-25 Test GBP A -10.00 GBP -10.00 GBP + B 10.00 GBP 0 +end test + +test reg --group-by commodity +EUR +12-Mar-20 Test EUR A -10.00 EUR -10.00 EUR + B 10.00 EUR 0 +12-Mar-22 Test EUR A -10.00 EUR -10.00 EUR + B 10.00 EUR 0 +12-Mar-25 Test EUR A -10.00 EUR -10.00 EUR + B 10.00 EUR 0 + +GBP +12-Mar-20 Test GBP A -10.00 GBP -10.00 GBP + B 10.00 GBP 0 +12-Mar-22 Test GBP A -10.00 GBP -10.00 GBP + B 10.00 GBP 0 +12-Mar-25 Test GBP A -10.00 GBP -10.00 GBP + B 10.00 GBP 0 +end test + +test bal --group-by commodity +EUR + -30.00 EUR A + 30.00 EUR B +-------------------- + 0 + +GBP + -30.00 GBP A + 30.00 GBP B +-------------------- + 0 +end test + +test bal --group-by payee +Test EUR + -30.00 EUR A + 30.00 EUR B +-------------------- + 0 + +Test GBP + -30.00 GBP A + 30.00 GBP B +-------------------- + 0 +end test + +test bal --group-by date +2012/03/20 + -10.00 EUR + -10.00 GBP A + 10.00 EUR + 10.00 GBP B +-------------------- + 0 + +2012/03/22 + -10.00 EUR + -10.00 GBP A + 10.00 EUR + 10.00 GBP B +-------------------- + 0 + +2012/03/25 + -10.00 EUR + -10.00 GBP A + 10.00 EUR + 10.00 GBP B +-------------------- + 0 +end test + diff --git a/test/baseline/opt-group-title-format.test b/test/baseline/opt-group-title-format.test index e69de29b..a2a1a984 100644 --- a/test/baseline/opt-group-title-format.test +++ b/test/baseline/opt-group-title-format.test @@ -0,0 +1,48 @@ +2012-03-20 * Test GBP + A -10.00 GBP + B + +2012-03-20 * Test EUR + A -10.00 EUR + B + +2012-03-22 * Test GBP + A -10.00 GBP + B + +2012-03-22 * Test EUR + A -10.00 EUR + B + +test bal --group-by payee --group-title-format "-%(value)-\n" +-Test EUR- + -20.00 EUR A + 20.00 EUR B +-------------------- + 0 + +-Test GBP- + -20.00 GBP A + 20.00 GBP B +-------------------- + 0 +end test + +test bal --group-by date --group-title-format "|%(value)|\n" +|2012/03/20| + -10.00 EUR + -10.00 GBP A + 10.00 EUR + 10.00 GBP B +-------------------- + 0 + +|2012/03/22| + -10.00 EUR + -10.00 GBP A + 10.00 EUR + 10.00 GBP B +-------------------- + 0 +end test + diff --git a/test/baseline/opt-historical.test b/test/baseline/opt-historical.test new file mode 100644 index 00000000..9eb3558b --- /dev/null +++ b/test/baseline/opt-historical.test @@ -0,0 +1,250 @@ +D EUR 2.000,00 + +P 2011-12-15 $ EUR 2 +P 2011-12-15 AAPL $5.00 + +2012-01-01 Broker + Assets:Stocks 10 AAPL {$1} @ $10 + Equity + +P 2012-01-15 AAPL $15.00 + +2012-02-02 Broker + Assets:Stocks 10 AAPL {$2} @ $20 + Equity + +P 2012-02-15 AAPL $25.00 + +2012-03-03 Broker + Assets:Stocks 10 AAPL {$3} @ $30 + Equity + +P 2012-03-15 AAPL $35.00 + +2012-04-04 Broker + Assets:Stocks 10 AAPL {$4} @ $40 + Equity + +P 2012-04-15 AAPL $45.00 + +2012-05-05 Broker + Assets:Stocks 10 AAPL {$5} @ $50 + Equity + +P 2012-5-15 AAPL $55.00 + +test reg stocks +12-Jan-01 Broker Assets:Stocks 10 AAPL 10 AAPL +12-Feb-02 Broker Assets:Stocks 10 AAPL 20 AAPL +12-Mar-03 Broker Assets:Stocks 10 AAPL 30 AAPL +12-Apr-04 Broker Assets:Stocks 10 AAPL 40 AAPL +12-May-05 Broker Assets:Stocks 10 AAPL 50 AAPL +end test + +test reg stocks -O +12-Jan-01 Broker Assets:Stocks 10 AAPL 10 AAPL +12-Feb-02 Broker Assets:Stocks 10 AAPL 20 AAPL +12-Mar-03 Broker Assets:Stocks 10 AAPL 30 AAPL +12-Apr-04 Broker Assets:Stocks 10 AAPL 40 AAPL +12-May-05 Broker Assets:Stocks 10 AAPL 50 AAPL +end test + +test reg stocks -B +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Feb-02 Broker Assets:Stocks $200 $300 +12-Mar-03 Broker Assets:Stocks $300 $600 +12-Apr-04 Broker Assets:Stocks $400 $1000 +12-May-05 Broker Assets:Stocks $500 $1500 +end test + +test reg stocks -I +12-Jan-01 Broker Assets:Stocks $10 $10 +12-Feb-02 Broker Assets:Stocks $20 $30 +12-Mar-03 Broker Assets:Stocks $30 $60 +12-Apr-04 Broker Assets:Stocks $40 $100 +12-May-05 Broker Assets:Stocks $50 $150 +end test + +test reg stocks -V +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Jan-15 Commodities revalued <Revalued> $50 $150 +12-Feb-02 Commodities revalued <Revalued> $50 $200 +12-Feb-02 Broker Assets:Stocks $200 $400 +12-Feb-15 Commodities revalued <Revalued> $100 $500 +12-Mar-03 Commodities revalued <Revalued> $100 $600 +12-Mar-03 Broker Assets:Stocks $300 $900 +12-Mar-15 Commodities revalued <Revalued> $150 $1050 +12-Apr-04 Commodities revalued <Revalued> $150 $1200 +12-Apr-04 Broker Assets:Stocks $400 $1600 +12-Apr-15 Commodities revalued <Revalued> $200 $1800 +12-May-05 Commodities revalued <Revalued> $200 $2000 +12-May-05 Broker Assets:Stocks $500 $2500 +end test + +test reg stocks -O -V +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Jan-15 Commodities revalued <Revalued> $50 $150 +12-Feb-02 Commodities revalued <Revalued> $50 $200 +12-Feb-02 Broker Assets:Stocks $200 $400 +12-Feb-15 Commodities revalued <Revalued> $100 $500 +12-Mar-03 Commodities revalued <Revalued> $100 $600 +12-Mar-03 Broker Assets:Stocks $300 $900 +12-Mar-15 Commodities revalued <Revalued> $150 $1050 +12-Apr-04 Commodities revalued <Revalued> $150 $1200 +12-Apr-04 Broker Assets:Stocks $400 $1600 +12-Apr-15 Commodities revalued <Revalued> $200 $1800 +12-May-05 Commodities revalued <Revalued> $200 $2000 +12-May-05 Broker Assets:Stocks $500 $2500 +end test + +test reg stocks -B -V +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Feb-02 Broker Assets:Stocks $200 $300 +12-Mar-03 Broker Assets:Stocks $300 $600 +12-Apr-04 Broker Assets:Stocks $400 $1000 +12-May-05 Broker Assets:Stocks $500 $1500 +end test + +test reg stocks -I -V +12-Jan-01 Broker Assets:Stocks $10 $10 +12-Feb-02 Broker Assets:Stocks $20 $30 +12-Mar-03 Broker Assets:Stocks $30 $60 +12-Apr-04 Broker Assets:Stocks $40 $100 +12-May-05 Broker Assets:Stocks $50 $150 +end test + +test reg stocks -X EUR +12-Jan-01 Broker Assets:Stocks EUR 200,00 EUR 200,00 +12-Feb-02 Commodities revalued <Revalued> EUR 200,00 EUR 400,00 +12-Feb-02 Broker Assets:Stocks EUR 400,00 EUR 800,00 +12-Mar-03 Commodities revalued <Revalued> EUR 400,00 EUR 1.200,00 +12-Mar-03 Broker Assets:Stocks EUR 600,00 EUR 1.800,00 +12-Apr-04 Commodities revalued <Revalued> EUR 600,00 EUR 2.400,00 +12-Apr-04 Broker Assets:Stocks EUR 800,00 EUR 3.200,00 +12-May-05 Commodities revalued <Revalued> EUR 800,00 EUR 4.000,00 +12-May-05 Broker Assets:Stocks EUR 1.000,00 EUR 5.000,00 +end test + +test reg stocks -O -X EUR +12-Jan-01 Broker Assets:Stocks EUR 200,00 EUR 200,00 +12-Feb-02 Commodities revalued <Revalued> EUR 200,00 EUR 400,00 +12-Feb-02 Broker Assets:Stocks EUR 400,00 EUR 800,00 +12-Mar-03 Commodities revalued <Revalued> EUR 400,00 EUR 1.200,00 +12-Mar-03 Broker Assets:Stocks EUR 600,00 EUR 1.800,00 +12-Apr-04 Commodities revalued <Revalued> EUR 600,00 EUR 2.400,00 +12-Apr-04 Broker Assets:Stocks EUR 800,00 EUR 3.200,00 +12-May-05 Commodities revalued <Revalued> EUR 800,00 EUR 4.000,00 +12-May-05 Broker Assets:Stocks EUR 1.000,00 EUR 5.000,00 +end test + +test reg stocks -B -X EUR +12-Jan-01 Broker Assets:Stocks EUR 200,00 EUR 200,00 +12-Feb-02 Broker Assets:Stocks EUR 400,00 EUR 600,00 +12-Mar-03 Broker Assets:Stocks EUR 600,00 EUR 1.200,00 +12-Apr-04 Broker Assets:Stocks EUR 800,00 EUR 2.000,00 +12-May-05 Broker Assets:Stocks EUR 1.000,00 EUR 3.000,00 +end test + +test reg stocks -I -X EUR +12-Jan-01 Broker Assets:Stocks EUR 20,00 EUR 20,00 +12-Feb-02 Broker Assets:Stocks EUR 40,00 EUR 60,00 +12-Mar-03 Broker Assets:Stocks EUR 60,00 EUR 120,00 +12-Apr-04 Broker Assets:Stocks EUR 80,00 EUR 200,00 +12-May-05 Broker Assets:Stocks EUR 100,00 EUR 300,00 +end test + +test reg stocks -H +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Feb-02 Broker Assets:Stocks $200 $300 +12-Mar-03 Broker Assets:Stocks $300 $600 +12-Apr-04 Broker Assets:Stocks $400 $1000 +12-May-05 Broker Assets:Stocks $500 $1500 +end test + +test reg stocks -O -H +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Feb-02 Broker Assets:Stocks $200 $300 +12-Mar-03 Broker Assets:Stocks $300 $600 +12-Apr-04 Broker Assets:Stocks $400 $1000 +12-May-05 Broker Assets:Stocks $500 $1500 +end test + +test reg stocks -B -H +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Feb-02 Broker Assets:Stocks $200 $300 +12-Mar-03 Broker Assets:Stocks $300 $600 +12-Apr-04 Broker Assets:Stocks $400 $1000 +12-May-05 Broker Assets:Stocks $500 $1500 +end test + +test reg stocks -I -H +12-Jan-01 Broker Assets:Stocks $10 $10 +12-Feb-02 Broker Assets:Stocks $20 $30 +12-Mar-03 Broker Assets:Stocks $30 $60 +12-Apr-04 Broker Assets:Stocks $40 $100 +12-May-05 Broker Assets:Stocks $50 $150 +end test + +test reg stocks -H -V +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Feb-02 Broker Assets:Stocks $200 $300 +12-Mar-03 Broker Assets:Stocks $300 $600 +12-Apr-04 Broker Assets:Stocks $400 $1000 +12-May-05 Broker Assets:Stocks $500 $1500 +end test + +test reg stocks -O -H -V +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Feb-02 Broker Assets:Stocks $200 $300 +12-Mar-03 Broker Assets:Stocks $300 $600 +12-Apr-04 Broker Assets:Stocks $400 $1000 +12-May-05 Broker Assets:Stocks $500 $1500 +end test + +test reg stocks -B -H -V +12-Jan-01 Broker Assets:Stocks $100 $100 +12-Feb-02 Broker Assets:Stocks $200 $300 +12-Mar-03 Broker Assets:Stocks $300 $600 +12-Apr-04 Broker Assets:Stocks $400 $1000 +12-May-05 Broker Assets:Stocks $500 $1500 +end test + +test reg stocks -I -H -V +12-Jan-01 Broker Assets:Stocks $10 $10 +12-Feb-02 Broker Assets:Stocks $20 $30 +12-Mar-03 Broker Assets:Stocks $30 $60 +12-Apr-04 Broker Assets:Stocks $40 $100 +12-May-05 Broker Assets:Stocks $50 $150 +end test + +test reg stocks -H -X EUR +12-Jan-01 Broker Assets:Stocks EUR 200,00 EUR 200,00 +12-Feb-02 Broker Assets:Stocks EUR 400,00 EUR 600,00 +12-Mar-03 Broker Assets:Stocks EUR 600,00 EUR 1.200,00 +12-Apr-04 Broker Assets:Stocks EUR 800,00 EUR 2.000,00 +12-May-05 Broker Assets:Stocks EUR 1.000,00 EUR 3.000,00 +end test + +test reg stocks -O -H -X EUR +12-Jan-01 Broker Assets:Stocks EUR 200,00 EUR 200,00 +12-Feb-02 Broker Assets:Stocks EUR 400,00 EUR 600,00 +12-Mar-03 Broker Assets:Stocks EUR 600,00 EUR 1.200,00 +12-Apr-04 Broker Assets:Stocks EUR 800,00 EUR 2.000,00 +12-May-05 Broker Assets:Stocks EUR 1.000,00 EUR 3.000,00 +end test + +test reg stocks -B -H -X EUR +12-Jan-01 Broker Assets:Stocks EUR 200,00 EUR 200,00 +12-Feb-02 Broker Assets:Stocks EUR 400,00 EUR 600,00 +12-Mar-03 Broker Assets:Stocks EUR 600,00 EUR 1.200,00 +12-Apr-04 Broker Assets:Stocks EUR 800,00 EUR 2.000,00 +12-May-05 Broker Assets:Stocks EUR 1.000,00 EUR 3.000,00 +end test + +test reg stocks -I -H -X EUR +12-Jan-01 Broker Assets:Stocks EUR 20,00 EUR 20,00 +12-Feb-02 Broker Assets:Stocks EUR 40,00 EUR 60,00 +12-Mar-03 Broker Assets:Stocks EUR 60,00 EUR 120,00 +12-Apr-04 Broker Assets:Stocks EUR 80,00 EUR 200,00 +12-May-05 Broker Assets:Stocks EUR 100,00 EUR 300,00 +end test diff --git a/test/baseline/opt-actual-dates.test b/test/baseline/opt-immediate.test index e69de29b..e69de29b 100644 --- a/test/baseline/opt-actual-dates.test +++ b/test/baseline/opt-immediate.test diff --git a/test/baseline/opt-inject.test b/test/baseline/opt-inject.test index e69de29b..685cf12c 100644 --- a/test/baseline/opt-inject.test +++ b/test/baseline/opt-inject.test @@ -0,0 +1,10 @@ +2012-03-20 * Test GBP + ; Expected:: -15.00 GBP + Expenses:Phone 20.00 GBP + Assets:Cash + +test --inject Expected reg Expenses:Phone +12-Mar-20 Test GBP Expected -15.00 GBP -15.00 GBP +12-Mar-20 Test GBP Expenses:Phone 20.00 GBP 5.00 GBP +end test + diff --git a/test/baseline/opt-lot-notes.test b/test/baseline/opt-lot-notes.test new file mode 100644 index 00000000..3bfa9e45 --- /dev/null +++ b/test/baseline/opt-lot-notes.test @@ -0,0 +1,31 @@ +2012-01-01 * Opening balance + Assets:Cash 100.00 GBP + Equity:Opening Balance + +2012-01-02 * Voucher 1 + Assets:Voucher 10.00 GBP (aaaa) + Assets:Cash -10.00 GBP + +2012-01-03 * Voucher 1 + Assets:Voucher 10.00 GBP (bbbb) + Assets:Cash -10.00 GBP + +2012-01-04 * Voucher 1 + Assets:Voucher 10.00 GBP (cccc) + Assets:Cash -10.00 GBP + +test bal assets:voucher --lot-notes + 10.00 GBP (aaaa) + 10.00 GBP (bbbb) + 10.00 GBP (cccc) Assets:Voucher +end test + +test reg assets:voucher --lot-notes +12-Jan-02 Voucher 1 Assets:Voucher 10.00 GBP (aaaa) 10.00 GBP (aaaa) +12-Jan-03 Voucher 1 Assets:Voucher 10.00 GBP (bbbb) 10.00 GBP (aaaa) + 10.00 GBP (bbbb) +12-Jan-04 Voucher 1 Assets:Voucher 10.00 GBP (cccc) 10.00 GBP (aaaa) + 10.00 GBP (bbbb) + 10.00 GBP (cccc) +end test + diff --git a/test/baseline/opt-meta-width.test b/test/baseline/opt-meta-width.test index ce751e24..893e175b 100644 --- a/test/baseline/opt-meta-width.test +++ b/test/baseline/opt-meta-width.test @@ -9,6 +9,6 @@ ; :AnotherTag: test reg --meta Sample --meta-width=15 -Another Value 04-May-27 Credit card com.. Liab:MasterCard $20.00 $20.00 -Value As:Ban:Checking $-20.00 0 +Another Value 04-May-27 Credit card co.. Liabi:MasterCard $20.00 $20.00 +Value As:Bank:Checking $-20.00 0 end test diff --git a/test/baseline/opt-no-pager.test b/test/baseline/opt-no-pager.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-no-pager.test diff --git a/test/baseline/opt-payee-as-account.test b/test/baseline/opt-payee-as-account.test index 113a395b..0d1f87d6 100644 --- a/test/baseline/opt-payee-as-account.test +++ b/test/baseline/opt-payee-as-account.test @@ -21,11 +21,11 @@ test reg --account=payee 08-Jan-01 January January:Expenses:Books $10.00 $10.00 08-Jan-01 January January:Assets:Cash $-10.00 0 -08-Jan-31 End of January End of :Expenses:Books $10.00 $10.00 +08-Jan-31 End of January End of:Expenses:Books $10.00 $10.00 08-Jan-31 End of January End of Jan:Assets:Cash $-10.00 0 08-Feb-01 February Februar:Expenses:Books $20.00 $20.00 08-Feb-01 February February:Assets:Cash $-20.00 0 -08-Feb-28 End of February End of :Expenses:Books $20.00 $20.00 +08-Feb-28 End of February End of:Expenses:Books $20.00 $20.00 08-Feb-28 End of February End of Feb:Assets:Cash $-20.00 0 08-Mar-01 March March:Expenses:Books $30.00 $30.00 08-Mar-01 March March:Assets:Cash $-30.00 0 diff --git a/test/baseline/opt-pedantic.test b/test/baseline/opt-pedantic.test new file mode 100644 index 00000000..fbb27b84 --- /dev/null +++ b/test/baseline/opt-pedantic.test @@ -0,0 +1,17 @@ +2012-03-20 Test GBP + Expenses:Phone 20.00 GBP + Assets:Cash + +2012-03-21 * Test GBP + Expenses:Phone 20.00 GBP + Assets:Cash + +test bal --pedantic -> 1 +__ERROR__ +While parsing file "$FILE", line 2: +While parsing posting: + Expenses:Phone 20.00 GBP + +Error: Unknown account 'Expenses:Phone' +end test + diff --git a/test/baseline/opt-period.test b/test/baseline/opt-period.test index 7268bcce..f370b404 100644 --- a/test/baseline/opt-period.test +++ b/test/baseline/opt-period.test @@ -257,7 +257,7 @@ test reg -p "weekly january 2008" 08-Jan-01 - 08-Jan-05 Assets:Cash $-20.00 $-20.00 Expenses:Books $10.00 $-10.00 Liabilities:Cards $10.00 0 -08-Jan-29 - 08-Jan-31 Assets:Cash $-20.00 $-20.00 +08-Jan-27 - 08-Jan-31 Assets:Cash $-20.00 $-20.00 Expenses:Books $10.00 $-10.00 Liabilities:Cards $10.00 0 end test diff --git a/test/baseline/opt-permissive.test b/test/baseline/opt-permissive.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-permissive.test diff --git a/test/baseline/opt-primary-date.test b/test/baseline/opt-primary-date.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-primary-date.test diff --git a/test/baseline/opt-rich-data.test b/test/baseline/opt-rich-data.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-rich-data.test diff --git a/test/baseline/opt-time-report.test b/test/baseline/opt-time-report.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-time-report.test diff --git a/test/baseline/opt-unround.test b/test/baseline/opt-unround.test index cef212ae..755bb62c 100644 --- a/test/baseline/opt-unround.test +++ b/test/baseline/opt-unround.test @@ -82,7 +82,7 @@ Expenses:Travel:Passport $127.00 Assets:Checking -test bal --unround --percent +test bal --percent --unround 100.00% Assets:Checking 100.00% Expenses:Travel 92.14958953% Airfare diff --git a/test/baseline/opt-value-expr.test b/test/baseline/opt-value-expr.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-value-expr.test diff --git a/test/baseline/opt-verify-memory.test b/test/baseline/opt-verify-memory.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-verify-memory.test diff --git a/test/fullcheck.sh b/test/fullcheck.sh index f3c20dd2..fc89a13c 100755 --- a/test/fullcheck.sh +++ b/test/fullcheck.sh @@ -1,18 +1,21 @@ #!/bin/sh VALGRIND='' -if [ -x /usr/bin/valgrind ]; then - VALGRIND=valgrind +if [ -x /usr/bin/valgrind -o -x /opt/local/bin/valgrind ]; then + VALGRIND="valgrind -q --track-origins=yes" + if [ `uname` = "Darwin" ]; then + VALGRIND="$VALGRIND --dsymutil=yes" + fi fi -export MallocGuardEdges=1 -export MallocScribble=1 -export MallocPreScribble=1 -export MallocCheckHeapStart=100 -export MallocCheckHeapEach=100 -export DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib -export MALLOC_PROTECT_BEFORE=1 -export MALLOC_FILL_SPACE=1 -export MALLOC_STRICT_SIZE=1 +#export MallocGuardEdges=1 +#export MallocScribble=1 +#export MallocPreScribble=1 +#export MallocCheckHeapStart=100 +#export MallocCheckHeapEach=100 +#export DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib +#export MALLOC_PROTECT_BEFORE=1 +#export MALLOC_FILL_SPACE=1 +#export MALLOC_STRICT_SIZE=1 exec $VALGRIND $@ diff --git a/test/input/sample.dat b/test/input/sample.dat index 12ac4cb4..5b411edd 100644 --- a/test/input/sample.dat +++ b/test/input/sample.dat @@ -33,7 +33,7 @@ N $ Русский язык:Активы:Русский язык:Русский язык $1000.00 Income:Salary -tag foo +apply tag foo 2004/05/27 Book Store Expenses:Books $20.00 @@ -41,7 +41,7 @@ tag foo Expenses:Docs $30.00 Liabilities:MasterCard -end tag +end apply tag 2004/05/27 (100) Credit card company ; This is an xact note! @@ -52,3 +52,5 @@ end tag ; :MyTag: Assets:Bank:Checking ; :AnotherTag: + +;;; sample.dat ends here diff --git a/test/manual/transaction-codes-1.test b/test/manual/transaction-codes-1.test index 7a05b349..ff68e0ec 100644 --- a/test/manual/transaction-codes-1.test +++ b/test/manual/transaction-codes-1.test @@ -15,6 +15,6 @@ Liabilities:Credit Card test reg --columns=60 food and code xfer -09-Oct-29 Panera Bread Expenses:Food $4.50 $4.50 -09-Oct-30 Panera Bread Expenses:Food $4.50 $9.00 +09-Oct-29 Panera Bread Expenses:Food $4.50 $4.50 +09-Oct-30 Panera Bread Expenses:Food $4.50 $9.00 end test diff --git a/test/manual/transaction-notes-1.test b/test/manual/transaction-notes-1.test index 7c3d7200..05ab3412 100644 --- a/test/manual/transaction-notes-1.test +++ b/test/manual/transaction-notes-1.test @@ -17,6 +17,6 @@ Assets:Checking test reg --columns=60 food and note eat -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 -09-Nov-01 Panera Bread Expenses:Food $4.50 $9.00 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-01 Panera Bread Expenses:Food $4.50 $9.00 end test diff --git a/test/manual/transaction-notes-2.test b/test/manual/transaction-notes-2.test index 603fcbe1..a29eda6e 100644 --- a/test/manual/transaction-notes-2.test +++ b/test/manual/transaction-notes-2.test @@ -17,5 +17,5 @@ Assets:Checking test reg --columns=60 food and tag eating -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 end test diff --git a/test/manual/transaction-notes-3.test b/test/manual/transaction-notes-3.test index 9b05334c..b83322b0 100644 --- a/test/manual/transaction-notes-3.test +++ b/test/manual/transaction-notes-3.test @@ -17,5 +17,5 @@ Assets:Checking test reg --columns=60 food and tag type=dining -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 end test diff --git a/test/manual/transaction-status-1.test b/test/manual/transaction-status-1.test index 1f7ad095..8bfdd6d9 100644 --- a/test/manual/transaction-status-1.test +++ b/test/manual/transaction-status-1.test @@ -11,7 +11,7 @@ Assets test reg --columns=60 food -09-Oct-31 Panera Bread Expenses:Food $4.50 $4.50 -09-Nov-01 Panera Bread Expenses:Food $4.50 $9.00 -09-Nov-02 Panera Bread Expenses:Food $4.50 $13.50 +09-Oct-31 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-01 Panera Bread Expenses:Food $4.50 $9.00 +09-Nov-02 Panera Bread Expenses:Food $4.50 $13.50 end test diff --git a/test/manual/transaction-status-2.test b/test/manual/transaction-status-2.test index 6c6d4b8c..94c42a65 100644 --- a/test/manual/transaction-status-2.test +++ b/test/manual/transaction-status-2.test @@ -11,5 +11,5 @@ Assets test reg --columns=60 food --cleared -09-Oct-31 Panera Bread Expenses:Food $4.50 $4.50 +09-Oct-31 Panera Bread Expenses:Food $4.50 $4.50 end test diff --git a/test/manual/transaction-status-3.test b/test/manual/transaction-status-3.test index f50ea23c..f11cd0f7 100644 --- a/test/manual/transaction-status-3.test +++ b/test/manual/transaction-status-3.test @@ -11,6 +11,6 @@ Assets test reg --columns=60 food --uncleared -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 -09-Nov-02 Panera Bread Expenses:Food $4.50 $9.00 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-02 Panera Bread Expenses:Food $4.50 $9.00 end test diff --git a/test/manual/transaction-status-4.test b/test/manual/transaction-status-4.test index 2ae03c3e..c6f0419b 100644 --- a/test/manual/transaction-status-4.test +++ b/test/manual/transaction-status-4.test @@ -11,5 +11,5 @@ Assets test reg --columns=60 food --pending -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 end test diff --git a/test/python/JournalTest.py b/test/python/JournalTest.py new file mode 100644 index 00000000..e65c671d --- /dev/null +++ b/test/python/JournalTest.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +import unittest + +from ledger import * + +class JournalTestCase(unittest.TestCase): + def tearDown(self): + session.close_journal_files() + + def testBasicRead(self): + journal = read_journal_from_string(""" +2012-03-01 KFC + Expenses:Food $21.34 + Assets:Cash +""") + self.assertEqual(type(journal), Journal) + + for xact in journal: + self.assertEqual(xact.payee, "KFC") + + for post in journal.query("food"): + self.assertEqual(str(post.account), "Expenses:Food") + self.assertEqual(post.amount, Amount("$21.34")) + +def suite(): + return unittest.TestLoader().loadTestsFromTestCase(JournalTestCase) + +if __name__ == '__main__': + unittest.main() diff --git a/test/python/PostingTest.py b/test/python/PostingTest.py new file mode 100644 index 00000000..f191253e --- /dev/null +++ b/test/python/PostingTest.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +import unittest +import exceptions +import operator + +from ledger import * +from StringIO import * +from datetime import * + +class PostingTestCase(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + pass + + def test_(self): + pass + +def suite(): + return unittest.TestLoader().loadTestsFromTestCase(PostingTestCase) + +if __name__ == '__main__': + unittest.main() diff --git a/test/python/TransactionTest.py b/test/python/TransactionTest.py new file mode 100644 index 00000000..66447f87 --- /dev/null +++ b/test/python/TransactionTest.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +import unittest +import exceptions +import operator + +from ledger import * +from StringIO import * +from datetime import * + +class JournalTestCase(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + pass + + def test_(self): + pass + +def suite(): + return unittest.TestLoader().loadTestsFromTestCase(JournalTestCase) + +if __name__ == '__main__': + unittest.main() diff --git a/test/python/UnitTests.py b/test/python/UnitTests.py new file mode 100644 index 00000000..388e2229 --- /dev/null +++ b/test/python/UnitTests.py @@ -0,0 +1,12 @@ +from unittest import TextTestRunner, TestSuite + +import JournalTest +import TransactionTest +import PostingTest + +suites = [ + JournalTest.suite(), + TransactionTest.suite(), + PostingTest.suite() +] +TextTestRunner().run(TestSuite(suites)) diff --git a/test/regress/012ADB60.test b/test/regress/012ADB60.test new file mode 100644 index 00000000..443b9e5b --- /dev/null +++ b/test/regress/012ADB60.test @@ -0,0 +1,24 @@ +2005/01/03 * Pay Credit card + Liabilities:CredCard $1,000.00 ; Electronic/ACH Debit + Assets:Current:Checking ; Electronic/ACH Debit + (Virtualaccount) $1,000.00 + +2006/01/03 Gift shop + Expenses:Gifts $46.50 + * Liabilities:CredCard + +2006/01/03 Bike shop + Expenses:Misc $199.00 + * Liabilities:CredCard + (testvirtual) $184.72 + +2006/01/04 Store + Expenses:Misc $49.95 + * Liabilities:CredCard + +test equity -e 2006 +2005/01/03 Opening Balances + Assets:Current:Checking $-1,000.00 + Liabilities:CredCard $1,000.00 + (Virtualaccount) $1,000.00 +end test diff --git a/test/regress/10D19C11.test b/test/regress/10D19C11.test new file mode 100644 index 00000000..be0469ad --- /dev/null +++ b/test/regress/10D19C11.test @@ -0,0 +1,37 @@ +; Test for: ./ledger -f doc/sample.dat -E bal liab' shows the Assets account + += /^Expenses:Books/ + (Liabilities:Taxes) -0.10 + +~ Monthly + Assets:Bank:Checking $500.00 + Income:Salary + +2004/05/01 * Checking balance + Assets:Bank:Checking $1,000.00 + Equity:Opening Balances + +2004/05/01 * Investment balance + Assets:Brokerage 50 AAPL @ $30.00 + Equity:Opening Balances + +2004/05/14 * Pay day + Assets:Bank:Checking $500.00 + Income:Salary + +2004/05/27 Book Store + Expenses:Books $20.00 + Liabilities:MasterCard + +2004/05/27 (100) Credit card company + Liabilities:MasterCard $20.00 + Assets:Bank:Checking + +test -E bal liabilities + $-2.00 Liabilities + 0 MasterCard + $-2.00 Taxes +-------------------- + $-2.00 +end test + diff --git a/test/regress/1384C1D8.test b/test/regress/1384C1D8.test new file mode 100644 index 00000000..77a07b7a --- /dev/null +++ b/test/regress/1384C1D8.test @@ -0,0 +1,27 @@ +@alias OLD1 = NEW1 + +2012-01-01 Something + OLD1 $10.00 + Other + +!alias OLD2 = NEW2 + +2012-01-01 Something + OLD2 $10.00 + Other + +account NEW3 + alias OLD3 + +2012-01-01 Something + OLD3 $10.00 + Other + +test bal + $10.00 NEW1 + $10.00 NEW2 + $10.00 NEW3 + $-30.00 Other +-------------------- + 0 +end test diff --git a/test/regress/14DB77E7.test b/test/regress/14DB77E7.test new file mode 100644 index 00000000..4d8734f9 --- /dev/null +++ b/test/regress/14DB77E7.test @@ -0,0 +1,18 @@ +D 1000.00 GBP + +;P 2011-01-01 EUR 0.8604 GBP +P 2011-02-01 EUR 0.8576 GBP + +2011-01-31 * AdSense earnings + Assets:Receivable:AdSense 11.00 EUR + Income:AdSense + +2011-02-28 * AdSense earnings + Assets:Receivable:AdSense 10.00 EUR + Income:AdSense + +test reg income:adse -X GBP -H +11-Jan-31 AdSense earnings Income:AdSense -11.00 EUR -11.00 EUR +11-Feb-28 Commodities revalued <Revalued> -9.43 GBP -9.43 GBP +11-Feb-28 AdSense earnings Income:AdSense -8.58 GBP -18.01 GBP +end test diff --git a/test/regress/15A80F68.test b/test/regress/15A80F68.test new file mode 100644 index 00000000..0b29b82d --- /dev/null +++ b/test/regress/15A80F68.test @@ -0,0 +1,15 @@ +; Test for: Confusing error message with ledger v3 with invalid input + +2008/03/03 + A (2 FOO @ 10.00 EUR) = 20.00 EUR + B + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 4: +While parsing posting: + A (2 FOO @ 10.00 EUR) = 20.00 EUR + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Error: Invalid char '@' +end test + diff --git a/test/regress/178501DC.test b/test/regress/178501DC.test new file mode 100644 index 00000000..b5319ac8 --- /dev/null +++ b/test/regress/178501DC.test @@ -0,0 +1,21 @@ +; Test for: The bal report does not honor -r (ledger bal simon +; would show all accounts, rather than just simon and the related +; account). + +2011/10/26 trader joe's + simon $-50 + alice $-50 + expenses:food:groceries + +test bal -r simon + $-50 alice + $100 expenses:food:groceries +-------------------- + $50 +end test + +test reg -r simon +11-Oct-26 trader joe's alice $-50 $-50 + expense:food:groceries $100 $50 +end test + diff --git a/test/regress/1A546C4D.test b/test/regress/1A546C4D.test new file mode 100644 index 00000000..97adc9de --- /dev/null +++ b/test/regress/1A546C4D.test @@ -0,0 +1,13 @@ +2012/02/22 * Testing invalid amount + Assets:Cash $1,00.00 + Equity:Opening Balances + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 2: +While parsing posting: + Assets:Cash $1,00.00 + ^^^^^^^^ +Error: Incorrect use of thousand-mark comma +end test + diff --git a/test/regress/1E192DF6.test b/test/regress/1E192DF6.test new file mode 100644 index 00000000..7d0f8182 --- /dev/null +++ b/test/regress/1E192DF6.test @@ -0,0 +1,57 @@ +; -*- ledger -*- +D 1000,00 PLN +N $ +N h +N PLN +N zł +C 1,00 PLN = 1,00 + +2010-05-19 * ŁUKASZ STELMACH + Assets:Checking:Konto24 GBP 200,00 GBP @ 4,8799 PLN ; fikimiki + Assets:Checking:Konto<30 -975,98 PLN + +2010-05-19 * ŁUKASZ STELMACH + Assets:Checking:Konto24 GBP 200,00 GBP @ 4,8799 PLN ; fikimiki + Assets:Checking:Konto<30 -975,98 PLN + +2010-05-19 * ŁUKASZ STELMACH + Assets:Checking:Konto<30 -975,98 PLN @ 0,204922 GBP + Assets:Checking:Konto24 GBP 200,00 GBP ; fikimiki + +2010-05-19 * ŁUKASZ STELMACH + Assets:Checking:Konto<30 -975,98 PLN @ 0,204922 GBP + Assets:Checking:Konto24 GBP 200,00 GBP ; fikimiki + +2010-05-19 * ŁUKASZ STELMACH + Assets:Checking:Konto24 GBP 200,00 GBP @ 4,8799 PLN ; fikimiki + Assets:Checking:Konto<30 -975,98 PLN + +2010-05-19 * ŁUKASZ STELMACH + Assets:Checking:Konto24 GBP 200,00 GBP @ 4,8799 PLN ; fikimiki + Assets:Checking:Konto<30 -975,98 PLN + +test reg +10-May-19 ŁUKASZ STELMACH As:Checkin:Konto24 GBP 200,00 GBP 200,00 GBP + Asse:Checking:Konto<30 -975.98 -975.98 + 200,00 GBP +10-May-19 ŁUKASZ STELMACH As:Checkin:Konto24 GBP 200,00 GBP -975.98 + 400,00 GBP + Asse:Checking:Konto<30 -975.98 -1951.96 + 400,00 GBP +10-May-19 ŁUKASZ STELMACH Asse:Checking:Konto<30 -975.98 -2927.94 + 400,00 GBP + As:Checkin:Konto24 GBP 200,00 GBP -2927.94 + 600,00 GBP +10-May-19 ŁUKASZ STELMACH Asse:Checking:Konto<30 -975.98 -3903.92 + 600,00 GBP + As:Checkin:Konto24 GBP 200,00 GBP -3903.92 + 800,00 GBP +10-May-19 ŁUKASZ STELMACH As:Checkin:Konto24 GBP 200,00 GBP -3903.92 + 1000,00 GBP + Asse:Checking:Konto<30 -975.98 -4879.9 + 1000,00 GBP +10-May-19 ŁUKASZ STELMACH As:Checkin:Konto24 GBP 200,00 GBP -4879.9 + 1200,00 GBP + Asse:Checking:Konto<30 -975.98 -5855.88 + 1200,00 GBP +end test diff --git a/test/regress/25A099C9.test b/test/regress/25A099C9.test index fc06449b..1ef5ebef 100644 --- a/test/regress/25A099C9.test +++ b/test/regress/25A099C9.test @@ -1,17 +1,43 @@ -test -f $sourcepath/src/amount.h reg -> 7 +test -f src/amount.h reg -> 20 __ERROR__ -While parsing file "$sourcepath/src/amount.h", line 66: +While parsing file "src/amount.h", line 2: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 33: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 37: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 66: Error: No quantity specified for amount -While parsing file "$sourcepath/src/amount.h", line 726: +While parsing file "src/amount.h", line 69: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 83: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 93: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 99: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 121: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 132: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 702: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 732: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 740: +Error: Unexpected whitespace at beginning of line +While parsing file "src/amount.h", line 743: Error: Invalid date/time: line amount_t amoun -While parsing file "$sourcepath/src/amount.h", line 732: +While parsing file "src/amount.h", line 749: Error: Invalid date/time: line string amount_ -While parsing file "$sourcepath/src/amount.h", line 738: +While parsing file "src/amount.h", line 755: Error: Invalid date/time: line string amount_ -While parsing file "$sourcepath/src/amount.h", line 744: +While parsing file "src/amount.h", line 761: Error: Invalid date/time: line string amount_ -While parsing file "$sourcepath/src/amount.h", line 750: +While parsing file "src/amount.h", line 767: Error: Invalid date/time: line std::ostream& -While parsing file "$sourcepath/src/amount.h", line 757: +While parsing file "src/amount.h", line 774: Error: Invalid date/time: line std::istream& +While parsing file "src/amount.h", line 780: +Error: Unexpected whitespace at beginning of line end test diff --git a/test/regress/2CE7DADB.test b/test/regress/2CE7DADB.test new file mode 100644 index 00000000..c6d94b96 --- /dev/null +++ b/test/regress/2CE7DADB.test @@ -0,0 +1,13 @@ +2012-01-01 * Buy AAA + A 1 AAA @ 1.00 EUR + B -1.00 EUR + +2012-02-01 * Buy AAA + A 1 AAA @ 2.00 EUR + B -2.00 EUR + +test --anon pricedb --format "%(date) %(amount)\n" +2012/01/01 1.00 A +2012/02/01 2.00 A +end test + diff --git a/test/regress/3AAB00ED.test b/test/regress/3AAB00ED.test new file mode 100644 index 00000000..217917b3 --- /dev/null +++ b/test/regress/3AAB00ED.test @@ -0,0 +1,23 @@ +; Test for: --sort d not working with -p + +2009-01-01 Opening Balances + Assets:Checking 100.00 EUR + Equity:Opening Balances + +2009-03-01 Test + Expenses:Phone 10.00 EUR + Assets:Checking + +2009-02-01 Test + Expenses:Phone 10.00 EUR + Assets:Checking + +test --sort d -p "until 2010" reg +09-Jan-01 Opening Balances Assets:Checking 100.00 EUR 100.00 EUR + Equit:Opening Balances -100.00 EUR 0 +09-Feb-01 Test Expenses:Phone 10.00 EUR 10.00 EUR + Assets:Checking -10.00 EUR 0 +09-Mar-01 Test Expenses:Phone 10.00 EUR 10.00 EUR + Assets:Checking -10.00 EUR 0 +end test + diff --git a/test/regress/3FE26304.test b/test/regress/3FE26304.test new file mode 100644 index 00000000..7c5b6026 --- /dev/null +++ b/test/regress/3FE26304.test @@ -0,0 +1,74 @@ +N $ +P 2010/09/28 20:43:24 E $3.700 +P 2010/09/28 20:43:25 A $5.230 +P 2010/09/28 20:43:26 D $34.020 +P 2010/09/28 20:43:27 C $12.370 +P 2010/09/28 20:43:28 F $39.700 +P 2010/09/28 20:43:29 B $39.430 +P 2010/09/29 13:50:15 E $3.720 +P 2010/09/29 13:50:15 A $5.240 +P 2010/09/29 13:50:17 D $33.920 +P 2010/09/29 13:50:18 C $12.310 P 2010/09/29 13:50:18 F $39.670 +P 2010/09/29 13:50:19 B $39.830 + +2010/04/04 * Opening Balance + Assets:Sub1 100 A @ $0.01 + Equity:Opening Balances + +2010/04/04 * Opening Balance + Assets:Sub1 100 B @ $32.27 + Equity:Opening Balances + +2010/04/04 * Opening Balance + Assets:Sub1 100 C @ $11.30 + Equity:Opening Balances + +2010/04/04 * Opening Balance + Assets:Sub1 100 D @ $20.30 + Equity:Opening Balances + +2010/04/04 * Opening Balance + Assets:Sub1:Leftovers $6.79 + Equity:Opening Balances + +2010/04/04 * Opening Balance + Assets:Sub1 11 D + Equity:Opening Balances + +2010/04/04 * Opening Balance + Assets:Sub1 100 E @ $2.97 + Equity:Opening Balances + +2010/05/18=2010/05/21 * FOO + Assets:Sub1 200 F @ $27.190 + Expenses:Qux $29.95 + Assets:Sub2 + +2010/07/02 * BAR + Income:D -$169.65 + Assets:Sub2 $32.50 + Assets:Sub1 6 D @ $22.64 + Assets:Sub1:Leftovers + +test bal -X \$ sub1 + $18026.74 Assets:Sub1 + $8.10 Leftovers +-------------------- + $18026.74 +end test + +test reg -X \$ sub1 --now=2012/03/14 +10-Apr-04 Opening Balance Assets:Sub1 $1.00 $1.00 +10-Apr-04 Opening Balance Assets:Sub1 $3227.00 $3228.00 +10-Apr-04 Opening Balance Assets:Sub1 $1130.00 $4358.00 +10-Apr-04 Opening Balance Assets:Sub1 $2030.00 $6388.00 +10-Apr-04 Opening Balance Assets:Sub1:Leftovers $6.79 $6394.79 +10-Apr-04 Opening Balance Assets:Sub1 $223.30 $6618.09 +10-Apr-04 Opening Balance Assets:Sub1 $297.00 $6915.09 +10-May-18 FOO Assets:Sub1 $5438.00 $12353.09 +10-Jul-02 Commodities revalued <Revalued> $259.74 $12612.83 +10-Jul-02 BAR Assets:Sub1 $135.84 $12748.67 + Assets:Sub1:Leftovers $1.31 $12749.98 +10-Sep-29 Commodities revalued <Revalued> $5251.46 $18001.44 +12-Mar-14 Commodities revalued <Revalued> $25.30 $18026.74 +end test diff --git a/test/regress/4509F714.test b/test/regress/4509F714.test new file mode 100644 index 00000000..5c5985f2 --- /dev/null +++ b/test/regress/4509F714.test @@ -0,0 +1,25 @@ +P 2008/01/01 $ €1 + +2008/01/11 LIAT + Expenses:Travel:Airfare $40.00 + Liabilities:MasterCard + +2008/02/05 CTX + Expenses:Travel:Auto €240.38 + Liabilities:MasterCard + +test bal --exchange=€ + €280.38 Expenses:Travel + €40.00 Airfare + €240.38 Auto + €-280.38 Liabilities:MasterCard +-------------------- + 0 +end test + +test bal --exchange=€ --percent + 100.00% Expenses:Travel + 14.27% Airfare + 85.73% Auto + 100.00% Liabilities:MasterCard +end test diff --git a/test/regress/47C579B8.test b/test/regress/47C579B8.test new file mode 100644 index 00000000..f1f9579f --- /dev/null +++ b/test/regress/47C579B8.test @@ -0,0 +1,92 @@ +2008/01/11 LIAT + Expenses:Travel:Airfare 40,00 € + Liabilities:MasterCard + +2008/01/14 cheaptickets.com + Expenses:Travel:Airfare 182,19 € + Liabilities:MasterCard + +2008/02/05 CTX + Expenses:Travel:Auto 240,38 € + Liabilities:MasterCard + +2008/02/05 UNITED + Expenses:Travel:Airfare 238,80 € + Liabilities:MasterCard + +2008/02/05 UNITED + Expenses:Travel:Airfare 238,80 € + Liabilities:MasterCard + +2008/02/22 BUDGET RENT-A-CAR + Expenses:Travel:Auto 40,59 € + Liabilities:MasterCard + +2008/03/16 IBERIA + Expenses:Travel:Airfare 1231,60 € + Liabilities:MasterCard + +2008/03/16 IBERIA + Expenses:Travel:Airfare 1231,60 € + Liabilities:MasterCard + +2008/04/03 AMERICAN + Expenses:Travel:Airfare 155,86 € + Liabilities:MasterCard + +2008/04/03 AMERICAN + Expenses:Travel:Airfare 155,86 € + Liabilities:MasterCard + +2008/04/30 UNITED + Expenses:Travel:Airfare 437,21 € + Liabilities:MasterCard + +2008/04/30 UNITED + Expenses:Travel:Airfare 437,21 € + Liabilities:MasterCard + +2008/08/08 BCIS I-131 FILING FEE- + Expenses:Travel:Passport 170,00 € + Liabilities:MasterCard + +2008/09/06 AMERICAN + Expenses:Travel:Airfare 912,60 € + Liabilities:MasterCard + +2008/09/06 AMERICAN + Expenses:Travel:Airfare 912,60 € + Liabilities:MasterCard + +2008/09/22 AGNT FEE + Expenses:Travel:Airfare 70,00 € + Liabilities:MasterCard + +2008/09/22 DELTA + Expenses:Travel:Airfare 806,20 € + Liabilities:MasterCard + +2008/09/22 DELTA + Expenses:Travel:Airfare 806,20 € + Liabilities:MasterCard + +2008/09/22 LIAT 1974 LIMITED + Expenses:Travel:Airfare 418,34 € + Liabilities:MasterCard + +2008/12/26 U.S. Department of State + Expenses:Travel:Passport 127,00 € + Assets:Checking + +2008/12/26 U.S. Department of State + Expenses:Travel:Passport 127,00 € + Assets:Checking + +test --decimal-comma --percent balance + 100.00% Assets:Checking + 100.00% Expenses:Travel + 92.15% Airfare + 3.13% Auto + 4.72% Passport + 100.00% Liabilities:MasterCard +end test diff --git a/test/regress/4D9288AE.dat b/test/regress/4D9288AE.dat new file mode 100644 index 00000000..758feb19 --- /dev/null +++ b/test/regress/4D9288AE.dat @@ -0,0 +1,4 @@ +2012-03-17 Payee + Expenses:Food $20 + Assets:Cash + diff --git a/test/regress/4D9288AE.py b/test/regress/4D9288AE.py new file mode 100644 index 00000000..4f9c9ba9 --- /dev/null +++ b/test/regress/4D9288AE.py @@ -0,0 +1,4 @@ +import ledger + +for post in ledger.read_journal("test/regress/4D9288AE.dat").query("^expenses:"): + print post.cost diff --git a/test/regress/4D9288AE_py.test b/test/regress/4D9288AE_py.test new file mode 100644 index 00000000..ff2874ce --- /dev/null +++ b/test/regress/4D9288AE_py.test @@ -0,0 +1,3 @@ +test python test/regress/4D9288AE.py +None +end test diff --git a/test/regress/53BCED29.test b/test/regress/53BCED29.test new file mode 100644 index 00000000..77fd39f3 --- /dev/null +++ b/test/regress/53BCED29.test @@ -0,0 +1,29 @@ +D $1,000.00 + +; payroll taxes += /^Payroll/ + Liabilities:Taxes:CFICA 0.062 + Liabilities:Taxes:CMED 0.0145 + $account:EFICA -0.062 + $account:EMED -0.0145 + +; Hourly rates for each employee, as commodity prices. +P 2010/01/01 EONE $15.00 + +; Payroll transactions +2010/05/18 Payroll from May 2nd to May 15th for Employee1 + Assets:Checking 20 EONE + Payroll:Employee1 + +test bal -V + $300.00 Assets:Checking + $-22.95 Liabilities:Taxes + $-18.60 CFICA + $-4.35 CMED + $-277.05 Payroll:Employee1 + $18.60 EFICA + $4.35 EMED +-------------------- + 0 +end test + diff --git a/test/regress/5D92A5EB.test b/test/regress/5D92A5EB.test new file mode 100644 index 00000000..1bdd7256 --- /dev/null +++ b/test/regress/5D92A5EB.test @@ -0,0 +1,34 @@ +~ Monthly from 2010/7/1 + Expenses:Auto:Gas $100.00 + Expenses:Auto:Insurance $100.00 + Expenses:Childcare $100.00 + Expenses:Entertainment:Blizzard $100.00 + Expenses:Entertainment:Netflix $100.00 + Expenses:Groceries $100.00 + Expenses:Utilities:Electric $100.00 + Expenses:Utilities:Water $100.00 + Expenses:Utilities:Sewage $100.00 + Liabilities:Education:ULL $100.00 + Liabilities:Mortgage $100.00 + Assets:Bank:Checking + +test -J reg checking -> 1 +__ERROR__ +While parsing file "$FILE", line 13: +While parsing periodic transaction: +> ~ Monthly from 2010/7/1 +> Expenses:Auto:Gas $100.00 +> Expenses:Auto:Insurance $100.00 +> Expenses:Childcare $100.00 +> Expenses:Entertainment:Blizzard $100.00 +> Expenses:Entertainment:Netflix $100.00 +> Expenses:Groceries $100.00 +> Expenses:Utilities:Electric $100.00 +> Expenses:Utilities:Water $100.00 +> Expenses:Utilities:Sewage $100.00 +> Liabilities:Education:ULL $100.00 +> Liabilities:Mortgage $100.00 +> Assets:Bank:Checking +Error: Posting with null amount's account may be mispelled: + "Expenses:Entertainment:Blizzard $100.00" +end test diff --git a/test/regress/605A410D.test b/test/regress/605A410D.test new file mode 100644 index 00000000..6943939a --- /dev/null +++ b/test/regress/605A410D.test @@ -0,0 +1,32 @@ += expr amount > 500 and account =~ /Employer:One/ + (Virtual) 1 + +2012-01-16 KFC + Employer:One $1,000.00 + Assets:Cash + += expr amount>500 and account =~ /Employer:Two/ + (Virtual) 10 + +2012-02-16 KFC + Employer:Two $1,000.00 + Assets:Cash + += Employer:Three and expr amount>500 + (Virtual) 100 + +2012-03-16 KFC + Employer:Three $1,000.00 + Assets:Cash + +test reg +12-Jan-16 KFC Employer:One $1,000.00 $1,000.00 + Assets:Cash $-1,000.00 0 + (Virtual) $1,000.00 $1,000.00 +12-Feb-16 KFC Employer:Two $1,000.00 $2,000.00 + Assets:Cash $-1,000.00 $1,000.00 + (Virtual) $10,000.00 $11,000.00 +12-Mar-16 KFC Employer:Three $1,000.00 $12,000.00 + Assets:Cash $-1,000.00 $11,000.00 + (Virtual) $100,000.00 $111,000.00 +end test diff --git a/test/regress/6188B0EC.test b/test/regress/6188B0EC.test new file mode 100644 index 00000000..b2aec910 --- /dev/null +++ b/test/regress/6188B0EC.test @@ -0,0 +1,10 @@ +; Test for: No error message if the parser cannot find an included file + +!include 6188B0EC-does-not-exist.dat + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 3: +Error: File to include was not found: "$sourcepath/test/regress/6188B0EC-does-not-exist.dat" +end test + diff --git a/test/regress/640D3205.test b/test/regress/640D3205.test new file mode 100644 index 00000000..f43b850f --- /dev/null +++ b/test/regress/640D3205.test @@ -0,0 +1,20 @@ +; Test for: "print" command filters out the "balance assertions" + +2008/12/31 * Interest + Assets:Brokerage $800.00 + Income:Somewhere + +2008/12/31 * Interest + Assets:Brokerage $200.00 = $1,000.00 + Income:Somewhere + +test print +2008/12/31 * Interest + Assets:Brokerage $800.00 + Income:Somewhere + +2008/12/31 * Interest + Assets:Brokerage $200.00 = $1000.00 + Income:Somewhere +end test + diff --git a/test/regress/65FECA4D.test b/test/regress/65FECA4D.test new file mode 100644 index 00000000..3e575961 --- /dev/null +++ b/test/regress/65FECA4D.test @@ -0,0 +1,12 @@ +--now=2012-02-28 + +Y 2012 + +2/29 E-trade Bank + Expenses:Food $20 + Assets:Cash + +test reg +12-Feb-29 E-trade Bank Expenses:Food $20 $20 + Assets:Cash $-20 0 +end test diff --git a/test/regress/6D9066DD.test b/test/regress/6D9066DD.test new file mode 100644 index 00000000..aa885f7d --- /dev/null +++ b/test/regress/6D9066DD.test @@ -0,0 +1,17 @@ +2009/09/23 * (EFT) Elec Ext Deposit AMAZON.COM FZXXOLTQ - Retail dis payments.amazon.com + Assets:Checking $39.05 + Assets:Receivable:Amazon + +2007/10/15 * FOO ; :USA: + Assets:NRL:Checking $1,726.18 + Assets:Receivable:CEG ; [2007/10/05] + +test print +2009/09/23 * (EFT) Elec Ext Deposit AMAZON.COM FZXXOLTQ - Retail dis payments.amazon.com + Assets:Checking $39.05 + Assets:Receivable:Amazon + +2007/10/15 * FOO ; :USA: + Assets:NRL:Checking $1,726.18 + Assets:Receivable:CEG ; [2007/10/05] +end test diff --git a/test/regress/6E041C52.test b/test/regress/6E041C52.test new file mode 100644 index 00000000..0a56dd70 --- /dev/null +++ b/test/regress/6E041C52.test @@ -0,0 +1,8 @@ +2012-03-16 KFC + Expenses:E of March: End of April $100.00 + Assets:Cash + +test reg +12-Mar-16 KFC Ex:E of: End of April $100.00 $100.00 + Assets:Cash $-100.00 0 +end test diff --git a/test/regress/751B2357.test b/test/regress/751B2357.test new file mode 100644 index 00000000..2b0f9a16 --- /dev/null +++ b/test/regress/751B2357.test @@ -0,0 +1,17 @@ +01.10.2011 4b4e2a89 + ef9d9585:efa1fb7b:22845e93:0e3763f0 2,00 A + 2c166ff7:d34e3aa1:8a5075b3:56f3c726 + +01.10.2011 15983995 + eb78b6c0:a2857de3:d6d8ea07:6688fc4e 2,58 A + ba3ffe56:c3ba36a5:aa63399f:e9e1d043 + +test print --date-format=%d.%m.%Y --input-date-format=%d.%m.%Y +01.10.2011 4b4e2a89 + ef9d9585:efa1fb7b:22845e93:0e3763f0 2,00 A + 2c166ff7:d34e3aa1:8a5075b3:56f3c726 + +01.10.2011 15983995 + eb78b6c0:a2857de3:d6d8ea07:6688fc4e 2,58 A + ba3ffe56:c3ba36a5:aa63399f:e9e1d043 +end test diff --git a/test/regress/786A3DD0.test b/test/regress/786A3DD0.test new file mode 100644 index 00000000..051f6382 --- /dev/null +++ b/test/regress/786A3DD0.test @@ -0,0 +1,17 @@ +D 1000.00 EUR + +2011-02-27 * Australia + A -100.00 AUD @ 0.746 EUR + B + +2012-03-12 * Withdrawal + Assets:Cash USD 200.00 + Expenses:Banking:Fees USD 2.50 + Assets:Chequing CAD -203.42 + Epenses:Banking:Fees CAD 2.00 + Assets:Chqeuing CAD -2.00 + +test pricedb +P 2011/02/27 00:00:00 AUD 0.746 EUR +P 2012/03/12 00:00:00 USD CAD 1.00454320987654321 +end test diff --git a/test/regress/78AB4B87.dat b/test/regress/78AB4B87.dat new file mode 100644 index 00000000..45b3028a --- /dev/null +++ b/test/regress/78AB4B87.dat @@ -0,0 +1,14 @@ +D 1000.00 EUR +P 2011-01-01 GBP 1.2 EUR + +2011-01-01 * Opening balance + Assets:Bank 10.00 GBP + Equity:Opening balance + +2012-01-02 * Test + Assets:Bank 5.00 GBP + Income:Whatever + +2012-01-03 * Test + Assets:Bank + Income:Whatever -5.00 EUR @ 0.8733 GBP diff --git a/test/regress/78AB4B87.py b/test/regress/78AB4B87.py new file mode 100644 index 00000000..fed95b54 --- /dev/null +++ b/test/regress/78AB4B87.py @@ -0,0 +1,27 @@ +import ledger + +eur = ledger.commodities.find_or_create('EUR') + +total_eur = ledger.Amount("0.00 EUR") +total_gbp = ledger.Amount("0.00 GBP") +total = ledger.Amount("0.00 EUR") + +for post in ledger.read_journal("test/regress/78AB4B87.dat").query("^income:"): + print post.amount + print post.amount.commodity + if post.amount.commodity == "EUR": + total_eur += post.amount + elif post.amount.commodity == "GBP": + total_gbp += post.amount + + a = post.amount.value(eur) + if a: + print "Total is presently: (%s)" % total + print "Converted to EUR: (%s)" % a + total += a + print "Total is now: (%s)" % total + else: + print "Cannot convert '%s'" % post.amount + print + +print total diff --git a/test/regress/78AB4B87_py.test b/test/regress/78AB4B87_py.test new file mode 100644 index 00000000..8f847145 --- /dev/null +++ b/test/regress/78AB4B87_py.test @@ -0,0 +1,15 @@ +test python test/regress/78AB4B87.py +-5.00 GBP +GBP +Total is presently: (0.00 EUR) +Converted to EUR: (-5.73 EUR) +Total is now: (-5.73 EUR) + +-5.00 EUR {0.8733 GBP} [2012/01/03] +EUR +Total is presently: (-5.73 EUR) +Converted to EUR: (-5.00 EUR) +Total is now: (-10.73 EUR) + +-10.73 EUR +end test diff --git a/test/regress/82763D86.test b/test/regress/82763D86.test new file mode 100644 index 00000000..e580077d --- /dev/null +++ b/test/regress/82763D86.test @@ -0,0 +1,35 @@ +; Test for: 'ledger -f doc/sample.dat reg -s -n liab' elides too much +; It collapses the account down to "<Total>", even though there was +; only one account! + += /^Expenses:Books/ + (Liabilities:Taxes) -0.10 + +~ Monthly + Assets:Bank:Checking $500.00 + Income:Salary + +2004/05/01 * Checking balance + Assets:Bank:Checking $1,000.00 + Equity:Opening Balances + +2004/05/01 * Investment balance + Assets:Brokerage 50 AAPL @ $30.00 + Equity:Opening Balances + +2004/05/14 * Pay day + Assets:Bank:Checking $500.00 + Income:Salary + +2004/05/27 Book Store + Expenses:Books $20.00 + Liabilities:MasterCard + +2004/05/27 (100) Credit card company + Liabilities:MasterCard $20.00 + Assets:Bank:Checking + +test -s reg liabilities +04-May-27 - 04-May-27 (Liabilities:Taxes) $-2.00 $-2.00 +end test + diff --git a/test/regress/83B4A0E5.test b/test/regress/83B4A0E5.test new file mode 100644 index 00000000..f9402a2d --- /dev/null +++ b/test/regress/83B4A0E5.test @@ -0,0 +1,43 @@ +P 2012-03-01 EUR $2 +P 2012-03-01 GBP $2 + +2012-03-05 KFC + Expenses:Food 10 EUR + Assets:Cash + +2012-03-10 KFC + Expenses:Food 10 GBP + Assets:Cash + +test reg food +12-Mar-05 KFC Expenses:Food 10 EUR 10 EUR +12-Mar-10 KFC Expenses:Food 10 GBP 10 EUR + 10 GBP +end test + +test reg food -V +12-Mar-05 KFC Expenses:Food $20 $20 +12-Mar-10 KFC Expenses:Food $20 $40 +end test + +test reg food -X '$' +12-Mar-05 KFC Expenses:Food $20 $20 +12-Mar-10 KFC Expenses:Food $20 $40 +end test + +test reg food -X '$,GBP' +12-Mar-05 KFC Expenses:Food $20 $20 +12-Mar-10 KFC Expenses:Food 10 GBP $20 + 10 GBP +end test + +test reg food -X '$!,GBP' +12-Mar-05 KFC Expenses:Food $20 $20 +12-Mar-10 KFC Expenses:Food $20 $40 +end test + +test reg food -X '$,EUR' +12-Mar-05 KFC Expenses:Food 10 EUR 10 EUR +12-Mar-10 KFC Expenses:Food $20 $20 + 10 EUR +end test diff --git a/test/regress/854150DF.test b/test/regress/854150DF.test new file mode 100644 index 00000000..7133e183 --- /dev/null +++ b/test/regress/854150DF.test @@ -0,0 +1,25 @@ +2011-11-10 * test + A:B:C 12.50 GBP + A:C + +test bal --flat -d "depth>=2" + 12.50 GBP A:B:C + -12.50 GBP A:C +-------------------- + 0 +end test + +test bal --flat -d "depth>1" + 12.50 GBP A:B:C + -12.50 GBP A:C +-------------------- + 0 +end test + +test bal --flat -d "depth>2" + 12.50 GBP A:B:C +end test + +test bal --flat -d "depth==2" + -12.50 GBP A:C +end test diff --git a/test/regress/889BB167.test b/test/regress/889BB167.test new file mode 100644 index 00000000..02e25ab6 --- /dev/null +++ b/test/regress/889BB167.test @@ -0,0 +1,17 @@ +D 1000.00 GBP + +P 2011-01-01 EUR 0.8604 GBP +P 2011-02-01 EUR 0.8576 GBP + +2011-01-31 * AdSense earnings + Assets:Receivable:AdSense 11.00 EUR + Income:AdSense + +2011-02-28 * AdSense earnings + Assets:Receivable:AdSense 10.00 EUR + Income:AdSense + +test reg income:adse -X GBP -H +11-Jan-31 AdSense earnings Income:AdSense -9.46 GBP -9.46 GBP +11-Feb-28 AdSense earnings Income:AdSense -8.58 GBP -18.04 GBP +end test diff --git a/test/regress/89233B6D-a.dat b/test/regress/89233B6D-a.dat new file mode 100644 index 00000000..01d00e9a --- /dev/null +++ b/test/regress/89233B6D-a.dat @@ -0,0 +1,4 @@ +1994/01/02 * Salary + Asssets:Bank:Checking 200.00 + Income:Salary -200.00 + diff --git a/test/regress/89233B6D-b.dat b/test/regress/89233B6D-b.dat new file mode 100644 index 00000000..f54dc66f --- /dev/null +++ b/test/regress/89233B6D-b.dat @@ -0,0 +1,4 @@ +1994/01/02 * Rent + Expenses:Rent 100.00 + Asssets:Bank:Checking -100.00 + diff --git a/test/regress/89233B6D.test b/test/regress/89233B6D.test new file mode 100644 index 00000000..e6bd38f5 --- /dev/null +++ b/test/regress/89233B6D.test @@ -0,0 +1,13 @@ +!apply account A +!include 89233B6D-a.dat +!end + +!apply account B +!include 89233B6D-b.dat +!end + +test reg "^A:" +94-Jan-02 Salary A:Assset:Bank:Checking 200 200 + A:Income:Salary -200 0 +end test + diff --git a/test/regress/8CE88DB4.test b/test/regress/8CE88DB4.test new file mode 100644 index 00000000..52fe0a9b --- /dev/null +++ b/test/regress/8CE88DB4.test @@ -0,0 +1,11 @@ +2010-01-01 * Test + Expenses:Food 100.00 EUR + Assets:Cash -100.00 EUR + +2011-07-30 * Exchange EUR to BAM + Assets:Cash -22.00 EUR + Assets:Cash 44.00 BAM + +test pricedb +P 2011/07/30 00:00:00 EUR 2.00 BAM +end test diff --git a/test/regress/8EAF77C0.test b/test/regress/8EAF77C0.test new file mode 100644 index 00000000..f0a2829c --- /dev/null +++ b/test/regress/8EAF77C0.test @@ -0,0 +1,17 @@ +2011/08/05 Rehab Donation + Asset:Bank:Boi:Current:Dk 10 + Expense:Misc:Charity + + 2011/08/07 Net Salary + Asset:Bank:Boi:Savings:Dk -3016.24 + Income:NetSalary:Dk + +2011/08/30 Net Salary + Asset:Bank:Boi:Savings:Dk -3016.24 + Income:NetSalary:Dk + +test reg -> 1 +__ERROR__ +While parsing file "$FILE", line 5: +Error: Unexpected whitespace at beginning of line +end test diff --git a/test/regress/9188F587.py b/test/regress/9188F587.py new file mode 100644 index 00000000..50195252 --- /dev/null +++ b/test/regress/9188F587.py @@ -0,0 +1,27 @@ +import ledger + +eur = ledger.commodities.find_or_create('EUR') + +total_eur = ledger.Amount("0.00 EUR") +total_gbp = ledger.Amount("0.00 GBP") +total = ledger.Amount("0.00 EUR") + +for post in ledger.read_journal("test/regress/78AB4B87.dat").query("^income:"): + print post.amount + print post.amount.commodity + if post.amount.commodity == "EUR": + total_eur += post.amount + elif post.amount.commodity == "GBP": + total_gbp += post.amount + + a = post.amount.value(eur, post.date) + if a: + print "Total is presently: (%s)" % total + print "Converted to EUR: (%s)" % a + total += a + print "Total is now: (%s)" % total + else: + print "Cannot convert '%s'" % post.amount + print + +print total diff --git a/test/regress/9188F587_py.test b/test/regress/9188F587_py.test new file mode 100644 index 00000000..28bb34ff --- /dev/null +++ b/test/regress/9188F587_py.test @@ -0,0 +1,15 @@ +test python test/regress/9188F587.py +-5.00 GBP +GBP +Total is presently: (0.00 EUR) +Converted to EUR: (-6.00 EUR) +Total is now: (-6.00 EUR) + +-5.00 EUR {0.8733 GBP} [2012/01/03] +EUR +Total is presently: (-6.00 EUR) +Converted to EUR: (-5.00 EUR) +Total is now: (-11.00 EUR) + +-11.00 EUR +end test diff --git a/test/regress/95350193.test b/test/regress/95350193.test new file mode 100644 index 00000000..dadb39cf --- /dev/null +++ b/test/regress/95350193.test @@ -0,0 +1,6 @@ +2011-11-08 * Test + Assets:Voucher:Amazon 137.87 GBP (48H5) + Assets:Cash -137.87 GBP + +test pricedb +end test diff --git a/test/regress/96A8E4A1.test b/test/regress/96A8E4A1.test new file mode 100644 index 00000000..93fb55d2 --- /dev/null +++ b/test/regress/96A8E4A1.test @@ -0,0 +1,10 @@ +2011-01-31 * Test + Expenses:Travel 1 "Spr MegaBonus" + Assets:Voucher + +test -X EUR -H bal + -1 "Spr MegaBonus" Assets:Voucher + 1 "Spr MegaBonus" Expenses:Travel +-------------------- + 0 +end test diff --git a/test/regress/9E0E606D.test b/test/regress/9E0E606D.test new file mode 100644 index 00000000..86b8e36f --- /dev/null +++ b/test/regress/9E0E606D.test @@ -0,0 +1,19 @@ +D 1000.00 GBP + +P 2011-02-01 EUR 0.8576 GBP +P 2011-03-01 EUR 0.8612 GBP +P 2011-04-01 EUR 0.8510 GBP + +2011-01-31 * AdSense earnings + Assets:Receivable:AdSense 11.00 EUR + Income:AdSense + +2011-02-28 * AdSense earnings + Assets:Receivable:AdSense 10.00 EUR + Income:AdSense + +test reg income:ad -X GBP -H +11-Jan-31 AdSense earnings Income:AdSense -11.00 EUR -11.00 EUR +11-Feb-28 Commodities revalued <Revalued> -9.43 GBP -9.43 GBP +11-Feb-28 AdSense earnings Income:AdSense -8.58 GBP -18.01 GBP +end test diff --git a/test/regress/A560FDAD.test b/test/regress/A560FDAD.test new file mode 100644 index 00000000..ee19e71e --- /dev/null +++ b/test/regress/A560FDAD.test @@ -0,0 +1,85 @@ +2012-01-01 * Opening balance + Assets:Current 17.43 EUR + Assets:Investments 200 "LU02" @ 24.77 EUR + Assets:Investments 58 "LU02" @ 24.79900855 EUR + Equity:Opening balance + +2012-01-01 * Opening balance + Assets:Pension 785.44 GBP + Assets:Pension 97.0017 "H2" @ 5.342999720204 GBP + Assets:Pension 4.3441 "H1" @ 5.289999915108 GBP + Equity:Opening balance + +2012-01-01 * Opening balance: misc + Assets:Piggy bank 3.51 GBP + Equity:Opening balance + +2012-01-01 * Opening balance + Assets:Rewards 9836 AAdvantage + Equity:Opening balance + +2012-01-03 * Receivable + Assets:Current + Assets:Receivable -161.06 EUR + Assets:Receivable -9.99 GBP @@ 11.65 EUR + +2012-01-27 * Test + Income:Test -2759.50 GBP + Income:Test -110.76 GBP + Assets:Foo 345.57 GBP + Expenses:Test 16.47 GBP + Expenses:Test 6.33 GBP + Expenses:Test 261.39 GBP + Assets:Current + +test reg -X EUR -H +12-Jan-01 Opening balance Assets:Current 17.43 EUR 17.43 EUR + Assets:Investments 4959.80 EUR 4977.23 EUR + Assets:Investments 1438.34 EUR 6415.57 EUR + Equity:Opening balance -6409.77 EUR 5.80 EUR +12-Jan-01 Opening balance Assets:Pension 785.44 GBP 5.80 EUR + 785.44 GBP + Assets:Pension 97.0017 H2 5.80 EUR + 785.44 GBP + 97.0017 H2 + Assets:Pension 4.3441 H1 5.80 EUR + 785.44 GBP + 4.3441 H1 + 97.0017 H2 + Equity:Opening balance -1326.70 GBP 5.80 EUR + -541.26 GBP + 4.3441 H1 + 97.0017 H2 +12-Jan-01 Opening balance: misc Assets:Piggy bank 3.51 GBP 5.80 EUR + -537.75 GBP + 4.3441 H1 + 97.0017 H2 + Equity:Opening balance -3.51 GBP 5.80 EUR + -541.26 GBP + 4.3441 H1 + 97.0017 H2 +12-Jan-01 Opening balance Assets:Rewards 9836 AAdvantage 9836 AAdvantage + 5.80 EUR + -541.26 GBP + 4.3441 H1 + 97.0017 H2 + Equity:Opening balance -9836 AAdvantage 5.80 EUR + -541.26 GBP + 4.3441 H1 + 97.0017 H2 +12-Jan-03 Commodities revalued <Revalued> 0 5.80 EUR +12-Jan-03 Receivable Assets:Current 172.71 EUR 178.51 EUR + Assets:Receivable -161.06 EUR 17.45 EUR + Assets:Receivable -11.65 EUR 5.80 EUR +12-Jan-27 Test <Adjustment> 0.01 EUR 5.81 EUR + Income:Test -3218.04 EUR -3212.23 EUR + <Adjustment> -0.01 EUR -3212.24 EUR + Income:Test -129.16 EUR -3341.40 EUR + Assets:Foo 402.99 EUR -2938.41 EUR + Expenses:Test 19.21 EUR -2919.20 EUR + Expenses:Test 7.38 EUR -2911.82 EUR + <Adjustment> 0.01 EUR -2911.81 EUR + Expenses:Test 304.82 EUR -2606.99 EUR + <Adjustment> -0.01 EUR -2607.00 EUR + Assets:Current 2612.80 EUR 5.80 EUR +end test diff --git a/test/regress/A8FCC765.dat b/test/regress/A8FCC765.dat new file mode 100644 index 00000000..abc51a0a --- /dev/null +++ b/test/regress/A8FCC765.dat @@ -0,0 +1,2 @@ +P 2012-03-16 06:47:12 CAD $2.50 +P 2012-03-17 06:47:12 CAD $3.50 diff --git a/test/regress/A8FCC765.test b/test/regress/A8FCC765.test new file mode 100644 index 00000000..1adf6053 --- /dev/null +++ b/test/regress/A8FCC765.test @@ -0,0 +1,8 @@ +2012-03-17 KFC + Expenses:Food 20 CAD + Assets:Cash + +test pricedb --price-db test/regress/A8FCC765.dat +P 2012/03/16 06:47:12 CAD $2.5 +P 2012/03/17 06:47:12 CAD $3.5 +end test diff --git a/test/regress/ACE05ECE.test b/test/regress/ACE05ECE.test new file mode 100644 index 00000000..72ea562b --- /dev/null +++ b/test/regress/ACE05ECE.test @@ -0,0 +1,6 @@ +i 2011/07/20 17:00:00 Hello Work project +o 2011/07/21 01:00:00 Hello + +test reg Hello +11-Jul-20 Work project (Hello) 8.00h 8.00h +end test diff --git a/test/regress/AEDE9734.test b/test/regress/AEDE9734.test new file mode 100644 index 00000000..cd2245b8 --- /dev/null +++ b/test/regress/AEDE9734.test @@ -0,0 +1,12 @@ +2011-02-23 Rocket Fuel + Expense:Travel $100000000.00 ; trip: Moon + Asset:NASA + +2011-02-23 Liquid Oxygen + Expense:Travel $232233223.00 ; trip: Moon + Asset:NASA + +test bal --group-by "tag('trip')" +Moon + $332233223.00 Expense:Travel +end test diff --git a/test/regress/AFAFB804.test b/test/regress/AFAFB804.test new file mode 100644 index 00000000..472540fb --- /dev/null +++ b/test/regress/AFAFB804.test @@ -0,0 +1,57 @@ +; Test for: ledger should allow sorting by multiple criteria, like: +; -S date,payee + +2010-02-09 * Z + A $10 + B + +2010-02-09 * Y + B $10 + C + +2010-02-09 * X + C $10 + D + +2010-02-10 * Z + A $15 + B + +2010-02-10 * Y + B $15 + C + +2010-02-10 * X + C $15 + D + +test reg -S date,payee +10-Feb-09 X C $10 $10 + D $-10 0 +10-Feb-09 Y B $10 $10 + C $-10 0 +10-Feb-09 Z A $10 $10 + B $-10 0 +10-Feb-10 X C $15 $15 + D $-15 0 +10-Feb-10 Y B $15 $15 + C $-15 0 +10-Feb-10 Z A $15 $15 + B $-15 0 +end test + +test reg -S payee,date +10-Feb-09 X C $10 $10 + D $-10 0 +10-Feb-10 X C $15 $15 + D $-15 0 +10-Feb-09 Y B $10 $10 + C $-10 0 +10-Feb-10 Y B $15 $15 + C $-15 0 +10-Feb-09 Z A $10 $10 + B $-10 0 +10-Feb-10 Z A $15 $15 + B $-15 0 +end test + diff --git a/test/regress/BFD3FBE1.test b/test/regress/BFD3FBE1.test new file mode 100644 index 00000000..0dbda2c7 --- /dev/null +++ b/test/regress/BFD3FBE1.test @@ -0,0 +1,16 @@ +2011-01-01 * Opening balance + Assets:Investment 100 "AAA" @ 16.58900489 EUR + Assets:Investments 5 "BBB" @ 24.79900855 EUR + Equity:Opening balance + +2011-02-10 * Reimbursement: Taxi / Subway / Bus / Train + Assets:A 1.59 GBP + Assets:B -1.80 EUR @ 0.884955752212389381 GBP + +test reg -X EUR -H +11-Jan-01 Opening balance Assets:Investment 1658.90 EUR 1658.90 EUR + Assets:Investments 124.00 EUR 1782.90 EUR + Equity:Opening balance -1782.90 EUR 0 +11-Feb-10 Reimbursement: Taxi.. Assets:A 1.80 EUR 1.80 EUR + Assets:B -1.80 EUR 0 +end test diff --git a/test/regress/C19E4E9B.test b/test/regress/C19E4E9B.test new file mode 100644 index 00000000..4837b4cd --- /dev/null +++ b/test/regress/C19E4E9B.test @@ -0,0 +1,18 @@ +2012-01-01=2012-01-02 * Buy AAA + A 1 AAA @ 1.00 EUR + B -1.00 EUR + +2012-02-01 * Buy AAA + A 1 AAA @ 2.00 EUR + B -2.00 EUR + +test reg --format "%S: %d %P %t %T\n" +$FILE: 2012/01/01 Buy AAA 1 AAA 1 AAA +$FILE: 2012/01/01 Buy AAA -1.00 EUR 1 AAA +-1.00 EUR +$FILE: 2012/02/01 Buy AAA 1 AAA 2 AAA +-1.00 EUR +$FILE: 2012/02/01 Buy AAA -2.00 EUR 2 AAA +-3.00 EUR +end test + diff --git a/test/regress/C927CFFE.test b/test/regress/C927CFFE.test new file mode 100644 index 00000000..d455b480 --- /dev/null +++ b/test/regress/C927CFFE.test @@ -0,0 +1,43 @@ + +2010/02/09 * Test 1 + A $10 + B + +2010/02/10 * Test 2 + B $10 + C + +2010/02/11 * Test 3 + C $10 + D + +test reg +test -l "date>=[2010/02/10]" reg +10-Feb-10 Test 2 B $10 $10 + C $-10 0 +10-Feb-11 Test 3 C $10 $10 + D $-10 0 +end test + +test -l "date<=[2010/02/10]" reg +10-Feb-09 Test 1 A $10 $10 + B $-10 0 +10-Feb-10 Test 2 B $10 $10 + C $-10 0 +end test + +test -l "date==[2010/02/10]" reg +10-Feb-10 Test 2 B $10 $10 + C $-10 0 +end test + +test -l "date>[2010/02/10]" reg +10-Feb-11 Test 3 C $10 $10 + D $-10 0 +end test + +test -l "date<[2010/02/10]" reg +10-Feb-09 Test 1 A $10 $10 + B $-10 0 +end test + diff --git a/test/regress/C9D593B3.test b/test/regress/C9D593B3.test new file mode 100644 index 00000000..1cb73080 --- /dev/null +++ b/test/regress/C9D593B3.test @@ -0,0 +1,23 @@ +2012-03-16 KFC + Expenses:Food $20 + Assets:Cash + +2012-03-16 KFC + Expenses:Food $20 + Assets:Cash + +2012-03-16 KFC + Expenses:Food $20 + Assets:Cash + +2012-03-16 KFC + Expenses:Food $20 + Assets:Cash + +2012-03-16 KFC + Expenses:Food $20 + Assets:Cash + +test payees +KFC +end test diff --git a/test/regress/CEECC0B0.test b/test/regress/CEECC0B0.test new file mode 100644 index 00000000..1465b8c3 --- /dev/null +++ b/test/regress/CEECC0B0.test @@ -0,0 +1,19 @@ +2012-01-01 * Opening Balances + Assets:Cash 100.00 EUR + Equity:Opening balances -100.00 EUR + +2012-01-02 * Buy AAA + Assets:Investments 1 AAA @ 10.00 EUR + Assets:Cash -10.00 EUR + +2012-01-03 * Sell AAA + Assets:Investments -1 AAA @ 10.00 EUR + Assets:Cash 10.00 EUR + + +test equity +2012/01/03 Opening Balances + Assets:Cash 100.00 EUR + Equity:Opening balances +end test + diff --git a/test/regress/CFE5D8AA.test b/test/regress/CFE5D8AA.test new file mode 100644 index 00000000..857dad13 --- /dev/null +++ b/test/regress/CFE5D8AA.test @@ -0,0 +1,20 @@ +~ monthly + assets:checking $1,000.00 + income:work:salary $-1,000.00 + +~ monthly + ; note + assets:checking $1,000.00 + income:work:salary $-1,000.00 + +~ monthly + assets:checking $1,000.00 + income:work:salary + +~ monthly + ; note + assets:checking $1,000.00 + income:work:salary + +test reg +end test diff --git a/test/regress/D51BFF74.test b/test/regress/D51BFF74.test new file mode 100644 index 00000000..a13af897 --- /dev/null +++ b/test/regress/D51BFF74.test @@ -0,0 +1,24 @@ +2012-03-16 KFC + Expenses:Food $-20 + Assets:Cash + +2012-03-16 KFC + Expenses:Food $- 20 + Assets:Cash + +2012-03-16 KFC + Expenses:Food -$20 + Assets:Cash + +2012-03-16 KFC + Expenses:Food - $20 + Assets:Cash + +test reg -> 1 +__ERROR__ +While parsing file "$FILE", line 6: +While parsing posting: + Expenses:Food $- 20 + ^^^^^ +Error: No quantity specified for amount +end test diff --git a/test/regress/D943AE0F.test b/test/regress/D943AE0F.test index 960fbe13..10082f75 100644 --- a/test/regress/D943AE0F.test +++ b/test/regress/D943AE0F.test @@ -6,7 +6,7 @@ D 1000.00 EUR P 2008/04/20 00:00:00 CAD 1.20 EUR -test reg -V +test reg -V --now=2008/04/20 08-Apr-15 Paid expenses back .. Exp:Cie-Reimbursements 2200.00 EUR 2200.00 EUR Assets:Checking -2200.00 EUR 0 08-Apr-20 Commodities revalued <Revalued> 200.00 EUR 200.00 EUR diff --git a/test/regress/D9C8EB08.test b/test/regress/D9C8EB08.test new file mode 100644 index 00000000..fa02431b --- /dev/null +++ b/test/regress/D9C8EB08.test @@ -0,0 +1,16 @@ +; Test for: Using ! erroneously in a data file causes a segfault + +! Assets:Cash + +2008/01/01 January + Expenses:Books $10.00 + Assets:Cash + +!end + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 9: +Error: 'end' or 'end apply' found, but no enclosing 'apply' directive +end test + diff --git a/test/regress/DB490507.test b/test/regress/DB490507.test new file mode 100644 index 00000000..24443d2a --- /dev/null +++ b/test/regress/DB490507.test @@ -0,0 +1,25 @@ +2001/11/07=2001/11/04 * Autoroutes du Sud de la France + Dépense:Vacances:Voyage ; 14F Tlse-Montauban, 8F Montauban-Caussade, 8F Caussade-Montauban, 14F Montauban-Tlse + Actif:Courant:BnpCc -6,71 € + +2008/01/20 * La Poste + Equity + Actif:Courant:LaPosteLivretA 10,00 € + +2008/01/20 * La Poste + Revenu:Invest:Exonéré + Actif:Courant:LaPosteLivretA 25,24 € = 35,24 € + +test print --decimal-comma --columns=999 +2001/11/07=2001/11/04 * Autoroutes du Sud de la France + Dépense:Vacances:Voyage ; 14F Tlse-Montauban, 8F Montauban-Caussade, 8F Caussade-Montauban, 14F Montauban-Tlse + Actif:Courant:BnpCc -6,71 € + +2008/01/20 * La Poste + Equity + Actif:Courant:LaPosteLivretA 10,00 € + +2008/01/20 * La Poste + Revenu:Invest:Exonéré + Actif:Courant:LaPosteLivretA 25,24 € = 35,24 € +end test diff --git a/test/regress/DDB54BB8.test b/test/regress/DDB54BB8.test new file mode 100644 index 00000000..7d72043c --- /dev/null +++ b/test/regress/DDB54BB8.test @@ -0,0 +1,18 @@ +~ Monthly + Aufwand:Bargeld 0,30€ + Aktiva:Bank:Girokonto -0,40€ + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 3: +Unbalanced remainder is: + -0,10€ +Amount to balance against: + 0,30€ +While parsing periodic transaction: +> ~ Monthly +> Aufwand:Bargeld 0,30€ +> Aktiva:Bank:Girokonto -0,40€ +Error: Transaction does not balance +end test + diff --git a/test/regress/E2E479BC.test b/test/regress/E2E479BC.test new file mode 100644 index 00000000..8216028a --- /dev/null +++ b/test/regress/E2E479BC.test @@ -0,0 +1,17 @@ +; Test for: ledger used to show multiple "Income:Unknown" in this +; case in the past, which it shouldn't. + +2009/01/01 Sample + Expenses:Alpha 10 A + Expenses:Beta 10 B + Expenses:Gamma 10 C + Income:Unknown + +test print +2009/01/01 Sample + Expenses:Alpha 10 A + Expenses:Beta 10 B + Expenses:Gamma 10 C + Income:Unknown +end test + diff --git a/test/regress/EA18D948.test b/test/regress/EA18D948.test new file mode 100644 index 00000000..a63d4c35 --- /dev/null +++ b/test/regress/EA18D948.test @@ -0,0 +1,14 @@ +2012-01-01 * Buy AAA + A 1 AAA @ 1.00 EUR + B -1.00 EUR + +2012-02-01 * Buy AAA + A 1 AAA @ 2.00 EUR + B -2.00 EUR + +test reg A -V -A +12-Jan-01 Buy AAA A 1.00 EUR 1.00 EUR +12-Feb-01 Commodities revalued <Revalued> 1.00 EUR 0 +12-Feb-01 Buy AAA A 2.00 EUR 2.00 EUR +end test + diff --git a/test/regress/F06D5554.test b/test/regress/F06D5554.test new file mode 100644 index 00000000..4541b791 --- /dev/null +++ b/test/regress/F06D5554.test @@ -0,0 +1,552 @@ +2011/04/01 serveraxis.com + Expenses:Computer:Internet $15.00 + Expenses:Computer:Internet $1.10 + Liabilities:MasterCard + +2011/04/05 Pennsylvania toll booth + Expenses:Auto:Fees $13.00 + Expenses:Cash + +2011/04/05 iTunes + Expenses:Music $1.29 + Expenses:Taxes:Sales $0.09 + Liabilities:MasterCard $-1.38 + +2011/04/19 iTunes + Expenses:Computer:Software $4.99 + Expenses:Taxes:Sales $0.35 + Liabilities:MasterCard $-5.34 + +2011/04/24 iTunes + Expenses:Movies $1.99 + Expenses:Movies $2.99 + Expenses:Taxes:Sales $0.35 + Liabilities:MasterCard $-5.33 + +2011/04/29 iTunes + Expenses:Computer:Movies $0.99 + Expenses:Taxes:Sales $0.07 + Liabilities:MasterCard $-1.06 + +2011/05/01 serveraxis.com + Expenses:Computer:Internet $15.00 + Expenses:Computer:Internet $1.10 + Liabilities:MasterCard + +2011/05/18 iTunes + Expenses:Computer:Software $6.99 + Expenses:Taxes:Sales $0.49 + Liabilities:MasterCard $-7.48 + +2011/05/20 DynDNS.com + Expenses:Computer:Internet $15.00 + Liabilities:MasterCard + +2011/05/20 DynDNS.com + Expenses:Computer:Internet $15.00 + Liabilities:MasterCard + +2011/05/27 iTunes + Expenses:Movies $1.99 + Expenses:Movies $1.99 + Expenses:Movies $1.99 + Expenses:Taxes:Sales $0.42 + Liabilities:MasterCard $-6.39 + +2011/05/26 Valero + Expenses:Auto:Gas $26.79 + Liabilities:MasterCard + +2011/05/26 Starbucks + Expenses:Food $2.20 + Expenses:Taxes:Sales $0.15 + Liabilities:MasterCard $-2.35 + +2011/05/26 La Mex + Expenses:Food $17.70 + Expenses:Taxes:Sales $1.11 + Expenses:Tips $3.00 + Liabilities:MasterCard $-21.81 + +2011/05/27 Leaves N Beans + Expenses:Food:Dining $20.98 + Expenses:Taxes:Sales $1.63 + Expenses:Tips $2.00 + Liabilities:MasterCard $-24.61 + +2011/05/27 Wal*Mart + Expenses:Home:Supplies $7.97 + Expenses:Food:Grocery $3.25 + Expenses:Food:Grocery $3.18 + Expenses:Food:Grocery $3.18 + Expenses:Food:Grocery $2.98 + Expenses:Food:Grocery $1.98 + Expenses:Food:Grocery $3.98 + Expenses:Food:Grocery $3.58 + Expenses:Food:Grocery $3.58 + Expenses:Food:Grocery $1.58 + Expenses:Food:Grocery $1.88 + Expenses:Food:Grocery $2.50 + Expenses:Food:Grocery $1.26 + Expenses:Food:Grocery $2.62 + Expenses:Food:Grocery $3.48 + Expenses:Home:Supplies $1.37 + Expenses:Home:Supplies $2.92 + Expenses:Beauty $3.38 + Expenses:Beauty $0.97 + Expenses:Beauty $4.64 + Expenses:Beauty $1.97 + Expenses:Beauty $1.97 + Expenses:Beauty $5.98 + Expenses:Home:Supplies $9.98 + Expenses:Bedding $4.00 + Expenses:Bedding $4.00 + Expenses:Home:Supplies $2.88 + Expenses:Home:Supplies $2.88 + Expenses:Home:Supplies $2.88 + Expenses:Home:Supplies $2.88 + Expenses:Clothing $2.96 + Expenses:Supplies $0.84 + Expenses:Food:Grocery $1.38 + Expenses:Food:Grocery $1.38 + Expenses:Food:Grocery $2.32 + Expenses:Food:Grocery $2.00 + Expenses:Food:Grocery $2.98 + Expenses:Food:Grocery $3.00 + Expenses:Food:Grocery $2.14 + Expenses:Food:Grocery $2.14 + Expenses:Food:Grocery $2.50 + Expenses:Food:Grocery $2.50 + Expenses:Food:Grocery $3.48 + Expenses:Home:Supplies $1.17 + Expenses:Supplies $3.00 + Expenses:Bedding $34.88 + Expenses:Home $6.00 + Expenses:Home $6.00 + Expenses:Home:Supplies $3.97 + Expenses:Food:Grocery $0.78 + Expenses:Food:Grocery $0.78 + Expenses:Food:Grocery $0.78 + Expenses:Food:Grocery $0.78 + Expenses:Home $4.00 + Expenses:Home $4.00 + Expenses:Home $10.87 + Expenses:Home $4.00 + Expenses:Bedding $65.96 + Expenses:Taxes:Sales $16.89 + Expenses:Taxes:Sales $0.65 + Liabilities:MasterCard $-293.83 + +2011/05/27 Asia Grill + Expenses:Food:Dining $28.63 + Expenses:Tips $4.00 + Liabilities:MasterCard $-32.63 + +2011/05/28 Shell + Expenses:Auto:Gas $43.41 + Liabilities:MasterCard + +2011/05/28 Sears + Expenses:Home $1,728.96 + Expenses:Taxes:Sales $136.87 + Liabilities:MasterCard $-1,865.83 + +2011/05/28 Sears + Expenses:Home $99.61 + Expenses:Taxes:Sales $8.22 + Liabilities:MasterCard $-107.83 + +2011/05/28 Buffalo Wild Wings + Expenses:Food:Dining $22.98 + Expenses:Tips $2.35 + Expenses:Taxes:Sales $3.50 + Liabilities:MasterCard $-28.83 + +2011/05/28 Cold Stone Creamery + Expenses:Food:Dining $5.73 + Expenses:Tips $0.50 + Liabilities:MasterCard $-6.23 + +2011/05/29 Hy Vee + Expenses:Supplies $2.00 + Expenses:Supplies $7.99 + Expenses:Supplies $7.99 + Expenses:Food:Grocery $157.64 + Expenses:Taxes:Sales $5.74 + Liabilities:MasterCard $-181.36 + +2011/05/30 Allied movers, Fidel & Manny + Expenses:Tips $97.00 + Expenses:Cash + +2011/05/30 Starbucks + Expenses:Food:Dining $6.90 + Expenses:Taxes:Sales $0.71 + Liabilities:MasterCard $-7.61 + +2011/05/31 Wal*Mart + Expenses:Home $108.13 + Expenses:Taxes:Sales $8.65 + Liabilities:MasterCard $-116.78 + +test reg -p "apr 2011" Expenses +11-Apr-01 serveraxis.com Expe:Computer:Internet $15.00 $15.00 + Expe:Computer:Internet $1.10 $16.10 +11-Apr-05 Pennsylvania toll b.. Expenses:Auto:Fees $13.00 $29.10 + Expenses:Cash $-13.00 $16.10 +11-Apr-05 iTunes Expenses:Music $1.29 $17.39 + Expenses:Taxes:Sales $0.09 $17.48 +11-Apr-19 iTunes Expe:Computer:Software $4.99 $22.47 + Expenses:Taxes:Sales $0.35 $22.82 +11-Apr-24 iTunes Expenses:Movies $1.99 $24.81 + Expenses:Movies $2.99 $27.80 + Expenses:Taxes:Sales $0.35 $28.15 +11-Apr-29 iTunes Expens:Computer:Movies $0.99 $29.14 + Expenses:Taxes:Sales $0.07 $29.21 +end test + +test reg -p "apr 2011" Expenses --monthly +11-Apr-01 - 11-Apr-30 Expenses:Auto:Fees $13.00 $13.00 + Expenses:Cash $-13.00 0 + Expe:Computer:Internet $16.10 $16.10 + Expens:Computer:Movies $0.99 $17.09 + Expe:Computer:Software $4.99 $22.08 + Expenses:Movies $4.98 $27.06 + Expenses:Music $1.29 $28.35 + Expenses:Taxes:Sales $0.86 $29.21 +end test + +test reg -p "apr 2011" Expenses --monthly --exact +11-Apr-01 - 11-Apr-29 Expenses:Auto:Fees $13.00 $13.00 + Expenses:Cash $-13.00 0 + Expe:Computer:Internet $16.10 $16.10 + Expens:Computer:Movies $0.99 $17.09 + Expe:Computer:Software $4.99 $22.08 + Expenses:Movies $4.98 $27.06 + Expenses:Music $1.29 $28.35 + Expenses:Taxes:Sales $0.86 $29.21 +end test + +test reg -p "apr 2011" Expenses --weekly +11-Apr-01 - 11-Apr-02 Expe:Computer:Internet $16.10 $16.10 +11-Apr-03 - 11-Apr-09 Expenses:Auto:Fees $13.00 $29.10 + Expenses:Cash $-13.00 $16.10 + Expenses:Music $1.29 $17.39 + Expenses:Taxes:Sales $0.09 $17.48 +11-Apr-17 - 11-Apr-23 Expe:Computer:Software $4.99 $22.47 + Expenses:Taxes:Sales $0.35 $22.82 +11-Apr-24 - 11-Apr-30 Expens:Computer:Movies $0.99 $23.81 + Expenses:Movies $4.98 $28.79 + Expenses:Taxes:Sales $0.42 $29.21 +end test + +test reg -p "apr 2011" Expenses --weekly --exact +11-Apr-01 - 11-Apr-01 Expe:Computer:Internet $16.10 $16.10 +11-Apr-05 - 11-Apr-05 Expenses:Auto:Fees $13.00 $29.10 + Expenses:Cash $-13.00 $16.10 + Expenses:Music $1.29 $17.39 + Expenses:Taxes:Sales $0.09 $17.48 +11-Apr-19 - 11-Apr-19 Expe:Computer:Software $4.99 $22.47 + Expenses:Taxes:Sales $0.35 $22.82 +11-Apr-24 - 11-Apr-29 Expens:Computer:Movies $0.99 $23.81 + Expenses:Movies $4.98 $28.79 + Expenses:Taxes:Sales $0.42 $29.21 +end test + +test reg -p "apr 2011" Expenses --weekly --empty +11-Apr-01 - 11-Apr-02 Expe:Computer:Internet $16.10 $16.10 +11-Apr-03 - 11-Apr-09 Expenses:Auto:Fees $13.00 $29.10 + Expenses:Cash $-13.00 $16.10 + Expenses:Music $1.29 $17.39 + Expenses:Taxes:Sales $0.09 $17.48 +11-Apr-10 - 11-Apr-16 <None> 0 $17.48 +11-Apr-17 - 11-Apr-23 Expe:Computer:Software $4.99 $22.47 + Expenses:Taxes:Sales $0.35 $22.82 +11-Apr-24 - 11-Apr-30 Expens:Computer:Movies $0.99 $23.81 + Expenses:Movies $4.98 $28.79 + Expenses:Taxes:Sales $0.42 $29.21 +end test + +test reg -p "apr 2011" Expenses --weekly --empty --exact +11-Apr-01 - 11-Apr-01 Expe:Computer:Internet $16.10 $16.10 +11-Apr-05 - 11-Apr-05 Expenses:Auto:Fees $13.00 $29.10 + Expenses:Cash $-13.00 $16.10 + Expenses:Music $1.29 $17.39 + Expenses:Taxes:Sales $0.09 $17.48 +11-Apr-16 - 11-Apr-16 <None> 0 $17.48 +11-Apr-19 - 11-Apr-19 Expe:Computer:Software $4.99 $22.47 + Expenses:Taxes:Sales $0.35 $22.82 +11-Apr-24 - 11-Apr-29 Expens:Computer:Movies $0.99 $23.81 + Expenses:Movies $4.98 $28.79 + Expenses:Taxes:Sales $0.42 $29.21 +end test + +test reg -p "may 2011" +11-May-01 serveraxis.com Expe:Computer:Internet $15.00 $15.00 + Expe:Computer:Internet $1.10 $16.10 + Liabilities:MasterCard $-16.10 0 +11-May-18 iTunes Expe:Computer:Software $6.99 $6.99 + Expenses:Taxes:Sales $0.49 $7.48 + Liabilities:MasterCard $-7.48 0 +11-May-20 DynDNS.com Expe:Computer:Internet $15.00 $15.00 + Liabilities:MasterCard $-15.00 0 +11-May-20 DynDNS.com Expe:Computer:Internet $15.00 $15.00 + Liabilities:MasterCard $-15.00 0 +11-May-27 iTunes Expenses:Movies $1.99 $1.99 + Expenses:Movies $1.99 $3.98 + Expenses:Movies $1.99 $5.97 + Expenses:Taxes:Sales $0.42 $6.39 + Liabilities:MasterCard $-6.39 0 +11-May-26 Valero Expenses:Auto:Gas $26.79 $26.79 + Liabilities:MasterCard $-26.79 0 +11-May-26 Starbucks Expenses:Food $2.20 $2.20 + Expenses:Taxes:Sales $0.15 $2.35 + Liabilities:MasterCard $-2.35 0 +11-May-26 La Mex Expenses:Food $17.70 $17.70 + Expenses:Taxes:Sales $1.11 $18.81 + Expenses:Tips $3.00 $21.81 + Liabilities:MasterCard $-21.81 0 +11-May-27 Leaves N Beans Expenses:Food:Dining $20.98 $20.98 + Expenses:Taxes:Sales $1.63 $22.61 + Expenses:Tips $2.00 $24.61 + Liabilities:MasterCard $-24.61 0 +11-May-27 Wal*Mart Expenses:Home:Supplies $7.97 $7.97 + Expenses:Food:Grocery $3.25 $11.22 + Expenses:Food:Grocery $3.18 $14.40 + Expenses:Food:Grocery $3.18 $17.58 + Expenses:Food:Grocery $2.98 $20.56 + Expenses:Food:Grocery $1.98 $22.54 + Expenses:Food:Grocery $3.98 $26.52 + Expenses:Food:Grocery $3.58 $30.10 + Expenses:Food:Grocery $3.58 $33.68 + Expenses:Food:Grocery $1.58 $35.26 + Expenses:Food:Grocery $1.88 $37.14 + Expenses:Food:Grocery $2.50 $39.64 + Expenses:Food:Grocery $1.26 $40.90 + Expenses:Food:Grocery $2.62 $43.52 + Expenses:Food:Grocery $3.48 $47.00 + Expenses:Home:Supplies $1.37 $48.37 + Expenses:Home:Supplies $2.92 $51.29 + Expenses:Beauty $3.38 $54.67 + Expenses:Beauty $0.97 $55.64 + Expenses:Beauty $4.64 $60.28 + Expenses:Beauty $1.97 $62.25 + Expenses:Beauty $1.97 $64.22 + Expenses:Beauty $5.98 $70.20 + Expenses:Home:Supplies $9.98 $80.18 + Expenses:Bedding $4.00 $84.18 + Expenses:Bedding $4.00 $88.18 + Expenses:Home:Supplies $2.88 $91.06 + Expenses:Home:Supplies $2.88 $93.94 + Expenses:Home:Supplies $2.88 $96.82 + Expenses:Home:Supplies $2.88 $99.70 + Expenses:Clothing $2.96 $102.66 + Expenses:Supplies $0.84 $103.50 + Expenses:Food:Grocery $1.38 $104.88 + Expenses:Food:Grocery $1.38 $106.26 + Expenses:Food:Grocery $2.32 $108.58 + Expenses:Food:Grocery $2.00 $110.58 + Expenses:Food:Grocery $2.98 $113.56 + Expenses:Food:Grocery $3.00 $116.56 + Expenses:Food:Grocery $2.14 $118.70 + Expenses:Food:Grocery $2.14 $120.84 + Expenses:Food:Grocery $2.50 $123.34 + Expenses:Food:Grocery $2.50 $125.84 + Expenses:Food:Grocery $3.48 $129.32 + Expenses:Home:Supplies $1.17 $130.49 + Expenses:Supplies $3.00 $133.49 + Expenses:Bedding $34.88 $168.37 + Expenses:Home $6.00 $174.37 + Expenses:Home $6.00 $180.37 + Expenses:Home:Supplies $3.97 $184.34 + Expenses:Food:Grocery $0.78 $185.12 + Expenses:Food:Grocery $0.78 $185.90 + Expenses:Food:Grocery $0.78 $186.68 + Expenses:Food:Grocery $0.78 $187.46 + Expenses:Home $4.00 $191.46 + Expenses:Home $4.00 $195.46 + Expenses:Home $10.87 $206.33 + Expenses:Home $4.00 $210.33 + Expenses:Bedding $65.96 $276.29 + Expenses:Taxes:Sales $16.89 $293.18 + Expenses:Taxes:Sales $0.65 $293.83 + Liabilities:MasterCard $-293.83 0 +11-May-27 Asia Grill Expenses:Food:Dining $28.63 $28.63 + Expenses:Tips $4.00 $32.63 + Liabilities:MasterCard $-32.63 0 +11-May-28 Shell Expenses:Auto:Gas $43.41 $43.41 + Liabilities:MasterCard $-43.41 0 +11-May-28 Sears Expenses:Home $1,728.96 $1,728.96 + Expenses:Taxes:Sales $136.87 $1,865.83 + Liabilities:MasterCard $-1,865.83 0 +11-May-28 Sears Expenses:Home $99.61 $99.61 + Expenses:Taxes:Sales $8.22 $107.83 + Liabilities:MasterCard $-107.83 0 +11-May-28 Buffalo Wild Wings Expenses:Food:Dining $22.98 $22.98 + Expenses:Tips $2.35 $25.33 + Expenses:Taxes:Sales $3.50 $28.83 + Liabilities:MasterCard $-28.83 0 +11-May-28 Cold Stone Creamery Expenses:Food:Dining $5.73 $5.73 + Expenses:Tips $0.50 $6.23 + Liabilities:MasterCard $-6.23 0 +11-May-29 Hy Vee Expenses:Supplies $2.00 $2.00 + Expenses:Supplies $7.99 $9.99 + Expenses:Supplies $7.99 $17.98 + Expenses:Food:Grocery $157.64 $175.62 + Expenses:Taxes:Sales $5.74 $181.36 + Liabilities:MasterCard $-181.36 0 +11-May-30 Allied movers, Fide.. Expenses:Tips $97.00 $97.00 + Expenses:Cash $-97.00 0 +11-May-30 Starbucks Expenses:Food:Dining $6.90 $6.90 + Expenses:Taxes:Sales $0.71 $7.61 + Liabilities:MasterCard $-7.61 0 +11-May-31 Wal*Mart Expenses:Home $108.13 $108.13 + Expenses:Taxes:Sales $8.65 $116.78 + Liabilities:MasterCard $-116.78 0 +end test + +test reg -p "may 2011" --monthly +11-May-01 - 11-May-31 Expenses:Auto:Gas $70.20 $70.20 + Expenses:Beauty $18.91 $89.11 + Expenses:Bedding $108.84 $197.95 + Expenses:Cash $-97.00 $100.95 + Expenses:Clothing $2.96 $103.91 + Expe:Computer:Internet $46.10 $150.01 + Expe:Computer:Software $6.99 $157.00 + Expenses:Food $19.90 $176.90 + Expenses:Food:Dining $85.22 $262.12 + Expenses:Food:Grocery $225.61 $487.73 + Expenses:Home $1,971.57 $2,459.30 + Expenses:Home:Supplies $38.90 $2,498.20 + Expenses:Movies $5.97 $2,504.17 + Expenses:Supplies $21.82 $2,525.99 + Expenses:Taxes:Sales $185.03 $2,711.02 + Expenses:Tips $108.85 $2,819.87 + Liabilities:MasterCard $-2,819.87 0 +end test + +test reg -p "may 2011" --weekly +11-May-01 - 11-May-07 Expe:Computer:Internet $16.10 $16.10 + Liabilities:MasterCard $-16.10 0 +11-May-15 - 11-May-21 Expe:Computer:Internet $30.00 $30.00 + Expe:Computer:Software $6.99 $36.99 + Expenses:Taxes:Sales $0.49 $37.48 + Liabilities:MasterCard $-37.48 0 +11-May-22 - 11-May-28 Expenses:Auto:Gas $70.20 $70.20 + Expenses:Beauty $18.91 $89.11 + Expenses:Bedding $108.84 $197.95 + Expenses:Clothing $2.96 $200.91 + Expenses:Food $19.90 $220.81 + Expenses:Food:Dining $78.32 $299.13 + Expenses:Food:Grocery $67.97 $367.10 + Expenses:Home $1,863.44 $2,230.54 + Expenses:Home:Supplies $38.90 $2,269.44 + Expenses:Movies $5.97 $2,275.41 + Expenses:Supplies $3.84 $2,279.25 + Expenses:Taxes:Sales $169.44 $2,448.69 + Expenses:Tips $11.85 $2,460.54 + Liabilities:MasterCard $-2,460.54 0 +11-May-29 - 11-May-31 Expenses:Cash $-97.00 $-97.00 + Expenses:Food:Dining $6.90 $-90.10 + Expenses:Food:Grocery $157.64 $67.54 + Expenses:Home $108.13 $175.67 + Expenses:Supplies $17.98 $193.65 + Expenses:Taxes:Sales $15.10 $208.75 + Expenses:Tips $97.00 $305.75 + Liabilities:MasterCard $-305.75 0 +end test + +test reg -p "may 2011" --weekly --exact +11-May-01 - 11-May-01 Expe:Computer:Internet $16.10 $16.10 + Liabilities:MasterCard $-16.10 0 +11-May-18 - 11-May-20 Expe:Computer:Internet $30.00 $30.00 + Expe:Computer:Software $6.99 $36.99 + Expenses:Taxes:Sales $0.49 $37.48 + Liabilities:MasterCard $-37.48 0 +11-May-26 - 11-May-28 Expenses:Auto:Gas $70.20 $70.20 + Expenses:Beauty $18.91 $89.11 + Expenses:Bedding $108.84 $197.95 + Expenses:Clothing $2.96 $200.91 + Expenses:Food $19.90 $220.81 + Expenses:Food:Dining $78.32 $299.13 + Expenses:Food:Grocery $67.97 $367.10 + Expenses:Home $1,863.44 $2,230.54 + Expenses:Home:Supplies $38.90 $2,269.44 + Expenses:Movies $5.97 $2,275.41 + Expenses:Supplies $3.84 $2,279.25 + Expenses:Taxes:Sales $169.44 $2,448.69 + Expenses:Tips $11.85 $2,460.54 + Liabilities:MasterCard $-2,460.54 0 +11-May-29 - 11-May-31 Expenses:Cash $-97.00 $-97.00 + Expenses:Food:Dining $6.90 $-90.10 + Expenses:Food:Grocery $157.64 $67.54 + Expenses:Home $108.13 $175.67 + Expenses:Supplies $17.98 $193.65 + Expenses:Taxes:Sales $15.10 $208.75 + Expenses:Tips $97.00 $305.75 + Liabilities:MasterCard $-305.75 0 +end test + +test reg -p "may 2011" --weekly --empty +11-May-01 - 11-May-07 Expe:Computer:Internet $16.10 $16.10 + Liabilities:MasterCard $-16.10 0 +11-May-08 - 11-May-14 <None> 0 0 +11-May-15 - 11-May-21 Expe:Computer:Internet $30.00 $30.00 + Expe:Computer:Software $6.99 $36.99 + Expenses:Taxes:Sales $0.49 $37.48 + Liabilities:MasterCard $-37.48 0 +11-May-22 - 11-May-28 Expenses:Auto:Gas $70.20 $70.20 + Expenses:Beauty $18.91 $89.11 + Expenses:Bedding $108.84 $197.95 + Expenses:Clothing $2.96 $200.91 + Expenses:Food $19.90 $220.81 + Expenses:Food:Dining $78.32 $299.13 + Expenses:Food:Grocery $67.97 $367.10 + Expenses:Home $1,863.44 $2,230.54 + Expenses:Home:Supplies $38.90 $2,269.44 + Expenses:Movies $5.97 $2,275.41 + Expenses:Supplies $3.84 $2,279.25 + Expenses:Taxes:Sales $169.44 $2,448.69 + Expenses:Tips $11.85 $2,460.54 + Liabilities:MasterCard $-2,460.54 0 +11-May-29 - 11-May-31 Expenses:Cash $-97.00 $-97.00 + Expenses:Food:Dining $6.90 $-90.10 + Expenses:Food:Grocery $157.64 $67.54 + Expenses:Home $108.13 $175.67 + Expenses:Supplies $17.98 $193.65 + Expenses:Taxes:Sales $15.10 $208.75 + Expenses:Tips $97.00 $305.75 + Liabilities:MasterCard $-305.75 0 +end test + +test reg -p "may 2011" --weekly --empty --exact +11-May-01 - 11-May-01 Expe:Computer:Internet $16.10 $16.10 + Liabilities:MasterCard $-16.10 0 +11-May-14 - 11-May-14 <None> 0 0 +11-May-18 - 11-May-20 Expe:Computer:Internet $30.00 $30.00 + Expe:Computer:Software $6.99 $36.99 + Expenses:Taxes:Sales $0.49 $37.48 + Liabilities:MasterCard $-37.48 0 +11-May-26 - 11-May-28 Expenses:Auto:Gas $70.20 $70.20 + Expenses:Beauty $18.91 $89.11 + Expenses:Bedding $108.84 $197.95 + Expenses:Clothing $2.96 $200.91 + Expenses:Food $19.90 $220.81 + Expenses:Food:Dining $78.32 $299.13 + Expenses:Food:Grocery $67.97 $367.10 + Expenses:Home $1,863.44 $2,230.54 + Expenses:Home:Supplies $38.90 $2,269.44 + Expenses:Movies $5.97 $2,275.41 + Expenses:Supplies $3.84 $2,279.25 + Expenses:Taxes:Sales $169.44 $2,448.69 + Expenses:Tips $11.85 $2,460.54 + Liabilities:MasterCard $-2,460.54 0 +11-May-29 - 11-May-31 Expenses:Cash $-97.00 $-97.00 + Expenses:Food:Dining $6.90 $-90.10 + Expenses:Food:Grocery $157.64 $67.54 + Expenses:Home $108.13 $175.67 + Expenses:Supplies $17.98 $193.65 + Expenses:Taxes:Sales $15.10 $208.75 + Expenses:Tips $97.00 $305.75 + Liabilities:MasterCard $-305.75 0 +end test diff --git a/test/regress/F524E251.test b/test/regress/F524E251.test new file mode 100644 index 00000000..d2d2f049 --- /dev/null +++ b/test/regress/F524E251.test @@ -0,0 +1,37 @@ +; Test for: ledger -f doc/sample.dat -n reg' shows $0.00 on first post + += /^Expenses:Books/ + (Liabilities:Taxes) -0.10 + +~ Monthly + Assets:Bank:Checking $500.00 + Income:Salary + +2004/05/01 * Checking balance + Assets:Bank:Checking $1,000.00 + Equity:Opening Balances + +2004/05/01 * Investment balance + Assets:Brokerage 50 AAPL @ $30.00 + Equity:Opening Balances + +2004/05/14 * Pay day + Assets:Bank:Checking $500.00 + Income:Salary + +2004/05/27 Book Store + Expenses:Books $20.00 + Liabilities:MasterCard + +2004/05/27 (100) Credit card company + Liabilities:MasterCard $20.00 + Assets:Bank:Checking + +test -n reg +04-May-01 Investment balance <Total> $-1,500.00 + 50 AAPL $-1,500.00 + 50 AAPL +04-May-27 Book Store <Total> $-2.00 $-1,502.00 + 50 AAPL +end test + diff --git a/test/regress/FCE11C8D.test b/test/regress/FCE11C8D.test new file mode 100644 index 00000000..595edc2d --- /dev/null +++ b/test/regress/FCE11C8D.test @@ -0,0 +1,7 @@ +2012-03-17 Payee + Expenses:Food $20 + Assets:Cash + +test reg --monthly --invert exp +12-Mar-01 - 12-Mar-31 Expenses:Food $-20 $-20 +end test diff --git a/test/regress/FDFBA165.test b/test/regress/FDFBA165.test new file mode 100644 index 00000000..55074bed --- /dev/null +++ b/test/regress/FDFBA165.test @@ -0,0 +1,23 @@ +; Test for: automated transactions didn't show up in the balance report + += Income:Clients: + (Liabilities:Taxes:VAT) ((1,00 / 1,19) * 0,19) + +2009/07/27 * Invoice + Assets:Bank:Checking €1.190,00 + Income:Clients:ACME_Inc + +test --decimal-comma bal + €1.190,00 Assets:Bank:Checking + €-1.190,00 Income:Clients:ACME_Inc + €-190,00 Liabilities:Taxes:VAT +-------------------- + €-190,00 +end test + +test --decimal-comma reg +09-Jul-27 Invoice Assets:Bank:Checking €1.190,00 €1.190,00 + Incom:Clients:ACME_Inc €-1.190,00 0 + (Liabilitie:Taxes:VAT) €-190,00 €-190,00 +end test + diff --git a/test/unit/t_commodity.cc b/test/unit/t_commodity.cc index dc64dcfb..8caeb694 100644 --- a/test/unit/t_commodity.cc +++ b/test/unit/t_commodity.cc @@ -92,18 +92,18 @@ BOOST_AUTO_TEST_CASE(testPriceHistory) BOOST_CHECK_EQUAL(string("$2124.122"), amt->to_fullstring()); #endif - amt = x1.value(CURRENT_TIME(), euro); + amt = x1.value(CURRENT_TIME(), &euro); BOOST_CHECK(amt); - BOOST_CHECK_EQUAL(string("EUR 1366.87"), amt->rounded().to_string()); + BOOST_CHECK_EQUAL(string("EUR 1787.50"), amt->rounded().to_string()); // Add a newer Euro pricing aapl.add_price(jan17_07, amount_t("EUR 23.00")); - amt = x1.value(CURRENT_TIME(), euro); + amt = x1.value(CURRENT_TIME(), &euro); BOOST_CHECK(amt); BOOST_CHECK_EQUAL(string("EUR 2302.30"), amt->to_string()); - amt = x1.value(CURRENT_TIME(), cad); + amt = x1.value(CURRENT_TIME(), &cad); BOOST_CHECK(amt); BOOST_CHECK_EQUAL(string("CAD 3223.22"), amt->to_string()); #endif // NOT_FOR_PYTHON diff --git a/test/unit/t_expr.cc b/test/unit/t_expr.cc index f882f3a1..c10ee029 100644 --- a/test/unit/t_expr.cc +++ b/test/unit/t_expr.cc @@ -1,5 +1,5 @@ #define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE expr +//#define BOOST_TEST_MODULE expr #include <boost/test/unit_test.hpp> #include <system.hh> |