stdcpp/tsrc/Stdcpp_test/stlport/auto/stlport_sstream/src/sstream1.cpp
changeset 0 e4d67989cc36
child 18 47c74d1534e1
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 
       
     2 // STLport regression testsuite component.
       
     3 // To compile as a separate example, please #define MAIN.
       
     4 
       
     5 #include <sstream>
       
     6 #include <cassert>
       
     7 
       
     8 #ifdef MAIN 
       
     9 #define sstream1_test main
       
    10 #endif
       
    11 
       
    12 int sstream1_test(int, char**)
       
    13 {
       
    14     int failures=0;
       
    15     std::istringstream iss;
       
    16 	int x[9];
       
    17 	std::fill_n(x, 9, 999);
       
    18 	iss.str(std::string("0-0+0 010-010+010 0x1-0x1+0x1"));
       
    19 	iss >> std::hex;
       
    20 	iss >> x[0] >> x[1] >> x[2] >> x[3] >> x[4] >> x[5] >> x[6] >> x[7] >> x[8];
       
    21 
       
    22  #ifdef __SYMBIAN32__
       
    23    {
       
    24      if(x[0] != 0x0)
       
    25       failures++;
       
    26 	 if(x[1] != -0x0)
       
    27 	   failures++;
       
    28 	if(x[2] != +0x0)
       
    29 	   failures++;
       
    30 	if(x[3] != 0x010)
       
    31 	  failures++;
       
    32 	if(x[4] != -0x010)
       
    33 	 failures++;
       
    34 	if(x[5] != +0x010)
       
    35 	   failures++;
       
    36 	if(x[6]!= 0x1)
       
    37 	   failures++;
       
    38 	if(x[7]!= -0x1)
       
    39 	   failures++;
       
    40 	if(x[8]!= +0x1)
       
    41 	   failures++;
       
    42    }
       
    43  #else
       
    44    {
       
    45  	assert(x[0] == 0x0);
       
    46 	assert(x[1] == -0x0);
       
    47 	assert(x[2] == +0x0);
       
    48 	assert(x[3] == 0x010);
       
    49 	assert(x[4] == -0x010);
       
    50 	assert(x[5] == +0x010);
       
    51 	assert(x[6] == 0x1);
       
    52 	assert(x[7] == -0x1);
       
    53 	assert(x[8] == +0x1);
       
    54   }
       
    55 
       
    56 #endif      	
       
    57 	iss.clear();
       
    58 	iss.str(std::string("0-0+0 010-010+010 0x1-0x1+0x1"));
       
    59 	iss.unsetf(std::ios_base::dec | std::ios_base::hex);
       
    60 	std::fill_n(x, 9, 999);
       
    61 	iss >> x[0] >> x[1] >> x[2] >> x[3] >> x[4] >> x[5] >> x[6] >> x[7] >> x[8];
       
    62 
       
    63 #ifdef __SYMBIAN32__
       
    64  {
       
    65     if(x[0] != 0)
       
    66       failures++;
       
    67 	 if(x[1]!= -0)
       
    68 	   failures++;
       
    69 	if(x[2] != +0)
       
    70 	   failures++;
       
    71 	if(x[3] != 010)
       
    72 	  failures++;
       
    73 	if(x[4] != -010)
       
    74 	 failures++;
       
    75 	if(x[5] != +010)
       
    76 	   failures++;
       
    77 	if(x[6] !=0x1)
       
    78 	   failures++;
       
    79 	if(x[7] != -0x1)
       
    80 	   failures++;
       
    81 	if(x[8] != +0x1)
       
    82 	   failures++;
       
    83  
       
    84  }
       
    85 #else
       
    86 {
       
    87 	assert(x[0] == 0);
       
    88 	assert(x[1] == -0);
       
    89 	assert(x[2] == +0);
       
    90 	assert(x[3] == 010);
       
    91 	assert(x[4] == -010);
       
    92 	assert(x[5] == +010);
       
    93 	assert(x[6] == 0x1);
       
    94 	assert(x[7] == -0x1);
       
    95 	assert(x[8] == +0x1);
       
    96 }
       
    97 
       
    98 #endif
       
    99 if(failures)
       
   100  return 1;
       
   101 else 
       
   102  return 0; 
       
   103 }