diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/baseline/feat-balance-assignments.test | 37 | ||||
-rw-r--r-- | test/baseline/feat-fixated-prices.test (renamed from test/baseline/feature-fixated-prices.test) | 0 | ||||
-rw-r--r-- | test/input/drewr.dat | 4 | ||||
-rw-r--r-- | test/regress/04C5E1CA.test | 18 | ||||
-rw-r--r-- | test/regress/5A03CFC3.test | 72 | ||||
-rw-r--r-- | test/regress/5FBF2ED8.test | 20 | ||||
-rw-r--r-- | test/regress/647D5DB9.test | 17 | ||||
-rw-r--r-- | test/regress/6DAB9FE3.test | 10 | ||||
-rw-r--r-- | test/regress/727B2DF8.test | 81 | ||||
-rw-r--r-- | test/regress/793F6BF0.test | 52 | ||||
-rw-r--r-- | test/regress/B68FFB0D.test | 15 | ||||
-rw-r--r-- | test/regress/C523E23F.test | 21 | ||||
-rw-r--r-- | test/regress/D943AE0F.test | 13 | ||||
-rw-r--r-- | test/unit/t_amount.cc | 40 |
14 files changed, 380 insertions, 20 deletions
diff --git a/test/baseline/feat-balance-assignments.test b/test/baseline/feat-balance-assignments.test new file mode 100644 index 00000000..74fe9ddb --- /dev/null +++ b/test/baseline/feat-balance-assignments.test @@ -0,0 +1,37 @@ +bal +<<< +2009/01/01 Entry + Assets:Cash $10,000.00 + Equity:Opening Balances + +2009/02/01 Entry + Expenses:Cash $100.00 + Assets:Cash + +2009/02/02 Entry + Expenses:Cash $100.00 + Assets:Cash + +2009/02/03 Entry + Expenses:Cash $100.00 + Assets:Cash $-100.00 = $9,700.00 + +2009/02/04 Entry + Expenses:Cash $100.00 + Assets:Cash $-100.00 = $9,600.00 + +2009/02/05 Entry + Expenses:Cash $100.00 + Assets:Cash + +2009/02/05 Entry + Expenses:Cash + Assets:Cash = ($4,000.00 + $100.00) +>>>1 + $4,100.00 Assets:Cash + $-10,000.00 Equity:Opening Balances + $5,900.00 Expenses:Cash +-------------------- + 0 +>>>2 +=== 0 diff --git a/test/baseline/feature-fixated-prices.test b/test/baseline/feat-fixated-prices.test index 11330dea..11330dea 100644 --- a/test/baseline/feature-fixated-prices.test +++ b/test/baseline/feat-fixated-prices.test diff --git a/test/input/drewr.dat b/test/input/drewr.dat index 937daa5c..13b88844 100644 --- a/test/input/drewr.dat +++ b/test/input/drewr.dat @@ -57,3 +57,7 @@ 2004/01/27 Book Store Expenses:Books $20.00 Liabilities:MasterCard + +2004/02/01 Sale + Assets:Checking:Business $ 30.00 + Income:Sales diff --git a/test/regress/04C5E1CA.test b/test/regress/04C5E1CA.test new file mode 100644 index 00000000..729ae6bf --- /dev/null +++ b/test/regress/04C5E1CA.test @@ -0,0 +1,18 @@ +reg +<<< +2009/04/04 CS Club Sign + Expenses:School:CS Club:Home Depot:4" Brush 2 @ $3.97 + Liabilities:Mastercard + +2009/04/04 CS Club Sign + Expenses:School:CS Club:Home Depot:4" Brush (2 * $3.97) + Liabilities:Mastercard +>>>1 +09-Apr-04 CS Club Sign Ex:Sc:CS:Ho:4" Brush 2 2 + Liabilities:Mastercard $-7.94 2 + $-7.94 +09-Apr-04 CS Club Sign Ex:Sc:CS:Ho:4" Brush $7.94 2 + Liabilities:Mastercard $-7.94 2 + $-7.94 +>>>2 +=== 0 diff --git a/test/regress/5A03CFC3.test b/test/regress/5A03CFC3.test new file mode 100644 index 00000000..a5a12af3 --- /dev/null +++ b/test/regress/5A03CFC3.test @@ -0,0 +1,72 @@ +bal assets +<<< += account =~ /^Income/ + (Liabilities:Tithe) 0.12 + +~ Monthly + Assets:Checking $500.00 + Income:Salary + +2003/12/01 * Checking balance + Assets:Checking $1,000.00 + Equity:Opening Balances + +2003/12/20 Organic Co-op + Expenses:Food:Groceries $ 37.50 ; [=2004/01/01] + Expenses:Food:Groceries $ 37.50 ; [=2004/02/01] + Expenses:Food:Groceries $ 37.50 ; [=2004/03/01] + Expenses:Food:Groceries $ 37.50 ; [=2004/04/01] + Expenses:Food:Groceries $ 37.50 ; [=2004/05/01] + Expenses:Food:Groceries $ 37.50 ; [=2004/06/01] + Assets:Checking $ -225.00 + +2003/12/28=2004/01/01 Acme Mortgage + Liabilities:Mortgage:Principal $ 200.00 + Expenses:Interest:Mortgage $ 500.00 + Expenses:Escrow $ 300.00 + Assets:Checking $ -1000.00 + +2004/01/02 Grocery Store + Expenses:Food:Groceries $ 65.00 + Assets:Checking + +2004/01/05 Employer + Assets:Checking $ 2000.00 + Income:Salary + +2004/01/14 Bank + ; Regular monthly savings transfer + Assets:Savings $ 300.00 + Assets:Checking + +2004/01/19 Grocery Store + Expenses:Food:Groceries $ 44.00 + Assets:Checking + +2004/01/25 Bank + ; Transfer to cover car purchase + Assets:Checking $ 5,500.00 + Assets:Savings + ; :nobudget: + +2004/01/25 Tom's Used Cars + Expenses:Auto $ 5,500.00 + ; :nobudget: + Assets:Checking + +2004/01/27 Book Store + Expenses:Books $20.00 + Liabilities:MasterCard + +2004/02/01 Sale + Assets:Checking:Business $ 30.00 + Income:Sales +>>>1 + $ -3,804.00 Assets + $ 1,396.00 Checking + $ 30.00 Business + $ -5,200.00 Savings +-------------------- + $ -3,804.00 +>>>2 +=== 0 diff --git a/test/regress/5FBF2ED8.test b/test/regress/5FBF2ED8.test new file mode 100644 index 00000000..78df5a6e --- /dev/null +++ b/test/regress/5FBF2ED8.test @@ -0,0 +1,20 @@ +bal -B +<<< +2008/01/01 * Checking balance + Assets:Bank:Checking £0.00 + Equity:Opening Balances + +2008/02/02 Salary + Income:Employer £-334.00 + Assets:Bank:Checking $512.85 @@ £334.00 + +2008/03/02 Salary + Income:Employer £-248.07 + Assets:Bank:Checking $404.82 @@ £248.07 +>>>1 + £582.07 Assets:Bank:Checking + £-582.07 Income:Employer +-------------------- + 0 +>>>2 +=== 0 diff --git a/test/regress/647D5DB9.test b/test/regress/647D5DB9.test new file mode 100644 index 00000000..3f187b36 --- /dev/null +++ b/test/regress/647D5DB9.test @@ -0,0 +1,17 @@ +bal --end 2008/12/31 -JV bal Equities +<<< +2008/01/01 * Purchase Apple shares + Equities 1000 AAPL @ $2 + Cash + +2008/06/30 * Sell some Apple shares + Equities -500 AAPL @ $2.5 + Cash + +P 2008/10/01 02:18:02 AAPL $3 +P 2009/01/31 02:18:02 AAPL $4 +P 3000/01/01 02:18:02 APPL $100 +>>>1 +2008-12-31 1500 +>>>2 +=== 0 diff --git a/test/regress/6DAB9FE3.test b/test/regress/6DAB9FE3.test new file mode 100644 index 00000000..50b944ae --- /dev/null +++ b/test/regress/6DAB9FE3.test @@ -0,0 +1,10 @@ +reg -E +<<< +2009/01/01 Sample + assets 0 FOO @ $8.88 + equity +>>>1 +09-Jan-01 Sample assets 0 0 + equity 0 0 +>>>2 +=== 0 diff --git a/test/regress/727B2DF8.test b/test/regress/727B2DF8.test new file mode 100644 index 00000000..599090a1 --- /dev/null +++ b/test/regress/727B2DF8.test @@ -0,0 +1,81 @@ +reg --color +<<< +N $ + += 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/03=2004/05/01 * Investment balance + Assets:Brokerage 50 AAPL @ $30.00 + Equity:Opening Balances + +2004/05/14 * Páy dày + Assets:Bank:Checking 500.00€ + Income:Salary + +2004/05/14 * Another dày in which there is Páying + Asséts:Bánk:Chécking:Asséts:Bánk:Chécking $500.00 + Income:Salary + +2004/05/14 * Another dày in which there is Páying + Русский язык:Русский язык:Русский язык:Русский язык $1000.00 + Income:Salary + +2004/05/27 Book Store + Expenses:Books $20.00 + Expenses:Cards $40.00 + Expenses:Docs $30.00 + Liabilities:MasterCard + +2004/05/27 (100) Credit card company + ; This is an xact note! + ; Sample: Value + Liabilities:MasterCard $20.00 + ; This is a posting note! + ; Sample: Another Value + ; :MyTag: + Assets:Bank:Checking + ; :AnotherTag: +>>>1 +04-May-01 Checking balance [34mAssets:Bank:Checking [0m $1,000.00 $1,000.00 + [34mEq:Opening Balances [0m [31m$-1,000.00[0m 0 +04-May-03 Investment balance [34mAssets:Brokerage [0m 50 AAPL 50 AAPL + [34mEq:Opening Balances [0m [31m$-1,500.00[0m [31m$-1,500.00[0m + 50 AAPL +04-May-14 Páy dày [34mAssets:Bank:Checking [0m 500.00€ [31m$-1,500.00[0m + 50 AAPL + 500.00€ + [34mIncome:Salary [0m [31m-500.00€[0m [31m$-1,500.00[0m + 50 AAPL +04-May-14 Another dày in whic.. [34m..Bá:Ch:As:Bá:Chécking[0m $500.00 [31m$-1,000.00[0m + 50 AAPL + [34mIncome:Salary [0m [31m$-500.00[0m [31m$-1,500.00[0m + 50 AAPL +04-May-14 Another dày in whic.. [34mРу:Ру:Ру:Русский язык [0m $1,000.00 [31m$-500.00[0m + 50 AAPL + [34mIncome:Salary [0m [31m$-1,000.00[0m [31m$-1,500.00[0m + 50 AAPL +04-May-27 [1mBook Store [0m [34mExpenses:Books [0m $20.00 [31m$-1,480.00[0m + 50 AAPL + [34mExpenses:Cards [0m $40.00 [31m$-1,440.00[0m + 50 AAPL + [34mExpenses:Docs [0m $30.00 [31m$-1,410.00[0m + 50 AAPL + [34mLiabilities:MasterCard[0m [31m$-90.00[0m [31m$-1,500.00[0m + 50 AAPL + [34m(Liabilities:Taxes) [0m [31m$-2.00[0m [31m$-1,502.00[0m + 50 AAPL +04-May-27 [1mCredit card company [0m [34mLiabilities:MasterCard[0m $20.00 [31m$-1,482.00[0m + 50 AAPL + [34mAssets:Bank:Checking [0m [31m$-20.00[0m [31m$-1,502.00[0m + 50 AAPL +>>>2 +=== 0 diff --git a/test/regress/793F6BF0.test b/test/regress/793F6BF0.test new file mode 100644 index 00000000..a4e1234c --- /dev/null +++ b/test/regress/793F6BF0.test @@ -0,0 +1,52 @@ +entry 2009/03/15 book 10 +<<< +N $ + += 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/03=2004/05/01 * Investment balance + Assets:Brokerage 50 AAPL @ $30.00 + Equity:Opening Balances + +2004/05/14 * Páy dày + Assets:Bank:Checking 500.00€ + Income:Salary + +2004/05/14 * Another dày in which there is Páying + Asséts:Bánk:Chécking:Asséts:Bánk:Chécking $500.00 + Income:Salary + +2004/05/14 * Another dày in which there is Páying + Русский язык:Русский язык:Русский язык:Русский язык $1000.00 + Income:Salary + +2004/05/27 Book Store + Expenses:Books $20.00 + Expenses:Cards $40.00 + Expenses:Docs $30.00 + Liabilities:MasterCard + +2004/05/27 (100) Credit card company + ; This is an xact note! + ; Sample: Value + Liabilities:MasterCard $20.00 + ; This is a posting note! + ; Sample: Another Value + ; :MyTag: + Assets:Bank:Checking + ; :AnotherTag: +>>>1 +2009/03/15 Book Store + Expenses:Books $10.00 + Liabilities:MasterCard +>>>2 +=== 0 diff --git a/test/regress/B68FFB0D.test b/test/regress/B68FFB0D.test new file mode 100644 index 00000000..3a43df4c --- /dev/null +++ b/test/regress/B68FFB0D.test @@ -0,0 +1,15 @@ +print +<<< +D $1,000.00 + +2009/01/01 Sample + assets 134.123 FOO @ $8.88 + assets 100 BAR @ $8.88 + equity +>>>1 +2009/01/01 Sample + assets 134.123 FOO @ $8.88 + assets 100 BAR @ $8.88 + equity +>>>2 +=== 0 diff --git a/test/regress/C523E23F.test b/test/regress/C523E23F.test new file mode 100644 index 00000000..b8b08e00 --- /dev/null +++ b/test/regress/C523E23F.test @@ -0,0 +1,21 @@ +bal +<<< +D 1.000,00€ + +2009/03/16 * denn's + ; Kauf: Yogi-Tee + Aufwand:Einkauf:Lebensmittel 17,94€ + Aktiva:Bank:Girokonto + +2009/03/24 Ansparen + Aktiva:Bank:Sparkonto 800,00€ + Aktiva:Bank:Girokonto +>>>1 + -17,94€ Aktiva:Bank + -817,94€ Girokonto + 800,00€ Sparkonto + 17,94€ Aufwand:Einkauf:Lebensmittel +-------------------- + 0 +>>>2 +=== 0 diff --git a/test/regress/D943AE0F.test b/test/regress/D943AE0F.test new file mode 100644 index 00000000..3e568db6 --- /dev/null +++ b/test/regress/D943AE0F.test @@ -0,0 +1,13 @@ +reg -V --end=2009/06/16 +<<< +2008/04/15 * Paid expenses back from cie. + Expenses:Cie-Reimbursements 2000 CAD @ 1.10 EUR + Assets:Checking + +P 2008/04/20 00:00:00 CAD 1.20 EUR +>>>1 +08-Apr-15 Paid expenses back .. Ex:Cie-Reimbursements 2200.00 EUR 2200.00 EUR + Assets:Checking -2200.00 EUR 0 +09-Jun-16 Commodities revalued <Revalued> 200.00 EUR 200.00 EUR +>>>2 +=== 0 diff --git a/test/unit/t_amount.cc b/test/unit/t_amount.cc index 8aa67137..ba863ca7 100644 --- a/test/unit/t_amount.cc +++ b/test/unit/t_amount.cc @@ -866,7 +866,7 @@ void AmountTestCase::testIntegerDivision() x1 /= amount_t(456L); assertEqual(string("0.269737"), x1.to_string()); x1 /= 456L; - assertEqual(string("0.000591528162511542"), x1.to_string()); + assertEqual(string("0.000591528163"), x1.to_string()); amount_t x4("123456789123456789123456789"); amount_t y4("56"); @@ -889,32 +889,32 @@ void AmountTestCase::testFractionalDivision() amount_t y1("456.456"); assertThrow(x1 / 0L, amount_error); - assertEqual(string("0.00812195934"), (amount_t("1.0") / x1).to_string()); - assertEqual(string("0.00812195934"), (amount_t("1.0") / x1).to_string()); + assertEqual(string("0.0081219593"), (amount_t("1.0") / x1).to_string()); + assertEqual(string("0.0081219593"), (amount_t("1.0") / x1).to_string()); assertEqual(x1, x1 / amount_t("1.0")); - assertEqual(string("0.00812195934"), (amount_t("1.0") / x1).to_string()); - assertEqual(string("0.00812195934"), (amount_t("1.0") / x1).to_string()); + assertEqual(string("0.0081219593"), (amount_t("1.0") / x1).to_string()); + assertEqual(string("0.0081219593"), (amount_t("1.0") / x1).to_string()); assertEqual(- x1, x1 / amount_t("-1.0")); - assertEqual(string("-0.00812195934"), (amount_t("-1.0") / x1).to_string()); - assertEqual(string("-0.00812195934"), (amount_t("-1.0") / x1).to_string()); - assertEqual(string("0.269736842105263"), (x1 / y1).to_string()); - assertEqual(string("3.707317073170732"), (y1 / x1).to_string()); - assertEqual(string("0.269736842105263"), (x1 / amount_t("456.456")).to_string()); - assertEqual(string("3.707317073170732"), (amount_t("456.456") / x1).to_string()); - assertEqual(string("3.707317073170732"), (amount_t("456.456") / x1).to_string()); + assertEqual(string("-0.0081219593"), (amount_t("-1.0") / x1).to_string()); + assertEqual(string("-0.0081219593"), (amount_t("-1.0") / x1).to_string()); + assertEqual(string("0.269736842105"), (x1 / y1).to_string()); + assertEqual(string("3.707317073171"), (y1 / x1).to_string()); + assertEqual(string("0.269736842105"), (x1 / amount_t("456.456")).to_string()); + assertEqual(string("3.707317073171"), (amount_t("456.456") / x1).to_string()); + assertEqual(string("3.707317073171"), (amount_t("456.456") / x1).to_string()); x1 /= amount_t("456.456"); - assertEqual(string("0.269736842105263"), x1.to_string()); + assertEqual(string("0.269736842105"), x1.to_string()); x1 /= amount_t("456.456"); - assertEqual(string("0.000590937225286255757169884601508201951"), x1.to_string()); + assertEqual(string("0.000590937225286255757"), x1.to_string()); x1 /= 456L; - assertEqual(string("0.00000129591496773301701133746621429767819329289006668733529828959526392431755859036"), x1.to_string()); + assertEqual(string("0.000001295914967733017011337"), x1.to_string()); amount_t x4("1234567891234567.89123456789"); amount_t y4("56.789"); assertEqual(amount_t("1.0"), x4 / x4); - assertEqual(string("21739560323910.7554497273748437197344556164046"), (x4 / y4).to_string()); + assertEqual(string("21739560323910.75544972737484371973"), (x4 / y4).to_string()); assertValid(x1); assertValid(y1); @@ -946,9 +946,9 @@ void AmountTestCase::testCommodityDivision() // Internal amounts retain their precision, even when being // converted to strings assertEqual(string("$0.99727201"), (x1 / x2).to_fullstring()); - assertEqual(string("$1.00273545321637426901"), (x2 / x1).to_fullstring()); + assertEqual(string("$1.00273545321637"), (x2 / x1).to_fullstring()); assertEqual(string("$1.00"), (x1 / x2).to_string()); - assertEqual(string("$1.00273545321637426901"), (x2 / x1).to_string()); + assertEqual(string("$1.00273545321637"), (x2 / x1).to_string()); assertThrow(x1 / x0, amount_error); assertThrow(x0 / x1, amount_error); @@ -970,9 +970,9 @@ void AmountTestCase::testCommodityDivision() amount_t x7(internalAmount("$123456789123456789.123456789123456789")); assertEqual(amount_t("$1"), x7 / x7); - assertEqual(string("$0.0019216115121765559608381226612019501046413574469262"), + assertEqual(string("$0.0019216115121765559608381226612019501"), (x6 / x7).to_fullstring()); - assertEqual(string("$520.39654928343335571379527154924040947271699678158689736256"), + assertEqual(string("$520.39654928343335571379527154924040947272"), (x7 / x6).to_fullstring()); assertValid(x1); |