diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-03 19:06:02 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-03 19:06:56 -0400 |
commit | bee8e501664decec2bbae63df58ab1fedc240354 (patch) | |
tree | bee0e1ab4a87efe14d143004a35d55743039f462 /test/unit/t_amount.cc | |
parent | c6d3cce6d5ace51aa48b6d4af0e7149ba79bb1e8 (diff) | |
download | fork-ledger-bee8e501664decec2bbae63df58ab1fedc240354.tar.gz fork-ledger-bee8e501664decec2bbae63df58ab1fedc240354.tar.bz2 fork-ledger-bee8e501664decec2bbae63df58ab1fedc240354.zip |
Removed serialization tests from the amount_t unit tests.
Diffstat (limited to 'test/unit/t_amount.cc')
-rw-r--r-- | test/unit/t_amount.cc | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/test/unit/t_amount.cc b/test/unit/t_amount.cc index d0a49119..d7858064 100644 --- a/test/unit/t_amount.cc +++ b/test/unit/t_amount.cc @@ -1316,93 +1316,4 @@ void AmountTestCase::testCommodityPrinting() assertValid(x2); } -void AmountTestCase::testSerialization() -{ - amount_t x0; - amount_t x1("$8,192.34"); - amount_t x2("8192.34"); - amount_t x3("8192.34"); - amount_t x4("-8192.34"); - amount_t x5(x4); - - // Force x3's pointer to actually be set to null_commodity - x3.set_commodity(*x3.current_pool->null_commodity); - - std::string buf; - { - std::ostringstream storage; - assertThrow(x0.write(storage), amount_error); - x1.write(storage); - x2.write(storage); - x3.write(storage); - x4.write(storage); - x5.write(storage); - buf = storage.str(); - } - - amount_t x1b; - amount_t x2b; - amount_t x3b; - amount_t x4b; - amount_t x5b; - { - std::istringstream storage(buf); - x1b.read(storage); - x2b.read(storage); - x3b.read(storage); - x4b.read(storage); - x5b.read(storage); - } - - assertEqual(x1, x1b); - assertEqual(x2, x2b); - assertEqual(x3, x3b); - assertEqual(x4, x4b); - -#ifndef NOT_FOR_PYTHON - const char * ptr = buf.c_str(); - - amount_t x1c; - amount_t x2c; - amount_t x3c; - amount_t x4c; - amount_t x5c; - { - x1c.read(ptr); - x2c.read(ptr); - x3c.read(ptr); - x4c.read(ptr); - x5c.read(ptr); - } - - assertEqual(x1, x1b); - assertEqual(x2, x2b); - assertEqual(x3, x3b); - assertEqual(x4, x4b); -#endif // NOT_FOR_PYTHON - - assertValid(x1); - assertValid(x2); - assertValid(x3); - assertValid(x4); - assertValid(x1b); - assertValid(x2b); - assertValid(x3b); - assertValid(x4b); - assertValid(x1c); - assertValid(x2c); - assertValid(x3c); - assertValid(x4c); -} - -void AmountTestCase::testXmlSerialization() -{ - amount_t x1("$8,192.34"); - - std::ostringstream storage; - x1.write_xml(storage); - - assertEqual(std::string("<amount>\n <commodity flags=\"PT\">\n <symbol>$</symbol>\n </commodity>\n <quantity>8192.34</quantity>\n</amount>\n"), storage.str()); -} - #endif // NOT_FOR_PYTHON |