From ddfabe06924bab1af33340f3afc3230b29d575ee Mon Sep 17 00:00:00 2001 From: Martin Michlmayr Date: Mon, 14 Jul 2014 20:42:44 -0400 Subject: Update tests for fix for bug #713 John's fix for bug #713 changes the way basis cost are calculated. The patch also fixes #712, which caused ledger to create automatic Equity:Capital Gains that were not correct. Update the test cases accordingly after verifying the new output. --- test/regress/C0212EAC.test | 3 --- test/regress/CAE63F5C-b.test | 3 +-- test/regress/CAE63F5C-c.test | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) (limited to 'test/regress') diff --git a/test/regress/C0212EAC.test b/test/regress/C0212EAC.test index 9a572ef6..e77107d7 100644 --- a/test/regress/C0212EAC.test +++ b/test/regress/C0212EAC.test @@ -27,7 +27,4 @@ test reg -5.00 GBP {=1.40 EUR} Income:Gain -0.50 EUR 5.00 GBP -5.00 GBP {=1.40 EUR} - Equity:Capital Gains 0.50 EUR 0.50 EUR - 5.00 GBP - -5.00 GBP {=1.40 EUR} end test diff --git a/test/regress/CAE63F5C-b.test b/test/regress/CAE63F5C-b.test index c0b7efd8..e1ea049e 100644 --- a/test/regress/CAE63F5C-b.test +++ b/test/regress/CAE63F5C-b.test @@ -7,9 +7,8 @@ test bal -X $ $272.67 Accrued $-271.54 Assets - $6.45 Equity:Capital Gains $5.32 Expenses $-6.45 Income:Currency Conversion -------------------- - $6.45 + 0 end test diff --git a/test/regress/CAE63F5C-c.test b/test/regress/CAE63F5C-c.test index 64728544..db318b2d 100644 --- a/test/regress/CAE63F5C-c.test +++ b/test/regress/CAE63F5C-c.test @@ -7,9 +7,8 @@ test bal -X $ $272.67 Accrued $-271.54 Assets - $6.45 Equity:Capital Gains $5.32 Expenses $-6.45 Income:Currency Conversion -------------------- - $6.46 + 0 end test -- cgit v1.2.3 From 7241b1f62b8a441b11ea96a7a45674c1e11fecd8 Mon Sep 17 00:00:00 2001 From: Martin Michlmayr Date: Mon, 14 Jul 2014 20:44:05 -0400 Subject: Add regression tests for bug #713 --- test/regress/713-a.test | 40 ++++++++++++++++++++++++++++++++++++++++ test/regress/713-b.test | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 test/regress/713-a.test create mode 100644 test/regress/713-b.test (limited to 'test/regress') diff --git a/test/regress/713-a.test b/test/regress/713-a.test new file mode 100644 index 00000000..b3953a84 --- /dev/null +++ b/test/regress/713-a.test @@ -0,0 +1,40 @@ + +2011-01-01 * Opening balance + Assets:Cash 25.00 GBP + Equity:Opening balance -25.00 GBP + +2011-02-01 * Buy 1 AAA for 10.00 GBP + Assets:Investments 1 AAA {10.00 GBP} + Assets:Cash -10.00 GBP + +2011-03-07 * Sell one AAA with a gain + Assets:Cash 12.00 GBP + Assets:Investments -1 AAA {10.00 GBP} @@ 12.00 GBP + Income:Capital gains -2.00 GBP + +2011-04-01 * Buy 1 BBB for 15.00 GBP + Assets:Investments 1 BBB {15.00 GBP} + Assets:Cash -15.00 GBP + +test bal -B Assets:Investments -p "until 2011-02-20" + 10.00 GBP Assets:Investments +end test + +test bal -B Assets:Investments -p "until 2011-03-20" +end test + +test bal -B Assets:Investments -p "until 2011-04-20" + 15.00 GBP Assets:Investments +end test + +test bal Assets:Investments -p "until 2011-02-20" + 1 AAA Assets:Investments +end test + +test bal Assets:Investments -p "until 2011-03-20" +end test + +test bal Assets:Investments -p "until 2011-04-20" + 1 BBB Assets:Investments +end test + diff --git a/test/regress/713-b.test b/test/regress/713-b.test new file mode 100644 index 00000000..36685b27 --- /dev/null +++ b/test/regress/713-b.test @@ -0,0 +1,48 @@ + +2014-01-01 * Opening balances + Assets:Cash 100.00 GBP + Equity:Opening balances + +2014-02-01 * Buy 1 AAA for 10 GBP + Assets:Investments 1 AAA @ 10.00 GBP + Assets:Cash -10.00 GBP + +2014-03-01 * Buy 1 AAA for 20 GBP + Assets:Investments 1 AAA @ 20.00 GBP + Assets:Cash -20.00 GBP + +; Let's say the second purchase attracts an equalisation of 2.00 GBP. +; This means that the purchase price from now on should be 18.00 +; rather than 20.00 GBP. So we add a new share with that price and +; the original date, and remove the existing share at the old price; the +; difference of 2.00 GBP is the equalisation received, which is paid to +; the account. +2014-04-16 * Dividend (Equalisation) from AAA + Assets:Investments 1 AAA {18.00 GBP} [2014-03-01] @@ 18.00 GBP + Assets:Investments -1 AAA {20.00 GBP} [2014-03-01] @@ 20.00 GBP + Assets:Broker 2.00 GBP + +test bal -B Assets:Investment -p "until 2014-02-20" + 10.00 GBP Assets:Investments +end test + +test bal -B Assets:Investment -p "until 2014-03-20" + 30.00 GBP Assets:Investments +end test + +test bal -B Assets:Investment -p "until 2014-04-20" + 28.00 GBP Assets:Investments +end test + +test bal Assets:Investment -p "until 2014-02-20" + 1 AAA Assets:Investments +end test + +test bal Assets:Investment -p "until 2014-03-20" + 2 AAA Assets:Investments +end test + +test bal Assets:Investment -p "until 2014-04-20" + 2 AAA Assets:Investments +end test + -- cgit v1.2.3 From a44572f3ecc8649539d574bd7171597644d1e92e Mon Sep 17 00:00:00 2001 From: Martin Michlmayr Date: Mon, 14 Jul 2014 20:44:48 -0400 Subject: Add a regression test for bug #712 --- test/regress/712-a.test | 10 ++++++++++ test/regress/712-b.test | 22 ++++++++++++++++++++++ test/regress/712.test | 10 ---------- 3 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 test/regress/712-a.test create mode 100644 test/regress/712-b.test delete mode 100644 test/regress/712.test (limited to 'test/regress') diff --git a/test/regress/712-a.test b/test/regress/712-a.test new file mode 100644 index 00000000..e0dbfa5a --- /dev/null +++ b/test/regress/712-a.test @@ -0,0 +1,10 @@ +2012/09/27 PLN Payment + Accrued 3,547.65 PLN {=$0.315786} + Accrued 5,320.06 PLN {=$0.315786} + Assets:Checking $-2,800.30 + +test -X $ -V reg +12-Sep-27 PLN Payment Accrued $1,120.30 $1,120.30 + Accrued $1,680.00 $2,800.30 + Assets:Checking $-2,800.30 0 +end test diff --git a/test/regress/712-b.test b/test/regress/712-b.test new file mode 100644 index 00000000..7f183b5f --- /dev/null +++ b/test/regress/712-b.test @@ -0,0 +1,22 @@ + +2011-01-01 * Opening balance + Assets:Cash 10.00 GBP + Equity:Opening balance -10.00 GBP + +2011-02-01 * Buy 1 AAA for 10.00 GBP + Assets:Investments 1 AAA {10.00 GBP} + Assets:Cash -10.00 GBP + +2011-12-07 * Sell AAA with a gain + Assets:Cash 12.00 GBP + Assets:Investments -1 AAA {10.00 GBP} @@ 12.00 GBP + Income:Capital gains -2.00 GBP + +test bal + 12.00 GBP Assets:Cash + -10.00 GBP Equity:Opening balance + -2.00 GBP Income:Capital gains +-------------------- + 0 +end test + diff --git a/test/regress/712.test b/test/regress/712.test deleted file mode 100644 index e0dbfa5a..00000000 --- a/test/regress/712.test +++ /dev/null @@ -1,10 +0,0 @@ -2012/09/27 PLN Payment - Accrued 3,547.65 PLN {=$0.315786} - Accrued 5,320.06 PLN {=$0.315786} - Assets:Checking $-2,800.30 - -test -X $ -V reg -12-Sep-27 PLN Payment Accrued $1,120.30 $1,120.30 - Accrued $1,680.00 $2,800.30 - Assets:Checking $-2,800.30 0 -end test -- cgit v1.2.3