From 46a419a5dabcc6b02231f12357b20f70a14cfe63 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 1 Nov 2009 21:18:09 -0500 Subject: Added DocTests to verify documentation examples --- test/doc/transaction-codes-1.test | 22 ++++++++++++++++++++++ test/doc/transaction-codes-2.test | 24 ++++++++++++++++++++++++ test/doc/transaction-notes-1.test | 24 ++++++++++++++++++++++++ test/doc/transaction-notes-2.test | 23 +++++++++++++++++++++++ test/doc/transaction-notes-3.test | 23 +++++++++++++++++++++++ test/doc/transaction-notes-4.test | 27 +++++++++++++++++++++++++++ test/doc/transaction-status-1.test | 19 +++++++++++++++++++ test/doc/transaction-status-2.test | 17 +++++++++++++++++ test/doc/transaction-status-3.test | 18 ++++++++++++++++++ test/doc/transaction-status-4.test | 17 +++++++++++++++++ 10 files changed, 214 insertions(+) create mode 100644 test/doc/transaction-codes-1.test create mode 100644 test/doc/transaction-codes-2.test create mode 100644 test/doc/transaction-notes-1.test create mode 100644 test/doc/transaction-notes-2.test create mode 100644 test/doc/transaction-notes-3.test create mode 100644 test/doc/transaction-notes-4.test create mode 100644 test/doc/transaction-status-1.test create mode 100644 test/doc/transaction-status-2.test create mode 100644 test/doc/transaction-status-3.test create mode 100644 test/doc/transaction-status-4.test (limited to 'test') diff --git a/test/doc/transaction-codes-1.test b/test/doc/transaction-codes-1.test new file mode 100644 index 00000000..878c5cac --- /dev/null +++ b/test/doc/transaction-codes-1.test @@ -0,0 +1,22 @@ +reg --columns=60 food and code xfer +<<< +2009/10/29 (XFER) Panera Bread + Expenses:Food $4.50 + Assets:Checking + +2009/10/30 (DEP) Pay day! + Assets:Checking $20.00 + Income + +2009/10/30 (XFER) Panera Bread + Expenses:Food $4.50 + Assets:Checking + +2009/10/31 (559385768438A8D7) Panera Bread + Expenses:Food $4.50 + Liabilities:Credit Card +>>>1 +09-Oct-29 Panera Bread Expenses:Food $4.50 $4.50 +09-Oct-30 Panera Bread Expenses:Food $4.50 $9.00 +>>>2 +=== 0 diff --git a/test/doc/transaction-codes-2.test b/test/doc/transaction-codes-2.test new file mode 100644 index 00000000..4e4c76cf --- /dev/null +++ b/test/doc/transaction-codes-2.test @@ -0,0 +1,24 @@ +bal checking --set-reported-account=code +<<< +2009/10/29 (XFER) Panera Bread + Expenses:Food $4.50 + Assets:Checking + +2009/10/30 (DEP) Pay day! + Assets:Checking $20.00 + Income + +2009/10/30 (XFER) Panera Bread + Expenses:Food $4.50 + Assets:Checking + +2009/10/31 (559385768438A8D7) Panera Bread + Expenses:Food $4.50 + Liabilities:Credit Card +>>>1 + $20.00 DEP + $-9.00 XFER +-------------------- + $11.00 +>>>2 +=== 0 diff --git a/test/doc/transaction-notes-1.test b/test/doc/transaction-notes-1.test new file mode 100644 index 00000000..d3fab3b6 --- /dev/null +++ b/test/doc/transaction-notes-1.test @@ -0,0 +1,24 @@ +reg --columns=60 food and note eat +<<< +2009/11/01 Panera Bread ; Got something to eat + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Coffee + ; Let’s see, I ate a whole bunch of stuff, drank some coffee, + ; pondered a bagel, then decided against the donut. + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Dining + ; :Eating: + ; This is another long note, after the metadata. + Expenses:Food $4.50 + Assets:Checking +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-01 Panera Bread Expenses:Food $4.50 $9.00 +>>>2 +=== 0 diff --git a/test/doc/transaction-notes-2.test b/test/doc/transaction-notes-2.test new file mode 100644 index 00000000..b7a258e0 --- /dev/null +++ b/test/doc/transaction-notes-2.test @@ -0,0 +1,23 @@ +reg --columns=60 food and tag eating +<<< +2009/11/01 Panera Bread ; Got something to eat + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Coffee + ; Let’s see, I ate a whole bunch of stuff, drank some coffee, + ; pondered a bagel, then decided against the donut. + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Dining + ; :Eating: + ; This is another long note, after the metadata. + Expenses:Food $4.50 + Assets:Checking +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +>>>2 +=== 0 diff --git a/test/doc/transaction-notes-3.test b/test/doc/transaction-notes-3.test new file mode 100644 index 00000000..9d532d5f --- /dev/null +++ b/test/doc/transaction-notes-3.test @@ -0,0 +1,23 @@ +reg --columns=60 food and tag type=dining +<<< +2009/11/01 Panera Bread ; Got something to eat + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Coffee + ; Let’s see, I ate a whole bunch of stuff, drank some coffee, + ; pondered a bagel, then decided against the donut. + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Dining + ; :Eating: + ; This is another long note, after the metadata. + Expenses:Food $4.50 + Assets:Checking +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +>>>2 +=== 0 diff --git a/test/doc/transaction-notes-4.test b/test/doc/transaction-notes-4.test new file mode 100644 index 00000000..516094c7 --- /dev/null +++ b/test/doc/transaction-notes-4.test @@ -0,0 +1,27 @@ +bal food and tag type --set-reported-account='"Tags:" + tag("Type")' +<<< +2009/11/01 Panera Bread ; Got something to eat + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Coffee + ; Let’s see, I ate a whole bunch of stuff, drank some coffee, + ; pondered a bagel, then decided against the donut. + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Dining + ; :Eating: + ; This is another long note, after the metadata. + Expenses:Food $4.50 + Assets:Checking +>>>1 + $9.00 Tags + $4.50 Coffee + $4.50 Dining +-------------------- + $9.00 +>>>2 +=== 0 diff --git a/test/doc/transaction-status-1.test b/test/doc/transaction-status-1.test new file mode 100644 index 00000000..4bdf893a --- /dev/null +++ b/test/doc/transaction-status-1.test @@ -0,0 +1,19 @@ +reg --columns=60 food +<<< +2009/10/31 * Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/01 ! Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/02 Panera Bread + Expenses:Food $4.50 + Assets +>>>1 +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 +>>>2 +=== 0 diff --git a/test/doc/transaction-status-2.test b/test/doc/transaction-status-2.test new file mode 100644 index 00000000..dbbb04ae --- /dev/null +++ b/test/doc/transaction-status-2.test @@ -0,0 +1,17 @@ +reg --columns=60 food --cleared +<<< +2009/10/31 * Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/01 ! Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/02 Panera Bread + Expenses:Food $4.50 + Assets +>>>1 +09-Oct-31 Panera Bread Expenses:Food $4.50 $4.50 +>>>2 +=== 0 diff --git a/test/doc/transaction-status-3.test b/test/doc/transaction-status-3.test new file mode 100644 index 00000000..1e6467ef --- /dev/null +++ b/test/doc/transaction-status-3.test @@ -0,0 +1,18 @@ +reg --columns=60 food --uncleared +<<< +2009/10/31 * Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/01 ! Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/02 Panera Bread + Expenses:Food $4.50 + Assets +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-02 Panera Bread Expenses:Food $4.50 $9.00 +>>>2 +=== 0 diff --git a/test/doc/transaction-status-4.test b/test/doc/transaction-status-4.test new file mode 100644 index 00000000..5275eec3 --- /dev/null +++ b/test/doc/transaction-status-4.test @@ -0,0 +1,17 @@ +reg --columns=60 food --pending +<<< +2009/10/31 * Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/01 ! Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/02 Panera Bread + Expenses:Food $4.50 + Assets +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +>>>2 +=== 0 -- cgit v1.2.3 From 307b63be77f932ce7cf9685be261f1c3786ea719 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 2 Nov 2009 00:32:34 -0500 Subject: Fixed baseline tests relating to earlier changes --- test/baseline/opt-anon.test | 4 ++-- test/regress/F559EC12.test | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/baseline/opt-anon.test b/test/baseline/opt-anon.test index f9244451..6fe6b75f 100644 --- a/test/baseline/opt-anon.test +++ b/test/baseline/opt-anon.test @@ -4,8 +4,8 @@ reg --anon Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 Income:Dividends:Vanguard:VMMXX $-0.35 >>>1 -07-Feb-02 6a93dcb3 20:5d:27:988a9c3a 0.350 VMMXX 0.350 VMMXX - 1c:b6:27:988a9c3a $-0.35 $-0.35 +07-Feb-02 6a93dcb3 da:20:5d:27:988a9c3a 0.350 VMMXX 0.350 VMMXX + da:1c:b6:27:988a9c3a $-0.35 $-0.35 0.350 VMMXX >>>2 === 0 diff --git a/test/regress/F559EC12.test b/test/regress/F559EC12.test index 7900b60d..c8b686db 100644 --- a/test/regress/F559EC12.test +++ b/test/regress/F559EC12.test @@ -3,7 +3,11 @@ format "%-12(scrub(amount))" >>>1 --- Context is first posting of the following transaction --- 2004/05/27 Book Store + ; This note applies to all postings. :SecondTag: Expenses:Books 20 BOOK @ $10 + ; Metadata: Some Value + ; :ExampleTag: + ; Here follows a note describing the posting. Liabilities:MasterCard $-200.00 --- Input format string --- @@ -20,7 +24,11 @@ format "%12(scrub(amount))" >>>1 --- Context is first posting of the following transaction --- 2004/05/27 Book Store + ; This note applies to all postings. :SecondTag: Expenses:Books 20 BOOK @ $10 + ; Metadata: Some Value + ; :ExampleTag: + ; Here follows a note describing the posting. Liabilities:MasterCard $-200.00 --- Input format string --- -- cgit v1.2.3 From 95e08cc46fb499866f2491b4a8aad9fe29ac6a00 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 2 Nov 2009 00:45:39 -0500 Subject: Make the source directory available to all tests --- test/ConfirmTests.py | 2 +- test/GenerateTests.py | 6 +++--- test/LedgerHarness.py | 25 +++++++++++++++---------- test/RegressTests.py | 10 +++++++--- tools/Makefile.am | 10 +++++----- 5 files changed, 31 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/ConfirmTests.py b/test/ConfirmTests.py index 0b3d4897..901ae7cd 100755 --- a/test/ConfirmTests.py +++ b/test/ConfirmTests.py @@ -10,7 +10,7 @@ import re from LedgerHarness import LedgerHarness harness = LedgerHarness(sys.argv) -tests = sys.argv[2] +tests = sys.argv[3] if not os.path.isdir(tests) and not os.path.isfile(tests): sys.exit(1) diff --git a/test/GenerateTests.py b/test/GenerateTests.py index aa36737d..d60e0581 100755 --- a/test/GenerateTests.py +++ b/test/GenerateTests.py @@ -104,9 +104,9 @@ def generation_test(seed): beg_range = 1 end_range = 20 -if len(sys.argv) > 3: - beg_range = int(sys.argv[2]) - end_range = int(sys.argv[3]) +if len(sys.argv) > 4: + beg_range = int(sys.argv[3]) + end_range = int(sys.argv[4]) for i in range(beg_range, end_range): if generation_test(i): diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py index cf65f590..7e8cfa3d 100755 --- a/test/LedgerHarness.py +++ b/test/LedgerHarness.py @@ -7,22 +7,27 @@ import re from subprocess import Popen, PIPE class LedgerHarness: - ledger = None - succeeded = 0 - failed = 0 - verify = False - gmalloc = False + ledger = None + sourcepath = None + succeeded = 0 + failed = 0 + verify = False + gmalloc = False def __init__(self, argv): if not os.path.isfile(argv[1]): print "Cannot find ledger at '%s'" % argv[1] sys.exit(1) + if not os.path.isdir(argv[2]): + print "Cannot find source path at '%s'" % argv[2] + sys.exit(1) - self.ledger = argv[1] - self.succeeded = 0 - self.failed = 0 - self.verify = '--verify' in argv - self.gmalloc = '--gmalloc' in argv + self.ledger = argv[1] + self.sourcepath = argv[2] + self.succeeded = 0 + self.failed = 0 + self.verify = '--verify' in argv + self.gmalloc = '--gmalloc' in argv def run(self, command, verify=None, gmalloc=None, columns=True): env = os.environ.copy() diff --git a/test/RegressTests.py b/test/RegressTests.py index 4d23f6b5..13a0a113 100755 --- a/test/RegressTests.py +++ b/test/RegressTests.py @@ -11,7 +11,7 @@ from difflib import unified_diff from LedgerHarness import LedgerHarness harness = LedgerHarness(sys.argv) -tests = sys.argv[2] +tests = sys.argv[3] if not os.path.isdir(tests) and not os.path.isfile(tests): sys.exit(1) @@ -27,11 +27,15 @@ class RegressFile: line == ">>>2\n" or \ line.startswith("===") + def transform_line(self, line): + line = re.sub('\$sourcepath', harness.sourcepath, line) + return line + def read_section(self): lines = [] line = self.fd.readline() while not self.is_directive(line): - lines.append(line) + lines.append(self.transform_line(line)) line = self.fd.readline() return (lines, line) @@ -60,7 +64,7 @@ class RegressFile: test['exitcode'] = int(match.group(1)) return test else: - test['command'] = line + test['command'] = self.transform_line(line) line = self.fd.readline() return None diff --git a/tools/Makefile.am b/tools/Makefile.am index d84229f4..4662e73d 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -370,7 +370,7 @@ RegressTests_SOURCES = test/RegressTests.py EXTRA_DIST += test/regress test/convert.py test/LedgerHarness.py RegressTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir)/test/regress \"\$$@\"" > $@ + echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/regress \"\$$@\"" > $@ chmod 755 $@ BaselineTests_SOURCES = test/RegressTests.py @@ -378,7 +378,7 @@ BaselineTests_SOURCES = test/RegressTests.py EXTRA_DIST += test/baseline BaselineTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir)/test/baseline \"\$$@\"" > $@ + echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/baseline \"\$$@\"" > $@ chmod 755 $@ DocTests_SOURCES = test/RegressTests.py @@ -386,7 +386,7 @@ DocTests_SOURCES = test/RegressTests.py EXTRA_DIST += test/doc DocTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir)/test/doc \"\$$@\"" > $@ + echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/doc \"\$$@\"" > $@ chmod 755 $@ ConfirmTests_SOURCES = test/ConfirmTests.py @@ -401,13 +401,13 @@ test/input/mondo.dat: test/input/standard.dat done ConfirmTests: $(srcdir)/test/ConfirmTests.py - echo "$(PYTHON) $(srcdir)/test/ConfirmTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir)/test/input \"\$$@\"" > $@ + echo "$(PYTHON) $(srcdir)/test/ConfirmTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/input \"\$$@\"" > $@ chmod 755 $@ GenerateTests_SOURCES = test/GenerateTests.py GenerateTests: $(srcdir)/test/GenerateTests.py - echo "$(PYTHON) $(srcdir)/test/GenerateTests.py $(top_builddir)/ledger$(EXEEXT) 1 20 \"\$$@\"" > $@ + echo "$(PYTHON) $(srcdir)/test/GenerateTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) 1 20 \"\$$@\"" > $@ chmod 755 $@ FULLCHECK=$(srcdir)/test/fullcheck.sh -- cgit v1.2.3 From 4db60bb46429ced93770afe69b42477c03c47e72 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 2 Nov 2009 01:21:45 -0500 Subject: Added several new regression tests --- test/regress/25A099C9.test | 19 +++++++ test/regress/373540CC.test | 9 ++++ test/regress/5F1BAF17.test | 130 +++++++++++++++++++++++++++++++++++++++++++++ test/regress/8254755E.test | 20 +++++++ 4 files changed, 178 insertions(+) create mode 100644 test/regress/25A099C9.test create mode 100644 test/regress/373540CC.test create mode 100644 test/regress/5F1BAF17.test create mode 100644 test/regress/8254755E.test (limited to 'test') diff --git a/test/regress/25A099C9.test b/test/regress/25A099C9.test new file mode 100644 index 00000000..fb5613e2 --- /dev/null +++ b/test/regress/25A099C9.test @@ -0,0 +1,19 @@ +-f $sourcepath/src/amount.h reg +<<< +>>>1 +>>>2 +While parsing file "$sourcepath/src/amount.h", line 67: +Error: No quantity specified for amount +While parsing file "$sourcepath/src/amount.h", line 707: +Error: Invalid date/time: line amount_t amoun +While parsing file "$sourcepath/src/amount.h", line 713: +Error: Invalid date/time: line string amount_ +While parsing file "$sourcepath/src/amount.h", line 719: +Error: Invalid date/time: line string amount_ +While parsing file "$sourcepath/src/amount.h", line 725: +Error: Invalid date/time: line string amount_ +While parsing file "$sourcepath/src/amount.h", line 731: +Error: Invalid date/time: line std::ostream& +While parsing file "$sourcepath/src/amount.h", line 738: +Error: Invalid date/time: line std::istream& +=== 7 diff --git a/test/regress/373540CC.test b/test/regress/373540CC.test new file mode 100644 index 00000000..5c589ec9 --- /dev/null +++ b/test/regress/373540CC.test @@ -0,0 +1,9 @@ +bal --sort total --flat -X '$' not '(Income|Liabilities)' +<<< +2004/05/27 Book Store + Expenses:Books 20 BOOK @ $10 + Liabilities:MasterCard $-200.00 +>>>1 + $200.00 Expenses:Books +>>>2 +=== 0 diff --git a/test/regress/5F1BAF17.test b/test/regress/5F1BAF17.test new file mode 100644 index 00000000..f52ffb86 --- /dev/null +++ b/test/regress/5F1BAF17.test @@ -0,0 +1,130 @@ +bal da39 --flat --sort amount --display-total amount +<<< +2006/02/16 b5f40e96 + da39a3ee:8d437dbf:ee2bf9bd:f61e33bf $713.35 + Assets + +2006/03/27 c7ab1f2d + da39a3ee:8d437dbf:ee2bf9bd:9b69a35a $139.62 + Assets + +2006/03/30 f32ea1dc + da39a3ee:8d437dbf:ee2bf9bd:d219c681 $1,600.00 + Assets + +2006/04/21 d449d51e + da39a3ee:8d437dbf:ee2bf9bd:75b04b88 $698.10 + Assets + +2006/05/02 b02f8323 + da39a3ee:8d437dbf:ee2bf9bd $42.22 + Assets + +2006/05/05 2a6f6850 + da39a3ee:8d437dbf:ee2bf9bd:75b04b88:b3850e04 $2,468.00 + Assets + +2006/05/09 59f92263 + da39a3ee:8d437dbf:ee2bf9bd:071c929a $132.82 + Assets + +2006/05/18 f78a7a51 + da39a3ee:8d437dbf:ee2bf9bd:e97de844 $368.05 + Assets + +2006/05/19 f35c594c + da39a3ee:8d437dbf:ee2bf9bd:d4e7d7d3 $386.62 + Assets + +2006/05/22 0233a991 + da39a3ee:8d437dbf:ee2bf9bd:9c6e5a3f $141.98 + Assets + +2006/05/23 56ccae7f + da39a3ee:8d437dbf:ee2bf9bd:d31d367b $81.78 + Assets + +2006/05/24 d449d51e + da39a3ee:8d437dbf:ee2bf9bd:75b04b88 $65.00 + Assets + +2006/05/25 dc833c91 + da39a3ee:8d437dbf:ee2bf9bd:d31d367b $34.37 + Assets + +2006/05/31 6822b496 + da39a3ee:8d437dbf:ee2bf9bd:e97de844 $41.78 + Assets + +2006/06/02 dff8ccb2 + da39a3ee:8d437dbf:ee2bf9bd:14e351e1 $67.36 + Assets + +2006/06/02 e1eb3f4b + da39a3ee:8d437dbf:ee2bf9bd:2c7a078f $14.00 + Assets + +2006/06/04 feec73ea + da39a3ee:8d437dbf:ee2bf9bd:131260cb $144.99 + Assets + +2006/06/04 e8f65e0a + da39a3ee:8d437dbf:ee2bf9bd:d219c681 $75.00 + Assets + +2006/06/04 3fd43f7b + da39a3ee:8d437dbf:ee2bf9bd:9c4ba7d0 $239.59 + Assets + +2006/06/06 754be754 + da39a3ee:8d437dbf:ee2bf9bd:35b25929 $1,160.14 + Assets + +2006/06/06 00c16d44 + da39a3ee:8d437dbf:ee2bf9bd:e97de844 $78.45 + Assets + +2006/06/08 e7b0b317 + da39a3ee:8d437dbf:ee2bf9bd $443.00 + Assets + +2006/07/17 a30c4c31 + da39a3ee:8d437dbf:ee2bf9bd $880.80 + Assets + +2006/08/08 e31a0cf9 + da39a3ee:8d437dbf:ee2bf9bd $104.53 + Assets + +2006/08/10 f0c0c688 + da39a3ee:8d437dbf:ee2bf9bd $196.70 + Assets + +2006/09/12 1bc59c63 + da39a3ee:8d437dbf:ee2bf9bd $217.79 + Assets + +2007/07/16 557e3a00 + da39a3ee:8d437dbf:ee2bf9bd:f61e33bf $117.80 + Assets +>>>1 + $14.00 da39a3ee:8d437dbf:ee2bf9bd:2c7a078f + $67.36 da39a3ee:8d437dbf:ee2bf9bd:14e351e1 + $116.15 da39a3ee:8d437dbf:ee2bf9bd:d31d367b + $132.82 da39a3ee:8d437dbf:ee2bf9bd:071c929a + $139.62 da39a3ee:8d437dbf:ee2bf9bd:9b69a35a + $141.98 da39a3ee:8d437dbf:ee2bf9bd:9c6e5a3f + $144.99 da39a3ee:8d437dbf:ee2bf9bd:131260cb + $239.59 da39a3ee:8d437dbf:ee2bf9bd:9c4ba7d0 + $386.62 da39a3ee:8d437dbf:ee2bf9bd:d4e7d7d3 + $488.28 da39a3ee:8d437dbf:ee2bf9bd:e97de844 + $763.10 da39a3ee:8d437dbf:ee2bf9bd:75b04b88 + $831.15 da39a3ee:8d437dbf:ee2bf9bd:f61e33bf + $1,160.14 da39a3ee:8d437dbf:ee2bf9bd:35b25929 + $1,675.00 da39a3ee:8d437dbf:ee2bf9bd:d219c681 + $1,885.04 da39a3ee:8d437dbf:ee2bf9bd + $2,468.00 da39a3ee:8d437dbf:ee2bf9bd:75b04b88:b3850e04 +-------------------- + 0 +>>>2 +=== 0 diff --git a/test/regress/8254755E.test b/test/regress/8254755E.test new file mode 100644 index 00000000..26baf52d --- /dev/null +++ b/test/regress/8254755E.test @@ -0,0 +1,20 @@ +bal --flat food:out +<<< +~ Monthly + Expenses:Auto:Fuel $120.00 + Expenses:Food:Out $100.00 + Expenses:Food:Groceries $350.00 + Assets + +2009/11/01 + Expenses:Food:Out $50.00 + Assets +>>>1 + $50.00 Expenses:Food:Out +>>>2 +=== 0 +bal --flat --budget food:out +>>>1 + $-50.00 Expenses:Food:Out +>>>2 +=== 0 -- cgit v1.2.3 From 3a0879aff0b1ea0037098ae4f602b92719ff9a84 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 2 Nov 2009 01:39:18 -0500 Subject: Added "reported posts" into account xdata This is necessary because sometimes, a post from one account will get reported as though it were in another account (this happens with --budget, to show child account postings within their parent account). In that case, the account needs to remember which postings have been reported as being within it, so that it can add these amounts to its own total in the balance report. --- src/account.cc | 15 +++++++++++++++ src/account.h | 6 ++++-- src/filters.cc | 2 +- src/post.cc | 6 ++++++ src/post.h | 2 ++ test/regress/D060256A.test | 16 ++++++++++++++++ 6 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 test/regress/D060256A.test (limited to 'test') diff --git a/src/account.cc b/src/account.cc index b14520d3..23761049 100644 --- a/src/account.cc +++ b/src/account.cc @@ -397,6 +397,21 @@ value_t account_t::amount(const optional& expr) const xdata_->self_details.last_post = i; } + if (xdata_->self_details.last_reported_post) + i = *xdata_->self_details.last_reported_post; + else + i = xdata_->reported_posts.begin(); + + for (; i != xdata_->reported_posts.end(); i++) { + if ((*i)->xdata().has_flags(POST_EXT_VISITED)) { + if (! (*i)->xdata().has_flags(POST_EXT_CONSIDERED)) { + (*i)->add_to_value(xdata_->self_details.total, expr); + (*i)->xdata().add_flags(POST_EXT_CONSIDERED); + } + } + xdata_->self_details.last_reported_post = i; + } + return xdata_->self_details.total; } else { return NULL_VALUE; diff --git a/src/account.h b/src/account.h index ce0a7a66..c8f6bdbd 100644 --- a/src/account.h +++ b/src/account.h @@ -159,6 +159,7 @@ public: std::set payees_referenced; optional last_post; + optional last_reported_post; details_t() : calculated(false), @@ -176,8 +177,9 @@ public: void update(post_t& post, bool gather_all = false); }; - details_t self_details; - details_t family_details; + details_t self_details; + details_t family_details; + posts_list reported_posts; std::list sort_values; diff --git a/src/filters.cc b/src/filters.cc index 201fddf1..00e495dd 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -815,7 +815,7 @@ void budget_posts::operator()(post_t& post) post_in_budget = true; // Report the post as if it had occurred in the parent account. if (post.reported_account() != acct) - post.xdata().account = acct; + post.set_reported_account(acct); goto handle; } } diff --git a/src/post.cc b/src/post.cc index 0d6ab8a0..2a1663cb 100644 --- a/src/post.cc +++ b/src/post.cc @@ -436,4 +436,10 @@ void post_t::add_to_value(value_t& value, const optional& expr) const } } +void post_t::set_reported_account(account_t * account) +{ + xdata().account = account; + account->xdata().reported_posts.push_back(this); +} + } // namespace ledger diff --git a/src/post.h b/src/post.h index a89ce3bc..5fdee968 100644 --- a/src/post.h +++ b/src/post.h @@ -193,6 +193,8 @@ public: void add_to_value(value_t& value, const optional& expr = none) const; + void set_reported_account(account_t * account); + account_t * reported_account() { if (xdata_) if (account_t * acct = xdata_->account) diff --git a/test/regress/D060256A.test b/test/regress/D060256A.test new file mode 100644 index 00000000..26c30351 --- /dev/null +++ b/test/regress/D060256A.test @@ -0,0 +1,16 @@ +budget --now=2009/11/01 --end=2009/11/30 +<<< +~ Monthly + Expenses:Food $500.00 + Assets + +2009/11/01 Sample + Expenses:Food:Dining $20.00 + Assets +>>>1 + $-20.00 $-500.00 $480.00 4% Assets + $20.00 $500.00 $-480.00 4% Expenses:Food +------------ ------------ ------------ ----- + 0 0 0 0 +>>>2 +=== 0 -- cgit v1.2.3 From 90c7298049546bd8d1f4f64aeedd6569780f9259 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 2 Nov 2009 01:58:53 -0500 Subject: Renamed the DocTests to ManualTests --- test/doc/transaction-codes-1.test | 22 ---------------------- test/doc/transaction-codes-2.test | 24 ------------------------ test/doc/transaction-notes-1.test | 24 ------------------------ test/doc/transaction-notes-2.test | 23 ----------------------- test/doc/transaction-notes-3.test | 23 ----------------------- test/doc/transaction-notes-4.test | 27 --------------------------- test/doc/transaction-status-1.test | 19 ------------------- test/doc/transaction-status-2.test | 17 ----------------- test/doc/transaction-status-3.test | 18 ------------------ test/doc/transaction-status-4.test | 17 ----------------- test/manual/transaction-codes-1.test | 22 ++++++++++++++++++++++ test/manual/transaction-codes-2.test | 24 ++++++++++++++++++++++++ test/manual/transaction-notes-1.test | 24 ++++++++++++++++++++++++ test/manual/transaction-notes-2.test | 23 +++++++++++++++++++++++ test/manual/transaction-notes-3.test | 23 +++++++++++++++++++++++ test/manual/transaction-notes-4.test | 27 +++++++++++++++++++++++++++ test/manual/transaction-status-1.test | 19 +++++++++++++++++++ test/manual/transaction-status-2.test | 17 +++++++++++++++++ test/manual/transaction-status-3.test | 18 ++++++++++++++++++ test/manual/transaction-status-4.test | 17 +++++++++++++++++ tools/Makefile.am | 14 +++++++------- 21 files changed, 221 insertions(+), 221 deletions(-) delete mode 100644 test/doc/transaction-codes-1.test delete mode 100644 test/doc/transaction-codes-2.test delete mode 100644 test/doc/transaction-notes-1.test delete mode 100644 test/doc/transaction-notes-2.test delete mode 100644 test/doc/transaction-notes-3.test delete mode 100644 test/doc/transaction-notes-4.test delete mode 100644 test/doc/transaction-status-1.test delete mode 100644 test/doc/transaction-status-2.test delete mode 100644 test/doc/transaction-status-3.test delete mode 100644 test/doc/transaction-status-4.test create mode 100644 test/manual/transaction-codes-1.test create mode 100644 test/manual/transaction-codes-2.test create mode 100644 test/manual/transaction-notes-1.test create mode 100644 test/manual/transaction-notes-2.test create mode 100644 test/manual/transaction-notes-3.test create mode 100644 test/manual/transaction-notes-4.test create mode 100644 test/manual/transaction-status-1.test create mode 100644 test/manual/transaction-status-2.test create mode 100644 test/manual/transaction-status-3.test create mode 100644 test/manual/transaction-status-4.test (limited to 'test') diff --git a/test/doc/transaction-codes-1.test b/test/doc/transaction-codes-1.test deleted file mode 100644 index 878c5cac..00000000 --- a/test/doc/transaction-codes-1.test +++ /dev/null @@ -1,22 +0,0 @@ -reg --columns=60 food and code xfer -<<< -2009/10/29 (XFER) Panera Bread - Expenses:Food $4.50 - Assets:Checking - -2009/10/30 (DEP) Pay day! - Assets:Checking $20.00 - Income - -2009/10/30 (XFER) Panera Bread - Expenses:Food $4.50 - Assets:Checking - -2009/10/31 (559385768438A8D7) Panera Bread - Expenses:Food $4.50 - Liabilities:Credit Card ->>>1 -09-Oct-29 Panera Bread Expenses:Food $4.50 $4.50 -09-Oct-30 Panera Bread Expenses:Food $4.50 $9.00 ->>>2 -=== 0 diff --git a/test/doc/transaction-codes-2.test b/test/doc/transaction-codes-2.test deleted file mode 100644 index 4e4c76cf..00000000 --- a/test/doc/transaction-codes-2.test +++ /dev/null @@ -1,24 +0,0 @@ -bal checking --set-reported-account=code -<<< -2009/10/29 (XFER) Panera Bread - Expenses:Food $4.50 - Assets:Checking - -2009/10/30 (DEP) Pay day! - Assets:Checking $20.00 - Income - -2009/10/30 (XFER) Panera Bread - Expenses:Food $4.50 - Assets:Checking - -2009/10/31 (559385768438A8D7) Panera Bread - Expenses:Food $4.50 - Liabilities:Credit Card ->>>1 - $20.00 DEP - $-9.00 XFER --------------------- - $11.00 ->>>2 -=== 0 diff --git a/test/doc/transaction-notes-1.test b/test/doc/transaction-notes-1.test deleted file mode 100644 index d3fab3b6..00000000 --- a/test/doc/transaction-notes-1.test +++ /dev/null @@ -1,24 +0,0 @@ -reg --columns=60 food and note eat -<<< -2009/11/01 Panera Bread ; Got something to eat - Expenses:Food $4.50 - Assets:Checking - -2009/11/01 Panera Bread - ; Type: Coffee - ; Let’s see, I ate a whole bunch of stuff, drank some coffee, - ; pondered a bagel, then decided against the donut. - Expenses:Food $4.50 - Assets:Checking - -2009/11/01 Panera Bread - ; Type: Dining - ; :Eating: - ; This is another long note, after the metadata. - Expenses:Food $4.50 - Assets:Checking ->>>1 -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 -09-Nov-01 Panera Bread Expenses:Food $4.50 $9.00 ->>>2 -=== 0 diff --git a/test/doc/transaction-notes-2.test b/test/doc/transaction-notes-2.test deleted file mode 100644 index b7a258e0..00000000 --- a/test/doc/transaction-notes-2.test +++ /dev/null @@ -1,23 +0,0 @@ -reg --columns=60 food and tag eating -<<< -2009/11/01 Panera Bread ; Got something to eat - Expenses:Food $4.50 - Assets:Checking - -2009/11/01 Panera Bread - ; Type: Coffee - ; Let’s see, I ate a whole bunch of stuff, drank some coffee, - ; pondered a bagel, then decided against the donut. - Expenses:Food $4.50 - Assets:Checking - -2009/11/01 Panera Bread - ; Type: Dining - ; :Eating: - ; This is another long note, after the metadata. - Expenses:Food $4.50 - Assets:Checking ->>>1 -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 ->>>2 -=== 0 diff --git a/test/doc/transaction-notes-3.test b/test/doc/transaction-notes-3.test deleted file mode 100644 index 9d532d5f..00000000 --- a/test/doc/transaction-notes-3.test +++ /dev/null @@ -1,23 +0,0 @@ -reg --columns=60 food and tag type=dining -<<< -2009/11/01 Panera Bread ; Got something to eat - Expenses:Food $4.50 - Assets:Checking - -2009/11/01 Panera Bread - ; Type: Coffee - ; Let’s see, I ate a whole bunch of stuff, drank some coffee, - ; pondered a bagel, then decided against the donut. - Expenses:Food $4.50 - Assets:Checking - -2009/11/01 Panera Bread - ; Type: Dining - ; :Eating: - ; This is another long note, after the metadata. - Expenses:Food $4.50 - Assets:Checking ->>>1 -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 ->>>2 -=== 0 diff --git a/test/doc/transaction-notes-4.test b/test/doc/transaction-notes-4.test deleted file mode 100644 index 516094c7..00000000 --- a/test/doc/transaction-notes-4.test +++ /dev/null @@ -1,27 +0,0 @@ -bal food and tag type --set-reported-account='"Tags:" + tag("Type")' -<<< -2009/11/01 Panera Bread ; Got something to eat - Expenses:Food $4.50 - Assets:Checking - -2009/11/01 Panera Bread - ; Type: Coffee - ; Let’s see, I ate a whole bunch of stuff, drank some coffee, - ; pondered a bagel, then decided against the donut. - Expenses:Food $4.50 - Assets:Checking - -2009/11/01 Panera Bread - ; Type: Dining - ; :Eating: - ; This is another long note, after the metadata. - Expenses:Food $4.50 - Assets:Checking ->>>1 - $9.00 Tags - $4.50 Coffee - $4.50 Dining --------------------- - $9.00 ->>>2 -=== 0 diff --git a/test/doc/transaction-status-1.test b/test/doc/transaction-status-1.test deleted file mode 100644 index 4bdf893a..00000000 --- a/test/doc/transaction-status-1.test +++ /dev/null @@ -1,19 +0,0 @@ -reg --columns=60 food -<<< -2009/10/31 * Panera Bread - Expenses:Food $4.50 - Assets - -2009/11/01 ! Panera Bread - Expenses:Food $4.50 - Assets - -2009/11/02 Panera Bread - Expenses:Food $4.50 - Assets ->>>1 -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 ->>>2 -=== 0 diff --git a/test/doc/transaction-status-2.test b/test/doc/transaction-status-2.test deleted file mode 100644 index dbbb04ae..00000000 --- a/test/doc/transaction-status-2.test +++ /dev/null @@ -1,17 +0,0 @@ -reg --columns=60 food --cleared -<<< -2009/10/31 * Panera Bread - Expenses:Food $4.50 - Assets - -2009/11/01 ! Panera Bread - Expenses:Food $4.50 - Assets - -2009/11/02 Panera Bread - Expenses:Food $4.50 - Assets ->>>1 -09-Oct-31 Panera Bread Expenses:Food $4.50 $4.50 ->>>2 -=== 0 diff --git a/test/doc/transaction-status-3.test b/test/doc/transaction-status-3.test deleted file mode 100644 index 1e6467ef..00000000 --- a/test/doc/transaction-status-3.test +++ /dev/null @@ -1,18 +0,0 @@ -reg --columns=60 food --uncleared -<<< -2009/10/31 * Panera Bread - Expenses:Food $4.50 - Assets - -2009/11/01 ! Panera Bread - Expenses:Food $4.50 - Assets - -2009/11/02 Panera Bread - Expenses:Food $4.50 - Assets ->>>1 -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 -09-Nov-02 Panera Bread Expenses:Food $4.50 $9.00 ->>>2 -=== 0 diff --git a/test/doc/transaction-status-4.test b/test/doc/transaction-status-4.test deleted file mode 100644 index 5275eec3..00000000 --- a/test/doc/transaction-status-4.test +++ /dev/null @@ -1,17 +0,0 @@ -reg --columns=60 food --pending -<<< -2009/10/31 * Panera Bread - Expenses:Food $4.50 - Assets - -2009/11/01 ! Panera Bread - Expenses:Food $4.50 - Assets - -2009/11/02 Panera Bread - Expenses:Food $4.50 - Assets ->>>1 -09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 ->>>2 -=== 0 diff --git a/test/manual/transaction-codes-1.test b/test/manual/transaction-codes-1.test new file mode 100644 index 00000000..878c5cac --- /dev/null +++ b/test/manual/transaction-codes-1.test @@ -0,0 +1,22 @@ +reg --columns=60 food and code xfer +<<< +2009/10/29 (XFER) Panera Bread + Expenses:Food $4.50 + Assets:Checking + +2009/10/30 (DEP) Pay day! + Assets:Checking $20.00 + Income + +2009/10/30 (XFER) Panera Bread + Expenses:Food $4.50 + Assets:Checking + +2009/10/31 (559385768438A8D7) Panera Bread + Expenses:Food $4.50 + Liabilities:Credit Card +>>>1 +09-Oct-29 Panera Bread Expenses:Food $4.50 $4.50 +09-Oct-30 Panera Bread Expenses:Food $4.50 $9.00 +>>>2 +=== 0 diff --git a/test/manual/transaction-codes-2.test b/test/manual/transaction-codes-2.test new file mode 100644 index 00000000..4e4c76cf --- /dev/null +++ b/test/manual/transaction-codes-2.test @@ -0,0 +1,24 @@ +bal checking --set-reported-account=code +<<< +2009/10/29 (XFER) Panera Bread + Expenses:Food $4.50 + Assets:Checking + +2009/10/30 (DEP) Pay day! + Assets:Checking $20.00 + Income + +2009/10/30 (XFER) Panera Bread + Expenses:Food $4.50 + Assets:Checking + +2009/10/31 (559385768438A8D7) Panera Bread + Expenses:Food $4.50 + Liabilities:Credit Card +>>>1 + $20.00 DEP + $-9.00 XFER +-------------------- + $11.00 +>>>2 +=== 0 diff --git a/test/manual/transaction-notes-1.test b/test/manual/transaction-notes-1.test new file mode 100644 index 00000000..d3fab3b6 --- /dev/null +++ b/test/manual/transaction-notes-1.test @@ -0,0 +1,24 @@ +reg --columns=60 food and note eat +<<< +2009/11/01 Panera Bread ; Got something to eat + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Coffee + ; Let’s see, I ate a whole bunch of stuff, drank some coffee, + ; pondered a bagel, then decided against the donut. + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Dining + ; :Eating: + ; This is another long note, after the metadata. + Expenses:Food $4.50 + Assets:Checking +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-01 Panera Bread Expenses:Food $4.50 $9.00 +>>>2 +=== 0 diff --git a/test/manual/transaction-notes-2.test b/test/manual/transaction-notes-2.test new file mode 100644 index 00000000..b7a258e0 --- /dev/null +++ b/test/manual/transaction-notes-2.test @@ -0,0 +1,23 @@ +reg --columns=60 food and tag eating +<<< +2009/11/01 Panera Bread ; Got something to eat + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Coffee + ; Let’s see, I ate a whole bunch of stuff, drank some coffee, + ; pondered a bagel, then decided against the donut. + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Dining + ; :Eating: + ; This is another long note, after the metadata. + Expenses:Food $4.50 + Assets:Checking +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +>>>2 +=== 0 diff --git a/test/manual/transaction-notes-3.test b/test/manual/transaction-notes-3.test new file mode 100644 index 00000000..9d532d5f --- /dev/null +++ b/test/manual/transaction-notes-3.test @@ -0,0 +1,23 @@ +reg --columns=60 food and tag type=dining +<<< +2009/11/01 Panera Bread ; Got something to eat + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Coffee + ; Let’s see, I ate a whole bunch of stuff, drank some coffee, + ; pondered a bagel, then decided against the donut. + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Dining + ; :Eating: + ; This is another long note, after the metadata. + Expenses:Food $4.50 + Assets:Checking +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +>>>2 +=== 0 diff --git a/test/manual/transaction-notes-4.test b/test/manual/transaction-notes-4.test new file mode 100644 index 00000000..516094c7 --- /dev/null +++ b/test/manual/transaction-notes-4.test @@ -0,0 +1,27 @@ +bal food and tag type --set-reported-account='"Tags:" + tag("Type")' +<<< +2009/11/01 Panera Bread ; Got something to eat + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Coffee + ; Let’s see, I ate a whole bunch of stuff, drank some coffee, + ; pondered a bagel, then decided against the donut. + Expenses:Food $4.50 + Assets:Checking + +2009/11/01 Panera Bread + ; Type: Dining + ; :Eating: + ; This is another long note, after the metadata. + Expenses:Food $4.50 + Assets:Checking +>>>1 + $9.00 Tags + $4.50 Coffee + $4.50 Dining +-------------------- + $9.00 +>>>2 +=== 0 diff --git a/test/manual/transaction-status-1.test b/test/manual/transaction-status-1.test new file mode 100644 index 00000000..4bdf893a --- /dev/null +++ b/test/manual/transaction-status-1.test @@ -0,0 +1,19 @@ +reg --columns=60 food +<<< +2009/10/31 * Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/01 ! Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/02 Panera Bread + Expenses:Food $4.50 + Assets +>>>1 +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 +>>>2 +=== 0 diff --git a/test/manual/transaction-status-2.test b/test/manual/transaction-status-2.test new file mode 100644 index 00000000..dbbb04ae --- /dev/null +++ b/test/manual/transaction-status-2.test @@ -0,0 +1,17 @@ +reg --columns=60 food --cleared +<<< +2009/10/31 * Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/01 ! Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/02 Panera Bread + Expenses:Food $4.50 + Assets +>>>1 +09-Oct-31 Panera Bread Expenses:Food $4.50 $4.50 +>>>2 +=== 0 diff --git a/test/manual/transaction-status-3.test b/test/manual/transaction-status-3.test new file mode 100644 index 00000000..1e6467ef --- /dev/null +++ b/test/manual/transaction-status-3.test @@ -0,0 +1,18 @@ +reg --columns=60 food --uncleared +<<< +2009/10/31 * Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/01 ! Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/02 Panera Bread + Expenses:Food $4.50 + Assets +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +09-Nov-02 Panera Bread Expenses:Food $4.50 $9.00 +>>>2 +=== 0 diff --git a/test/manual/transaction-status-4.test b/test/manual/transaction-status-4.test new file mode 100644 index 00000000..5275eec3 --- /dev/null +++ b/test/manual/transaction-status-4.test @@ -0,0 +1,17 @@ +reg --columns=60 food --pending +<<< +2009/10/31 * Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/01 ! Panera Bread + Expenses:Food $4.50 + Assets + +2009/11/02 Panera Bread + Expenses:Food $4.50 + Assets +>>>1 +09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50 +>>>2 +=== 0 diff --git a/tools/Makefile.am b/tools/Makefile.am index 4662e73d..4dd4a871 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -247,7 +247,7 @@ endif TESTS = if HAVE_PYTHON -TESTS += RegressTests BaselineTests DocTests ConfirmTests GenerateTests +TESTS += RegressTests BaselineTests ManualTests ConfirmTests GenerateTests endif if HAVE_CPPUNIT @@ -381,12 +381,12 @@ BaselineTests: $(srcdir)/test/RegressTests.py echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/baseline \"\$$@\"" > $@ chmod 755 $@ -DocTests_SOURCES = test/RegressTests.py +ManualTests_SOURCES = test/RegressTests.py -EXTRA_DIST += test/doc +EXTRA_DIST += test/manual -DocTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/doc \"\$$@\"" > $@ +ManualTests: $(srcdir)/test/RegressTests.py + echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/manual \"\$$@\"" > $@ chmod 755 $@ ConfirmTests_SOURCES = test/ConfirmTests.py @@ -432,12 +432,12 @@ endif fullcheck: cppunittests @$(top_builddir)/RegressTests --verify @$(top_builddir)/BaselineTests --verify - @$(top_builddir)/DocTests --verify + @$(top_builddir)/ManualTests --verify @$(top_builddir)/ConfirmTests --verify @$(top_builddir)/GenerateTests --verify @$(top_builddir)/RegressTests --gmalloc @$(top_builddir)/BaselineTests --gmalloc - @$(top_builddir)/DocTests --gmalloc + @$(top_builddir)/ManualTests --gmalloc # @$(top_builddir)/ConfirmTests --gmalloc # @$(top_builddir)/GenerateTests --gmalloc -- cgit v1.2.3 From 4a249d6172773db571556f469be6ee2c1c3690e9 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 2 Nov 2009 01:59:04 -0500 Subject: Fixed issues with period strings like "2009/10" --- src/times.cc | 40 ++++++----- test/baseline/opt-add-budget.test | 144 +++++++++++++++++++------------------- test/baseline/opt-budget.test | 96 ++++++++++++------------- test/regress/7F3650FD.test | 50 +++++++++++++ 4 files changed, 194 insertions(+), 136 deletions(-) create mode 100644 test/regress/7F3650FD.test (limited to 'test') diff --git a/src/times.cc b/src/times.cc index 667f65a3..b737b2a0 100644 --- a/src/times.cc +++ b/src/times.cc @@ -55,12 +55,13 @@ namespace { #endif // USE_BOOST_FACETS public: - bool has_year; - bool input; + bool has_year; + bool has_day; + bool input; temporal_io_t(const char * _fmt_str, bool _input) : fmt_str(_fmt_str), has_year(icontains(fmt_str, "%y")), - input(_input) { + has_day(icontains(fmt_str, "%d")), input(_input) { #if defined(USE_BOOST_FACETS) if (input) { input_facet = new InputFacetType(fmt_str); @@ -75,6 +76,7 @@ namespace { void set_format(const char * fmt) { fmt_str = fmt; has_year = icontains(fmt_str, "%y"); + has_day = icontains(fmt_str, "%d"); #if defined(USE_BOOST_FACETS) if (input) @@ -190,7 +192,7 @@ namespace { date_t parse_date_mask_routine(const char * date_str, date_io_t& io, optional year, - bool& saw_year) + bool& saw_year, bool& saw_day) { date_t when; @@ -220,26 +222,30 @@ namespace { if (when.month() > CURRENT_DATE().month()) when -= gregorian::years(1); - } else { + } + else { saw_year = true; } + + saw_day = io.has_day; } return when; } date_t parse_date_mask(const char * date_str, - optional year, bool& saw_year) + optional year, + bool& saw_year, bool& saw_day) { if (input_date_io.get()) { date_t when = parse_date_mask_routine(date_str, *input_date_io.get(), - year, saw_year); + year, saw_year, saw_day); if (! when.is_not_a_date()) return when; } foreach (shared_ptr& reader, readers) { date_t when = parse_date_mask_routine(date_str, *reader.get(), - year, saw_year); + year, saw_year, saw_day); if (! when.is_not_a_date()) return when; } @@ -311,7 +317,8 @@ datetime_t parse_datetime(const char * str, optional) date_t parse_date(const char * str, optional current_year) { bool saw_year; - return parse_date_mask(str, current_year, saw_year); + bool saw_day; + return parse_date_mask(str, current_year, saw_year, saw_day); } std::ostream& operator<<(std::ostream& out, @@ -549,7 +556,8 @@ namespace { date_t * end) { bool saw_year = true; - date_t when = parse_date_mask(word.c_str(), none, saw_year); + bool saw_day = true; + date_t when = parse_date_mask(word.c_str(), none, saw_year, saw_day); if (when.is_not_a_date()) throw_(date_error, _("Could not parse date mask: %1") << word); @@ -558,8 +566,8 @@ namespace { *begin = when; if (end) { - if (saw_year) - *end = *begin + gregorian::years(1); + if (saw_day) + *end = *begin + gregorian::days(1); else *end = *begin + gregorian::months(1); } @@ -728,17 +736,17 @@ void date_interval_t::parse(std::istream& in) if (wday) { while (start->day_of_week() != *wday) - *start = duration_t(duration_t::DAYS, 1).subtract(*start); + *start -= gregorian::days(1); if (! end) - end = duration_t(duration_t::DAYS, 1).add(*start); + end = *start + gregorian::days(1); } else { bool overwrite_end = false; if (year) { start = date_t(*year, 1, 1); if (! end) { - end = duration_t(duration_t::YEARS, 1).add(*start); + end = *start + gregorian::years(1); overwrite_end = true; } } @@ -746,7 +754,7 @@ void date_interval_t::parse(std::istream& in) if (mon) { start = date_t(start->year(), *mon, 1); if (! end || overwrite_end) - end = duration_t(duration_t::MONTHS, 1).add(*start); + end = *start + gregorian::months(1); } } } diff --git a/test/baseline/opt-add-budget.test b/test/baseline/opt-add-budget.test index 20dfd320..535335d3 100644 --- a/test/baseline/opt-add-budget.test +++ b/test/baseline/opt-add-budget.test @@ -244,124 +244,124 @@ reg --add-budget books cards Liabilities:Cards $120.00 Assets:Cash >>>1 -08-Jan-01 January Expenses:Books $10.00 $10.00 - Liabilities:Cards $10.00 $20.00 -08-Jan-01 Budget transaction Expenses:Books $-10.00 $10.00 +08-Jan-01 Budget transaction Expenses:Books $-10.00 $-10.00 +08-Jan-01 January Expenses:Books $10.00 0 + Liabilities:Cards $10.00 $10.00 08-Jan-31 End of January Expenses:Books $10.00 $20.00 Liabilities:Cards $10.00 $30.00 -08-Feb-01 February Expenses:Books $20.00 $50.00 - Liabilities:Cards $20.00 $70.00 -08-Feb-01 Budget transaction Expenses:Books $-10.00 $60.00 +08-Feb-01 Budget transaction Expenses:Books $-10.00 $20.00 +08-Feb-01 February Expenses:Books $20.00 $40.00 + Liabilities:Cards $20.00 $60.00 08-Feb-28 End of February Expenses:Books $20.00 $80.00 Liabilities:Cards $20.00 $100.00 -08-Mar-01 March Expenses:Books $30.00 $130.00 - Liabilities:Cards $30.00 $160.00 -08-Mar-01 Budget transaction Expenses:Books $-10.00 $150.00 +08-Mar-01 Budget transaction Expenses:Books $-10.00 $90.00 +08-Mar-01 March Expenses:Books $30.00 $120.00 + Liabilities:Cards $30.00 $150.00 08-Mar-31 End of March Expenses:Books $30.00 $180.00 Liabilities:Cards $30.00 $210.00 -08-Apr-01 April Expenses:Books $40.00 $250.00 - Liabilities:Cards $40.00 $290.00 -08-Apr-01 Budget transaction Expenses:Books $-10.00 $280.00 +08-Apr-01 Budget transaction Expenses:Books $-10.00 $200.00 +08-Apr-01 April Expenses:Books $40.00 $240.00 + Liabilities:Cards $40.00 $280.00 08-Apr-30 End of April Expenses:Books $40.00 $320.00 Liabilities:Cards $40.00 $360.00 -08-May-01 May Expenses:Books $50.00 $410.00 - Liabilities:Cards $50.00 $460.00 -08-May-01 Budget transaction Expenses:Books $-10.00 $450.00 +08-May-01 Budget transaction Expenses:Books $-10.00 $350.00 +08-May-01 May Expenses:Books $50.00 $400.00 + Liabilities:Cards $50.00 $450.00 08-May-31 End of May Expenses:Books $50.00 $500.00 Liabilities:Cards $50.00 $550.00 -08-Jun-01 June Expenses:Books $60.00 $610.00 - Liabilities:Cards $60.00 $670.00 -08-Jun-01 Budget transaction Expenses:Books $-10.00 $660.00 +08-Jun-01 Budget transaction Expenses:Books $-10.00 $540.00 +08-Jun-01 June Expenses:Books $60.00 $600.00 + Liabilities:Cards $60.00 $660.00 08-Jun-30 End of June Expenses:Books $60.00 $720.00 Liabilities:Cards $60.00 $780.00 -08-Jul-01 July Expenses:Books $70.00 $850.00 - Liabilities:Cards $70.00 $920.00 -08-Jul-01 Budget transaction Expenses:Books $-10.00 $910.00 +08-Jul-01 Budget transaction Expenses:Books $-10.00 $770.00 +08-Jul-01 July Expenses:Books $70.00 $840.00 + Liabilities:Cards $70.00 $910.00 08-Jul-31 End of July Expenses:Books $70.00 $980.00 Liabilities:Cards $70.00 $1050.00 -08-Aug-01 August Expenses:Books $80.00 $1130.00 - Liabilities:Cards $80.00 $1210.00 -08-Aug-01 Budget transaction Expenses:Books $-10.00 $1200.00 +08-Aug-01 Budget transaction Expenses:Books $-10.00 $1040.00 +08-Aug-01 August Expenses:Books $80.00 $1120.00 + Liabilities:Cards $80.00 $1200.00 08-Aug-31 End of August Expenses:Books $80.00 $1280.00 Liabilities:Cards $80.00 $1360.00 -08-Sep-01 September Expenses:Books $90.00 $1450.00 - Liabilities:Cards $90.00 $1540.00 -08-Sep-01 Budget transaction Expenses:Books $-10.00 $1530.00 +08-Sep-01 Budget transaction Expenses:Books $-10.00 $1350.00 +08-Sep-01 September Expenses:Books $90.00 $1440.00 + Liabilities:Cards $90.00 $1530.00 08-Sep-30 End of September Expenses:Books $90.00 $1620.00 Liabilities:Cards $90.00 $1710.00 -08-Oct-01 October Expenses:Books $100.00 $1810.00 - Liabilities:Cards $100.00 $1910.00 -08-Oct-01 Budget transaction Expenses:Books $-10.00 $1900.00 +08-Oct-01 Budget transaction Expenses:Books $-10.00 $1700.00 +08-Oct-01 October Expenses:Books $100.00 $1800.00 + Liabilities:Cards $100.00 $1900.00 08-Oct-31 End of October Expenses:Books $100.00 $2000.00 Liabilities:Cards $100.00 $2100.00 -08-Nov-01 November Expenses:Books $110.00 $2210.00 - Liabilities:Cards $110.00 $2320.00 -08-Nov-01 Budget transaction Expenses:Books $-10.00 $2310.00 +08-Nov-01 Budget transaction Expenses:Books $-10.00 $2090.00 +08-Nov-01 November Expenses:Books $110.00 $2200.00 + Liabilities:Cards $110.00 $2310.00 08-Nov-30 End of November Expenses:Books $110.00 $2420.00 Liabilities:Cards $110.00 $2530.00 -08-Dec-01 December Expenses:Books $120.00 $2650.00 - Liabilities:Cards $120.00 $2770.00 -08-Dec-01 Budget transaction Expenses:Books $-10.00 $2760.00 +08-Dec-01 Budget transaction Expenses:Books $-10.00 $2520.00 +08-Dec-01 December Expenses:Books $120.00 $2640.00 + Liabilities:Cards $120.00 $2760.00 08-Dec-31 End of December Expenses:Books $120.00 $2880.00 Liabilities:Cards $120.00 $3000.00 -09-Jan-01 January Expenses:Books $10.00 $3010.00 - Liabilities:Cards $10.00 $3020.00 -09-Jan-01 Budget transaction Expenses:Books $-10.00 $3010.00 +09-Jan-01 Budget transaction Expenses:Books $-10.00 $2990.00 +09-Jan-01 January Expenses:Books $10.00 $3000.00 + Liabilities:Cards $10.00 $3010.00 09-Jan-31 End of January Expenses:Books $10.00 $3020.00 Liabilities:Cards $10.00 $3030.00 -09-Feb-01 February Expenses:Books $20.00 $3050.00 - Liabilities:Cards $20.00 $3070.00 -09-Feb-01 Budget transaction Expenses:Books $-10.00 $3060.00 +09-Feb-01 Budget transaction Expenses:Books $-10.00 $3020.00 +09-Feb-01 February Expenses:Books $20.00 $3040.00 + Liabilities:Cards $20.00 $3060.00 09-Feb-28 End of February Expenses:Books $20.00 $3080.00 Liabilities:Cards $20.00 $3100.00 -09-Mar-01 March Expenses:Books $30.00 $3130.00 - Liabilities:Cards $30.00 $3160.00 -09-Mar-01 Budget transaction Expenses:Books $-10.00 $3150.00 +09-Mar-01 Budget transaction Expenses:Books $-10.00 $3090.00 +09-Mar-01 March Expenses:Books $30.00 $3120.00 + Liabilities:Cards $30.00 $3150.00 09-Mar-31 End of March Expenses:Books $30.00 $3180.00 Liabilities:Cards $30.00 $3210.00 -09-Apr-01 April Expenses:Books $40.00 $3250.00 - Liabilities:Cards $40.00 $3290.00 -09-Apr-01 Budget transaction Expenses:Books $-10.00 $3280.00 +09-Apr-01 Budget transaction Expenses:Books $-10.00 $3200.00 +09-Apr-01 April Expenses:Books $40.00 $3240.00 + Liabilities:Cards $40.00 $3280.00 09-Apr-30 End of April Expenses:Books $40.00 $3320.00 Liabilities:Cards $40.00 $3360.00 -09-May-01 May Expenses:Books $50.00 $3410.00 - Liabilities:Cards $50.00 $3460.00 -09-May-01 Budget transaction Expenses:Books $-10.00 $3450.00 +09-May-01 Budget transaction Expenses:Books $-10.00 $3350.00 +09-May-01 May Expenses:Books $50.00 $3400.00 + Liabilities:Cards $50.00 $3450.00 09-May-31 End of May Expenses:Books $50.00 $3500.00 Liabilities:Cards $50.00 $3550.00 -09-Jun-01 June Expenses:Books $60.00 $3610.00 - Liabilities:Cards $60.00 $3670.00 -09-Jun-01 Budget transaction Expenses:Books $-10.00 $3660.00 +09-Jun-01 Budget transaction Expenses:Books $-10.00 $3540.00 +09-Jun-01 June Expenses:Books $60.00 $3600.00 + Liabilities:Cards $60.00 $3660.00 09-Jun-30 End of June Expenses:Books $60.00 $3720.00 Liabilities:Cards $60.00 $3780.00 -09-Jul-01 July Expenses:Books $70.00 $3850.00 - Liabilities:Cards $70.00 $3920.00 -09-Jul-01 Budget transaction Expenses:Books $-10.00 $3910.00 +09-Jul-01 Budget transaction Expenses:Books $-10.00 $3770.00 +09-Jul-01 July Expenses:Books $70.00 $3840.00 + Liabilities:Cards $70.00 $3910.00 09-Jul-31 End of July Expenses:Books $70.00 $3980.00 Liabilities:Cards $70.00 $4050.00 -09-Aug-01 August Expenses:Books $80.00 $4130.00 - Liabilities:Cards $80.00 $4210.00 -09-Aug-01 Budget transaction Expenses:Books $-10.00 $4200.00 +09-Aug-01 Budget transaction Expenses:Books $-10.00 $4040.00 +09-Aug-01 August Expenses:Books $80.00 $4120.00 + Liabilities:Cards $80.00 $4200.00 09-Aug-31 End of August Expenses:Books $80.00 $4280.00 Liabilities:Cards $80.00 $4360.00 -09-Sep-01 September Expenses:Books $90.00 $4450.00 - Liabilities:Cards $90.00 $4540.00 -09-Sep-01 Budget transaction Expenses:Books $-10.00 $4530.00 +09-Sep-01 Budget transaction Expenses:Books $-10.00 $4350.00 +09-Sep-01 September Expenses:Books $90.00 $4440.00 + Liabilities:Cards $90.00 $4530.00 09-Sep-30 End of September Expenses:Books $90.00 $4620.00 Liabilities:Cards $90.00 $4710.00 -09-Oct-01 October Expenses:Books $100.00 $4810.00 - Liabilities:Cards $100.00 $4910.00 -09-Oct-01 Budget transaction Expenses:Books $-10.00 $4900.00 +09-Oct-01 Budget transaction Expenses:Books $-10.00 $4700.00 +09-Oct-01 October Expenses:Books $100.00 $4800.00 + Liabilities:Cards $100.00 $4900.00 09-Oct-31 End of October Expenses:Books $100.00 $5000.00 Liabilities:Cards $100.00 $5100.00 -09-Nov-01 November Expenses:Books $110.00 $5210.00 - Liabilities:Cards $110.00 $5320.00 -09-Nov-01 Budget transaction Expenses:Books $-10.00 $5310.00 +09-Nov-01 Budget transaction Expenses:Books $-10.00 $5090.00 +09-Nov-01 November Expenses:Books $110.00 $5200.00 + Liabilities:Cards $110.00 $5310.00 09-Nov-30 End of November Expenses:Books $110.00 $5420.00 Liabilities:Cards $110.00 $5530.00 -09-Dec-01 December Expenses:Books $120.00 $5650.00 - Liabilities:Cards $120.00 $5770.00 -09-Dec-01 Budget transaction Expenses:Books $-10.00 $5760.00 +09-Dec-01 Budget transaction Expenses:Books $-10.00 $5520.00 +09-Dec-01 December Expenses:Books $120.00 $5640.00 + Liabilities:Cards $120.00 $5760.00 09-Dec-31 End of December Expenses:Books $120.00 $5880.00 Liabilities:Cards $120.00 $6000.00 >>>2 diff --git a/test/baseline/opt-budget.test b/test/baseline/opt-budget.test index 097d19d8..eb2ade9d 100644 --- a/test/baseline/opt-budget.test +++ b/test/baseline/opt-budget.test @@ -245,77 +245,77 @@ reg --budget books Liabilities:Cards $120.00 Assets:Cash >>>1 -08-Jan-01 January Expenses:Books $10.00 $10.00 -08-Jan-01 Budget transaction Expenses:Books $-10.00 0 +08-Jan-01 Budget transaction Expenses:Books $-10.00 $-10.00 +08-Jan-01 January Expenses:Books $10.00 0 08-Jan-31 End of January Expenses:Books $10.00 $10.00 -08-Feb-01 February Expenses:Books $20.00 $30.00 -08-Feb-01 Budget transaction Expenses:Books $-10.00 $20.00 +08-Feb-01 Budget transaction Expenses:Books $-10.00 0 +08-Feb-01 February Expenses:Books $20.00 $20.00 08-Feb-28 End of February Expenses:Books $20.00 $40.00 -08-Mar-01 March Expenses:Books $30.00 $70.00 -08-Mar-01 Budget transaction Expenses:Books $-10.00 $60.00 +08-Mar-01 Budget transaction Expenses:Books $-10.00 $30.00 +08-Mar-01 March Expenses:Books $30.00 $60.00 08-Mar-31 End of March Expenses:Books $30.00 $90.00 -08-Apr-01 April Expenses:Books $40.00 $130.00 -08-Apr-01 Budget transaction Expenses:Books $-10.00 $120.00 +08-Apr-01 Budget transaction Expenses:Books $-10.00 $80.00 +08-Apr-01 April Expenses:Books $40.00 $120.00 08-Apr-30 End of April Expenses:Books $40.00 $160.00 -08-May-01 May Expenses:Books $50.00 $210.00 -08-May-01 Budget transaction Expenses:Books $-10.00 $200.00 +08-May-01 Budget transaction Expenses:Books $-10.00 $150.00 +08-May-01 May Expenses:Books $50.00 $200.00 08-May-31 End of May Expenses:Books $50.00 $250.00 -08-Jun-01 June Expenses:Books $60.00 $310.00 -08-Jun-01 Budget transaction Expenses:Books $-10.00 $300.00 +08-Jun-01 Budget transaction Expenses:Books $-10.00 $240.00 +08-Jun-01 June Expenses:Books $60.00 $300.00 08-Jun-30 End of June Expenses:Books $60.00 $360.00 -08-Jul-01 July Expenses:Books $70.00 $430.00 -08-Jul-01 Budget transaction Expenses:Books $-10.00 $420.00 +08-Jul-01 Budget transaction Expenses:Books $-10.00 $350.00 +08-Jul-01 July Expenses:Books $70.00 $420.00 08-Jul-31 End of July Expenses:Books $70.00 $490.00 -08-Aug-01 August Expenses:Books $80.00 $570.00 -08-Aug-01 Budget transaction Expenses:Books $-10.00 $560.00 +08-Aug-01 Budget transaction Expenses:Books $-10.00 $480.00 +08-Aug-01 August Expenses:Books $80.00 $560.00 08-Aug-31 End of August Expenses:Books $80.00 $640.00 -08-Sep-01 September Expenses:Books $90.00 $730.00 -08-Sep-01 Budget transaction Expenses:Books $-10.00 $720.00 +08-Sep-01 Budget transaction Expenses:Books $-10.00 $630.00 +08-Sep-01 September Expenses:Books $90.00 $720.00 08-Sep-30 End of September Expenses:Books $90.00 $810.00 -08-Oct-01 October Expenses:Books $100.00 $910.00 -08-Oct-01 Budget transaction Expenses:Books $-10.00 $900.00 +08-Oct-01 Budget transaction Expenses:Books $-10.00 $800.00 +08-Oct-01 October Expenses:Books $100.00 $900.00 08-Oct-31 End of October Expenses:Books $100.00 $1000.00 -08-Nov-01 November Expenses:Books $110.00 $1110.00 -08-Nov-01 Budget transaction Expenses:Books $-10.00 $1100.00 +08-Nov-01 Budget transaction Expenses:Books $-10.00 $990.00 +08-Nov-01 November Expenses:Books $110.00 $1100.00 08-Nov-30 End of November Expenses:Books $110.00 $1210.00 -08-Dec-01 December Expenses:Books $120.00 $1330.00 -08-Dec-01 Budget transaction Expenses:Books $-10.00 $1320.00 +08-Dec-01 Budget transaction Expenses:Books $-10.00 $1200.00 +08-Dec-01 December Expenses:Books $120.00 $1320.00 08-Dec-31 End of December Expenses:Books $120.00 $1440.00 -09-Jan-01 January Expenses:Books $10.00 $1450.00 -09-Jan-01 Budget transaction Expenses:Books $-10.00 $1440.00 +09-Jan-01 Budget transaction Expenses:Books $-10.00 $1430.00 +09-Jan-01 January Expenses:Books $10.00 $1440.00 09-Jan-31 End of January Expenses:Books $10.00 $1450.00 -09-Feb-01 February Expenses:Books $20.00 $1470.00 -09-Feb-01 Budget transaction Expenses:Books $-10.00 $1460.00 +09-Feb-01 Budget transaction Expenses:Books $-10.00 $1440.00 +09-Feb-01 February Expenses:Books $20.00 $1460.00 09-Feb-28 End of February Expenses:Books $20.00 $1480.00 -09-Mar-01 March Expenses:Books $30.00 $1510.00 -09-Mar-01 Budget transaction Expenses:Books $-10.00 $1500.00 +09-Mar-01 Budget transaction Expenses:Books $-10.00 $1470.00 +09-Mar-01 March Expenses:Books $30.00 $1500.00 09-Mar-31 End of March Expenses:Books $30.00 $1530.00 -09-Apr-01 April Expenses:Books $40.00 $1570.00 -09-Apr-01 Budget transaction Expenses:Books $-10.00 $1560.00 +09-Apr-01 Budget transaction Expenses:Books $-10.00 $1520.00 +09-Apr-01 April Expenses:Books $40.00 $1560.00 09-Apr-30 End of April Expenses:Books $40.00 $1600.00 -09-May-01 May Expenses:Books $50.00 $1650.00 -09-May-01 Budget transaction Expenses:Books $-10.00 $1640.00 +09-May-01 Budget transaction Expenses:Books $-10.00 $1590.00 +09-May-01 May Expenses:Books $50.00 $1640.00 09-May-31 End of May Expenses:Books $50.00 $1690.00 -09-Jun-01 June Expenses:Books $60.00 $1750.00 -09-Jun-01 Budget transaction Expenses:Books $-10.00 $1740.00 +09-Jun-01 Budget transaction Expenses:Books $-10.00 $1680.00 +09-Jun-01 June Expenses:Books $60.00 $1740.00 09-Jun-30 End of June Expenses:Books $60.00 $1800.00 -09-Jul-01 July Expenses:Books $70.00 $1870.00 -09-Jul-01 Budget transaction Expenses:Books $-10.00 $1860.00 +09-Jul-01 Budget transaction Expenses:Books $-10.00 $1790.00 +09-Jul-01 July Expenses:Books $70.00 $1860.00 09-Jul-31 End of July Expenses:Books $70.00 $1930.00 -09-Aug-01 August Expenses:Books $80.00 $2010.00 -09-Aug-01 Budget transaction Expenses:Books $-10.00 $2000.00 +09-Aug-01 Budget transaction Expenses:Books $-10.00 $1920.00 +09-Aug-01 August Expenses:Books $80.00 $2000.00 09-Aug-31 End of August Expenses:Books $80.00 $2080.00 -09-Sep-01 September Expenses:Books $90.00 $2170.00 -09-Sep-01 Budget transaction Expenses:Books $-10.00 $2160.00 +09-Sep-01 Budget transaction Expenses:Books $-10.00 $2070.00 +09-Sep-01 September Expenses:Books $90.00 $2160.00 09-Sep-30 End of September Expenses:Books $90.00 $2250.00 -09-Oct-01 October Expenses:Books $100.00 $2350.00 -09-Oct-01 Budget transaction Expenses:Books $-10.00 $2340.00 +09-Oct-01 Budget transaction Expenses:Books $-10.00 $2240.00 +09-Oct-01 October Expenses:Books $100.00 $2340.00 09-Oct-31 End of October Expenses:Books $100.00 $2440.00 -09-Nov-01 November Expenses:Books $110.00 $2550.00 -09-Nov-01 Budget transaction Expenses:Books $-10.00 $2540.00 +09-Nov-01 Budget transaction Expenses:Books $-10.00 $2430.00 +09-Nov-01 November Expenses:Books $110.00 $2540.00 09-Nov-30 End of November Expenses:Books $110.00 $2650.00 -09-Dec-01 December Expenses:Books $120.00 $2770.00 -09-Dec-01 Budget transaction Expenses:Books $-10.00 $2760.00 +09-Dec-01 Budget transaction Expenses:Books $-10.00 $2640.00 +09-Dec-01 December Expenses:Books $120.00 $2760.00 09-Dec-31 End of December Expenses:Books $120.00 $2880.00 >>>2 === 0 diff --git a/test/regress/7F3650FD.test b/test/regress/7F3650FD.test new file mode 100644 index 00000000..0eb3a96f --- /dev/null +++ b/test/regress/7F3650FD.test @@ -0,0 +1,50 @@ +period --now=2010/11/01 12/01 +<<< +>>>1 +global details => + + start: 09-Dec-01 + end: 09-Dec-02 + factor: 1 +>>>2 +=== 0 +period --now=2010/11/01 10/01 +<<< +>>>1 +global details => + + start: 10-Oct-01 + end: 10-Oct-02 + factor: 1 +>>>2 +=== 0 +period --now=2010/11/01 2009/10 +<<< +>>>1 +global details => + + start: 09-Oct-01 + end: 09-Nov-01 + factor: 1 +>>>2 +=== 0 +period --now=2010/11/01 2009/10/01 +<<< +>>>1 +global details => + + start: 09-Oct-01 + end: 09-Oct-02 + factor: 1 +>>>2 +=== 0 +period --now=2010/11/01 2009 +<<< +>>>1 +global details => + + start: 09-Jan-01 + end: 10-Jan-01 + factor: 1 +>>>2 +=== 0 -- cgit v1.2.3 From 0a9cc833adebadc876e3e09f1c344b08b23e59f8 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 2 Nov 2009 01:59:33 -0500 Subject: Added a regression test relating to forecasting --- test/regress/E627C594.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/regress/E627C594.test (limited to 'test') diff --git a/test/regress/E627C594.test b/test/regress/E627C594.test new file mode 100644 index 00000000..0dfbf778 --- /dev/null +++ b/test/regress/E627C594.test @@ -0,0 +1,18 @@ +reg --forecast-while="d<[2010/03/01]" --now=2009/11/01 +<<< +~ Monthly + Expenses:Food $500.00 + Assets + +2009/11/01 Sample + Expenses:Food:Dining $20.00 + Assets +>>>1 +09-Nov-01 Sample Expenses:Food:Dining $20.00 $20.00 + Assets $-20.00 0 +10-Jan-01 Forecast transaction Expenses:Food $500.00 $500.00 +10-Jan-01 Forecast transaction Assets $-500.00 0 +10-Feb-01 Forecast transaction Expenses:Food $500.00 $500.00 +10-Feb-01 Forecast transaction Assets $-500.00 0 +>>>2 +=== 0 -- cgit v1.2.3 From 5e1886b147df2e3265304246d06272e6bac049a5 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 2 Nov 2009 04:41:32 -0500 Subject: Only --args-only is needed in LedgerHarness.py --- test/LedgerHarness.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py index 7e8cfa3d..8a5af123 100755 --- a/test/LedgerHarness.py +++ b/test/LedgerHarness.py @@ -53,10 +53,8 @@ class LedgerHarness: if columns: insert += ' --columns=80' - command = re.sub('\$ledger', '%s%s %s %s %s %s' % \ - (self.ledger, insert, '--args-only', - '--no-color', '--pager=none', - '--date-format=%y-%b-%d'), command) + command = re.sub('\$ledger', '%s%s %s' % \ + (self.ledger, insert, '--args-only'), command) return Popen(command, shell=True, close_fds=True, env=env, stdin=PIPE, stdout=PIPE, stderr=PIPE) -- cgit v1.2.3