31
|
1 |
/*
|
|
2 |
* Note: Strstreams are really broken in STLport. But strstreams are
|
|
3 |
* obsolete, and even if ones was mentioned in D7.1--D7.4 of
|
|
4 |
* Standard, we have no wish to spent time with repair ones.
|
|
5 |
*/
|
|
6 |
#include <strstream>
|
|
7 |
|
|
8 |
#include "cppunit/cppunit_proxy.h"
|
|
9 |
|
|
10 |
#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
|
|
11 |
using namespace std;
|
|
12 |
#endif
|
|
13 |
|
|
14 |
class StrstreamBufferReadTest : public CPPUNIT_NS::TestCase
|
|
15 |
{
|
|
16 |
CPPUNIT_TEST_SUITE(StrstreamBufferReadTest);
|
|
17 |
CPPUNIT_TEST(readFromBuffer);
|
|
18 |
CPPUNIT_TEST_SUITE_END();
|
|
19 |
|
|
20 |
protected:
|
|
21 |
void readFromBuffer();
|
|
22 |
};
|
|
23 |
|
|
24 |
CPPUNIT_TEST_SUITE_REGISTRATION(StrstreamBufferReadTest);
|
|
25 |
|
|
26 |
void StrstreamBufferReadTest::readFromBuffer()
|
|
27 |
{
|
|
28 |
char hello[] = "Hello";
|
|
29 |
strstream stream(hello, sizeof(hello), ios_base::in);
|
|
30 |
char cur;
|
|
31 |
stream >> cur;
|
|
32 |
CPPUNIT_ASSERT(cur == 'H');
|
|
33 |
}
|