From bee8e501664decec2bbae63df58ab1fedc240354 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 3 Feb 2009 19:06:02 -0400 Subject: Removed serialization tests from the amount_t unit tests. --- test/unit/t_amount.cc | 89 --------------------------------------------------- 1 file changed, 89 deletions(-) (limited to 'test/unit/t_amount.cc') 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("\n \n $\n \n 8192.34\n\n"), storage.str()); -} - #endif // NOT_FOR_PYTHON -- cgit v1.2.3