|
Boost-Commit : |
From: arseny.kapoulkine_at_[hidden]
Date: 2007-08-06 01:31:38
Author: zeux
Date: 2007-08-06 01:31:33 EDT (Mon, 06 Aug 2007)
New Revision: 38470
URL: http://svn.boost.org/trac/boost/changeset/38470
Log:
Fixed unit tests for mingw
Text files modified:
sandbox/SOC/2007/bigint/libs/bigint/test/stream.cpp | 44 +++++++++++++++++++++++++++++----------
1 files changed, 32 insertions(+), 12 deletions(-)
Modified: sandbox/SOC/2007/bigint/libs/bigint/test/stream.cpp
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/test/stream.cpp (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/stream.cpp 2007-08-06 01:31:33 EDT (Mon, 06 Aug 2007)
@@ -175,10 +175,19 @@
CHECK_OSS(setfillch << std::internal << std::setw(6) << std::showpos << std::showbase << std::oct << number(10), "+__012");
// padding + locale (thousands separator)
- CHECK_OSS(std::setw(10) << setusanumlocale << number(1234567), " 1,234,567");
- CHECK_OSS(std::setw(10) << setusanumlocale << number(-234567), " -234,567");
- CHECK_OSS(std::setw(10) << setusanumlocale << std::showpos << number(234567), " +234,567");
- CHECK_OSS(std::setw(10) << setusanumlocale << std::showbase << std::oct << number(234567), " 0712,107");
+ try
+ {
+ std::ostringstream temp;
+ temp << setusanumlocale; // this will throw for gcc/win32
+
+ CHECK_OSS(std::setw(10) << setusanumlocale << number(1234567), " 1,234,567");
+ CHECK_OSS(std::setw(10) << setusanumlocale << number(-234567), " -234,567");
+ CHECK_OSS(std::setw(10) << setusanumlocale << std::showpos << number(234567), " +234,567");
+ CHECK_OSS(std::setw(10) << setusanumlocale << std::showbase << std::oct << number(234567), " 0712,107");
+ }
+ catch (const std::exception&)
+ {
+ }
// stream input
@@ -205,18 +214,29 @@
CHECK_ISS_MOD("-11", std::oct >> std::dec, "-11");
// separators
- CHECK_ISS_MOD("1,234,567", setusanumlocale, "1234567");
- CHECK_ISS_MOD("-234,567", setusanumlocale, "-234567");
- CHECK_ISS_MOD("+234,567", setusanumlocale, "234567");
- CHECK_ISS_MOD("0712,107", std::oct >> setusanumlocale, "234567");
- CHECK_ISS_MOD("0x123,456", std::hex >> setusanumlocale, "1193046");
+ try
+ {
+ std::ostringstream temp;
+ temp << setusanumlocale; // this will throw for gcc/win32
+ CHECK_ISS_MOD("1,234,567", setusanumlocale, "1234567");
+ CHECK_ISS_MOD("-234,567", setusanumlocale, "-234567");
+ CHECK_ISS_MOD("+234,567", setusanumlocale, "234567");
+ CHECK_ISS_MOD("0712,107", std::oct >> setusanumlocale, "234567");
+ CHECK_ISS_MOD("0x123,456", std::hex >> setusanumlocale, "1193046");
+
+ // whole input is incorrect - should leave variable untouched (and set bad state)
+ CHECK_ISS_MOD_STATE("-3,,,", setusanumlocale, "7", false);
+ CHECK_ISS_MOD_STATE("-3,22", setusanumlocale, "7", false);
+ CHECK_ISS_MOD_STATE("-3,33,222,222", setusanumlocale, "7", false);
+ }
+ catch (const std::exception&)
+ {
+ }
+
// whole input is incorrect - should leave variable untouched (and set bad state)
CHECK_ISS_STATE("JAKFDJLK", "7", false);
CHECK_ISS_STATE("-.3", "7", false);
- CHECK_ISS_MOD_STATE("-3,,,", setusanumlocale, "7", false);
- CHECK_ISS_MOD_STATE("-3,22", setusanumlocale, "7", false);
- CHECK_ISS_MOD_STATE("-3,33,222,222", setusanumlocale, "7", false);
// input is partially incorrect - should read only correct part
{
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk