mirror of
https://github.com/ENSL/NS.git
synced 2024-11-24 13:31:12 +00:00
2f9f0c732e
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@277 67975925-1194-0748-b3d5-c16f83f1a3a1
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
// STLport regression testsuite component.
|
|
// To compile as a separate example, please #define MAIN.
|
|
|
|
#include <sstream>
|
|
#include <cassert>
|
|
|
|
#ifdef MAIN
|
|
#define sstream1_test main
|
|
#endif
|
|
|
|
int sstream1_test(int, char**)
|
|
{
|
|
|
|
std::istringstream iss;
|
|
int x[9];
|
|
std::fill_n(x, 9, 999);
|
|
iss.str(std::string("0-0+0 010-010+010 0x1-0x1+0x1"));
|
|
iss >> std::hex;
|
|
iss >> x[0] >> x[1] >> x[2] >> x[3] >> x[4] >> x[5] >> x[6] >> x[7] >> x[8];
|
|
assert(x[0] == 0x0);
|
|
assert(x[1] == -0x0);
|
|
assert(x[2] == +0x0);
|
|
assert(x[3] == 0x010);
|
|
assert(x[4] == -0x010);
|
|
assert(x[5] == +0x010);
|
|
assert(x[6] == 0x1);
|
|
assert(x[7] == -0x1);
|
|
assert(x[8] == +0x1);
|
|
|
|
iss.clear();
|
|
iss.str(std::string("0-0+0 010-010+010 0x1-0x1+0x1"));
|
|
iss.unsetf(std::ios_base::dec | std::ios_base::hex);
|
|
std::fill_n(x, 9, 999);
|
|
iss >> x[0] >> x[1] >> x[2] >> x[3] >> x[4] >> x[5] >> x[6] >> x[7] >> x[8];
|
|
assert(x[0] == 0);
|
|
assert(x[1] == -0);
|
|
assert(x[2] == +0);
|
|
assert(x[3] == 010);
|
|
assert(x[4] == -010);
|
|
assert(x[5] == +010);
|
|
assert(x[6] == 0x1);
|
|
assert(x[7] == -0x1);
|
|
assert(x[8] == +0x1);
|
|
}
|
|
|