summaryrefslogtreecommitdiff
path: root/tests/python/corelib/numerics/BasicAmount.py
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-17 07:33:48 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:35:36 -0400
commitf5956311af0425b6d1fd76752e84bd81a4c8ccd1 (patch)
treee19b377e5c9c39578bd6183e29b89896c50145af /tests/python/corelib/numerics/BasicAmount.py
parent0f2cad4cab7ef99e1ad33be34ea813213da7288d (diff)
downloadfork-ledger-f5956311af0425b6d1fd76752e84bd81a4c8ccd1.tar.gz
fork-ledger-f5956311af0425b6d1fd76752e84bd81a4c8ccd1.tar.bz2
fork-ledger-f5956311af0425b6d1fd76752e84bd81a4c8ccd1.zip
Completed commodity math tests.
Diffstat (limited to 'tests/python/corelib/numerics/BasicAmount.py')
-rw-r--r--tests/python/corelib/numerics/BasicAmount.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/tests/python/corelib/numerics/BasicAmount.py b/tests/python/corelib/numerics/BasicAmount.py
index 38cfacca..a485dca4 100644
--- a/tests/python/corelib/numerics/BasicAmount.py
+++ b/tests/python/corelib/numerics/BasicAmount.py
@@ -326,16 +326,16 @@ class BasicAmountTestCase(unittest.TestCase):
self.assertEqual(- x1, x1 / -1)
self.assertEqual(- amount("0.008130"), amount(-1) / x1)
self.assertEqual(- amount("0.008130"), -1 / x1)
- self.assertEqual(amount("0.269736"), x1 / y1)
+ self.assertEqual(amount("0.269737"), x1 / y1)
self.assertEqual(amount("3.707317"), y1 / x1)
- self.assertEqual(amount("0.269736"), x1 / 456)
+ self.assertEqual(amount("0.269737"), x1 / 456)
self.assertEqual(amount("3.707317"), amount(456) / x1)
self.assertEqual(amount("3.707317"), 456 / x1)
x1 /= amount(456)
- self.assertEqual(amount("0.269736"), x1)
+ self.assertEqual(amount("0.269737"), x1)
x1 /= 456
- self.assertEqual(amount("0.000591526315789473"), x1)
+ self.assertEqual(amount("0.00059152850877193"), x1)
x4 = amount("123456789123456789123456789")
y4 = amount("56")
@@ -353,32 +353,32 @@ class BasicAmountTestCase(unittest.TestCase):
y1 = amount(456.456)
self.assertRaises(exceptions.ArithmeticError, self.divideByZero, x1)
- self.assertEqual(amount("0.008121"), amount(1.0) / x1)
- self.assertEqual(amount("0.008121"), 1.0 / x1)
+ self.assertEqual(amount("0.008121959"), amount(1.0) / x1)
+ self.assertEqual(amount("0.008121959"), 1.0 / x1)
self.assertEqual(x1, x1 / 1.0)
- self.assertEqual(amount("0.008121"), amount(1.0) / x1)
- self.assertEqual(amount("0.008121"), 1.0 / x1)
+ self.assertEqual(amount("0.008121959"), amount(1.0) / x1)
+ self.assertEqual(amount("0.008121959"), 1.0 / x1)
self.assertEqual(- x1, x1 / -1.0)
- self.assertEqual(- amount("0.008121"), amount(-1.0) / x1)
- self.assertEqual(- amount("0.008121"), -1.0 / x1)
- self.assertEqual(amount("0.269736842105"), x1 / y1)
- self.assertEqual(amount("3.707317073170"), y1 / x1)
- self.assertEqual(amount("0.269736842105"), x1 / 456.456)
- self.assertEqual(amount("3.707317073170"), amount(456.456) / x1)
- self.assertEqual(amount("3.707317073170"), 456.456 / x1)
+ self.assertEqual(- amount("0.008121959"), amount(-1.0) / x1)
+ self.assertEqual(- amount("0.008121959"), -1.0 / x1)
+ self.assertEqual(amount("0.269736842105263"), x1 / y1)
+ self.assertEqual(amount("3.707317073170732"), y1 / x1)
+ self.assertEqual(amount("0.269736842105263"), x1 / 456.456)
+ self.assertEqual(amount("3.707317073170732"), amount(456.456) / x1)
+ self.assertEqual(amount("3.707317073170732"), 456.456 / x1)
x1 /= amount(456.456)
- self.assertEqual(amount("0.269736842105"), x1)
+ self.assertEqual(amount("0.269736842105263"), x1)
x1 /= 456.456
- self.assertEqual(amount("0.0005909372252856792330476541"), x1)
+ self.assertEqual(amount("0.000590937225286255411255411255411255411"), x1)
x1 /= 456
- self.assertEqual(amount("0.00000129591496773175270405187302631578947368421052631578947368421"), x1)
+ self.assertEqual(amount("0.000001295914967733016252753094858358016252192982456140350877192982456140350877192982"), x1)
x4 = amount("1234567891234567.89123456789")
y4 = amount("56.789")
self.assertEqual(amount(1.0), x4 / x4)
- self.assertEqual(amount("21739560323910.7554497273748437197344556164"),
+ self.assertEqual(amount("21739560323910.7554497273748437197344556164046"),
x4 / y4)
self.assertTrue(x1.valid())