3#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
16# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
26# if defined (__BORLANDC__)
28 unsigned int _float_control_word =
_control87(0, 0);
29 _control87(PC_64|MCW_EM|IC_AFFINE, MCW_PC|MCW_EM|MCW_IC);
39# if defined (__BORLANDC__)
42 _control87(_float_control_word, MCW_PC|MCW_EM|MCW_IC);
59 return val <= ref + epsilon && val >=
ref - epsilon;
65 return val <= ref + epsilon && val >=
ref - epsilon;
70 string tmp = ostr.str();
75#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
84 str <<
"1E+" << limits::max_exponent10;
95 str <<
"-1E+" << limits::max_exponent10;
106 str <<
"1E" << limits::min_exponent10;
117 str <<
"1E+" << (limits::max_exponent10 + 1);
128 str <<
"-1E+" << (limits::max_exponent10 + 1);
139 str <<
"1E" << (limits::min_exponent10 - 1);
147#if !defined (__MINGW32__)
151 str << limits::max();
221 str << limits::infinity();
229 str << -limits::infinity();
237 str << limits::quiet_NaN();
245 str << -limits::quiet_NaN();
253 str <<
"0." <<
string(limits::max_exponent10,
'0') <<
"1e" << (limits::max_exponent10 + 1);
264 str <<
"1" <<
string(-(limits::min_exponent10 - 1),
'0') <<
"e" << (limits::min_exponent10 - 1);
272# if defined (_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x530)
306# define __check_get_float( F ) \
307 void check_get_float( F v ) \
313 str << "1E+" << numeric_limits<F>::max_exponent10; \
316 CPPUNIT_ASSERT(!str.fail()); \
317 CPPUNIT_ASSERT(str.eof()); \
318 CPPUNIT_CHECK( in_val_d == in_val_d ); \
319 CPPUNIT_CHECK( in_val_d != numeric_limits<F>::infinity() ); \
324 str << "-1E+" << numeric_limits<F>::max_exponent10; \
327 CPPUNIT_ASSERT(!str.fail()); \
328 CPPUNIT_ASSERT(str.eof()); \
329 CPPUNIT_CHECK( in_val_d == in_val_d ); \
330 CPPUNIT_CHECK( in_val_d != -numeric_limits<F>::infinity() ); \
335 str << "1E" << numeric_limits<F>::min_exponent10; \
338 CPPUNIT_ASSERT(!str.fail()); \
339 CPPUNIT_ASSERT(str.eof()); \
340 CPPUNIT_CHECK( in_val_d == in_val_d ); \
341 CPPUNIT_CHECK( in_val_d != F(0.0) ); \
346 str << "1E+" << (numeric_limits<F>::max_exponent10 + 1); \
349 CPPUNIT_ASSERT(!str.fail()); \
350 CPPUNIT_ASSERT(str.eof()); \
351 CPPUNIT_CHECK( in_val_d == in_val_d ); \
352 CPPUNIT_CHECK( in_val_d == numeric_limits<F>::infinity() ); \
357 str << "-1E+" << (numeric_limits<F>::max_exponent10 + 1); \
360 CPPUNIT_ASSERT(!str.fail()); \
361 CPPUNIT_ASSERT(str.eof()); \
362 CPPUNIT_CHECK( in_val_d == in_val_d ); \
363 CPPUNIT_CHECK( in_val_d == -numeric_limits<F>::infinity() ); \
368 str << "1E" << (numeric_limits<F>::min_exponent10 - 1); \
371 CPPUNIT_ASSERT(!str.fail()); \
372 CPPUNIT_ASSERT(str.eof()); \
373 CPPUNIT_CHECK( in_val_d == in_val_d ); \
374 CPPUNIT_CHECK( in_val_d >= F(0.0) && in_val_d <= numeric_limits<F>::min() ); \
378 __check_get_float(
float )
379 __check_get_float(
double )
380# if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
381 __check_get_float(
long double )
383# undef __check_get_float
389#if defined (_MSC_VER)
390# pragma warning (disable : 4056)
391# pragma warning (disable : 4756)
404 ostr << 1.23457e+17f;
430 ostr <<
fixed << 1.23457e+17f;
455 CPPUNIT_CHECK(output.substr(19) ==
".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
507 CPPUNIT_CHECK(output.substr(19) ==
".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
510#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
518 CPPUNIT_CHECK(output.substr(19) ==
".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
527 CPPUNIT_CHECK( output ==
"0.00000000000000000000000000000000000000000000000000e+00" );
545#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
585 str.setf(ios::fixed, ios::floatfield);
614#define CHECK_COMPLETE(type, val, base, showbase, showpos, casing, width, adjust, expected) \
617 ostringstream ostr; \
618 ostr << base << showbase << showpos << casing << setw(width) << adjust << tmp; \
619 CPPUNIT_CHECK( ostr.str() == expected ); \
622#define CHECK(type, val, base, expected) \
623 CHECK_COMPLETE(type, val, base, noshowbase, noshowpos, nouppercase, 0, right, expected)
632 if (
sizeof(
short) == 2) {
638 CHECK(
unsigned short, 12345,
oct,
"30071")
641 CHECK(
int, 12345678,
oct,
"57060516")
642 if (
sizeof(
int) == 4) {
644 CHECK(
int, -12345678,
oct,
"37720717262")
648 CHECK(
unsigned int, 12345678,
oct,
"57060516")
651 CHECK(
long, 12345678,
oct,
"57060516")
652 if (
sizeof(
long) == 4) {
654 CHECK(
long, -12345678,
oct,
"37720717262")
658 CHECK(
unsigned long, 12345678,
oct,
"57060516")
660#if defined (STLPORT) && defined (_STLP_LONG_LONG)
689 CHECK(
unsigned short, 12345,
dec,
"12345")
693 CHECK(
int, 12345678,
dec,
"12345678")
694 CHECK(
int, -12345678,
dec,
"-12345678")
697 CHECK(
unsigned int, 12345678,
dec,
"12345678")
701 CHECK(
long, 12345678,
dec,
"12345678")
702 CHECK(
long, -12345678,
dec,
"-12345678")
705 CHECK(
unsigned long, 12345678,
dec,
"12345678")
706#if defined (STLPORT) && defined (_STLP_LONG_LONG)
727 if (
sizeof(
short) == 2) {
733 CHECK(
unsigned short, 12345,
hex,
"3039")
737 if (
sizeof(
int) == 4) {
739 CHECK(
int, -12345678,
hex,
"ff439eb2")
743 CHECK(
unsigned int, 12345678,
hex,
"bc614e")
746 CHECK(
long, 12345678,
hex,
"bc614e")
747 if (
sizeof(
long) == 4) {
749 CHECK(
long, -12345678,
hex,
"ff439eb2")
753 CHECK(
unsigned long, 12345678,
hex,
"bc614e")
754#if defined (STLPORT) && defined (_STLP_LONG_LONG)
805 istr.
str(
"000000000000001.234500000000");
812 istr.
str(
"1.2345e+04");
823#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
853#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
881 const char*
p =
"2.718281828459045235360287471352662497757247093e0";
904 if (
sizeof(
short) == 2) {
933 if (
sizeof(
short) == 2) {
935 istr.
str(
"10000000");
994 if (
sizeof(
short) == 2) {
1045 s.setf( ios_base::internal, ios_base::adjustfield );
1092 void *
p = (
void *)0xff00;
1095 if (
sizeof(
p ) == 2 ) {
1097 }
else if (
sizeof(
p ) == 4 ) {
1099 }
else if (
sizeof(
p ) == 8 ) {
1110 if (
sizeof(
p ) == 2 ) {
1112 }
else if (
sizeof(
p ) == 4 ) {
1114 }
else if (
sizeof(
p ) == 8 ) {
1126 str.setf(ios::fixed, ios::floatfield);
1170 long double delta = 1.0l;
1175 cerr <<
"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" <<
endl;
1179 CPPUNIT_CHECK( (
f > (1.0e+83l - delta)) && (
f < (1.0e+83l + delta)) );
1188 str << numeric_limits<double>::max();
1207 str << numeric_limits<long double>::max();
1214 long double delta = 1.0l;
1230#define CHECK2(val, expected) \
1231 os.str(""); os << fixed << setprecision(3) << showpos << val; \
1232 CPPUNIT_ASSERT( os.str() == expected )
1246 CHECK2(123.456,
"+12,3.456");
1247 CHECK2(1234.567,
"+1,23,4.567");
1248 CHECK2(12345.678,
"+12,34,5.678");
1249 CHECK2(123456.789,
"+123,45,6.789");
1250 CHECK2(1234567.891,
"+1,234,56,7.891");
1251 CHECK2(123456789.123,
"+123,456,78,9.123");
1255 CHECK2(-1.234,
"-1.234");
1256 CHECK2(-123.456,
"-12,3.456");
1257 CHECK2(-1234.567,
"-1,23,4.567");
1258 CHECK2(-12345.678,
"-12,34,5.678");
1259 CHECK2(-123456.789,
"-123,45,6.789");
1260 CHECK2(-1234567.891,
"-1,234,56,7.891");
1261 CHECK2(-123456789.123,
"-123,456,78,9.123");
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setw(int __n)
_STLP_PRIV _Setfill_Manip< _CharT > _STLP_CALL setfill(_CharT __c)
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setprecision(int __n)
ios_base &_STLP_CALL showbase(ios_base &__s)
ios_base &_STLP_CALL nouppercase(ios_base &__s)
ios_base &_STLP_CALL scientific(ios_base &__s)
ios_base &_STLP_CALL oct(ios_base &__s)
ios_base &_STLP_CALL dec(ios_base &__s)
ios_base &_STLP_CALL internal(ios_base &__s)
ios_base &_STLP_CALL noshowpos(ios_base &__s)
ios_base &_STLP_CALL showpos(ios_base &__s)
ios_base &_STLP_CALL uppercase(ios_base &__s)
ios_base &_STLP_CALL fixed(ios_base &__s)
basic_ostringstream< char, char_traits< char >, allocator< char > > ostringstream
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
string do_grouping() const
char do_thousands_sep() const
void check_get_float(F v)
CPPUNIT_TEST(num_get_float)
CPPUNIT_TEST(num_put_integer)
static bool check_double(double val, double ref)
static string reset_stream(ostringstream &ostr)
CPPUNIT_TEST(custom_numpunct)
static bool check_float(float val, float ref)
CPPUNIT_TEST(fix_float_long)
CPPUNIT_TEST(num_put_float)
CPPUNIT_TEST(num_get_integer)
CPPUNIT_TEST_SUITE(NumPutGetTest)
void clear(iostate __state=goodbit)
void complete_digits(std::string &digits)
#define CPPUNIT_MESSAGE(m)
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
#define CPPUNIT_ASSERT(X)
GLint GLint GLint GLint GLint x
GLsizei const GLvoid * pointer
static const int digits[]
unsigned int __cdecl _control87(unsigned int, unsigned int)
#define CHECK(type, val, base, expected)
#define CHECK_COMPLETE(type, val, base, showbase, showpos, casing, width, adjust, expected)
#define CHECK2(val, expected)