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);
48 void num_put_integer();
50 void num_get_integer();
53 void fix_float_long();
54 void custom_numpunct();
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__) 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 384 #endif // _STLP_NO_MEMBER_TEMPLATES 389 #if defined (_MSC_VER) 390 # pragma warning (disable : 4056) 391 # pragma warning (disable : 4756) 404 ostr << 1.23457e+17
f;
406 output = reset_stream(ostr);
416 output = reset_stream(ostr);
424 output = reset_stream(ostr);
430 ostr <<
fixed << 1.23457e+17
f;
432 output = reset_stream(ostr);
442 output = reset_stream(ostr);
452 output = reset_stream(ostr);
455 CPPUNIT_CHECK(
output.substr(19) ==
".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
462 output = reset_stream(ostr);
472 output = reset_stream(ostr);
480 output = reset_stream(ostr);
488 output = reset_stream(ostr);
496 output = reset_stream(ostr);
504 output = reset_stream(ostr);
507 CPPUNIT_CHECK(
output.substr(19) ==
".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
510 #if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) 515 output = reset_stream(ostr);
518 CPPUNIT_CHECK(
output.substr(19) ==
".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
526 output = reset_stream(ostr);
533 output = reset_stream(ostr);
541 output = reset_stream(ostr);
545 #if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) 550 output = reset_stream(ostr);
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");
820 check_get_float( 0.0
F );
822 check_get_float( 0.0 );
823 #if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) 825 check_get_float( 0.0
L );
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) {
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 ) {
1160 #if 0 // #ifndef _STLP_NO_LONG_DOUBLE 1170 long double delta = 1.0l;
1175 cerr <<
"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" <<
endl;
1204 #if 0 // #ifndef _STLP_NO_LONG_DOUBLE 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");
static UCHAR ULONG UCHAR ULONG UCHAR * output
basic_ostringstream< char, char_traits< char >, allocator< char > > ostringstream
GLsizei const GLvoid * pointer
ios_base &_STLP_CALL showbase(ios_base &__s)
#define CPPUNIT_TEST_SUITE(X)
GLint GLint GLint GLint GLint x
_STLP_PRIV _Setfill_Manip< _CharT > _STLP_CALL setfill(_CharT __c)
unsigned int __cdecl _control87(unsigned int, unsigned int)
ios_base &_STLP_CALL dec(ios_base &__s)
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setprecision(int __n)
#define CHECK(type, val, base, expected)
static const char hex[16]
ios_base &_STLP_CALL fixed(ios_base &__s)
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
void clear(iostate __state=goodbit)
static string reset_stream(ostringstream &ostr)
ios_base &_STLP_CALL scientific(ios_base &__s)
#define CPPUNIT_TEST_SUITE_END()
static bool check_double(double val, double ref)
void check_get_float(F v)
static bool check_float(float val, float ref)
#define CHECK2(val, expected)
void complete_digits(std::string &digits)
_STLP_DECLSPEC _Stl_aligned_buffer< ostream > cerr
ios_base &_STLP_CALL uppercase(ios_base &__s)
string do_grouping() const
#define CHECK_COMPLETE(type, val, base, showbase, showpos, casing, width, adjust, expected)
ios_base &_STLP_CALL noshowpos(ios_base &__s)
#define CPPUNIT_ASSERT(X)
ios_base &_STLP_CALL showpos(ios_base &__s)
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setw(int __n)
ios_base &_STLP_CALL nouppercase(ios_base &__s)
ios_base &_STLP_CALL oct(ios_base &__s)
ios_base &_STLP_CALL internal(ios_base &__s)
CPPUNIT_TEST_SUITE_REGISTRATION(NumPutGetTest)
basic_stringstream< char, char_traits< char >, allocator< char > > stringstream
char do_thousands_sep() const
static const int digits[]
#define CPPUNIT_MESSAGE(m)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *