text
stringlengths 0
2.2M
|
---|
{
|
if (verbose) cout << "\tChecking operator<< return value."
|
<< endl;
|
char buffer[INIT_BUFSIZE];
|
memset(buffer, 'Z', INIT_BUFSIZE);
|
Obj mSB(buffer, INIT_BUFSIZE);
|
const Obj& SB = mSB;
|
stringstream out1;
|
stringstream out2;
|
out1 << mSB << "arbitrary"; // Ensure modifiable
|
out2 << SB << "value"; // stream is returned.
|
ASSERT(true == out1.good());
|
ASSERT(true == out2.good());
|
}
|
{
|
if (verbose) cout << "\n\tChecking operator<< output."
|
<< endl;
|
char buffer[INIT_BUFSIZE];
|
memset(buffer, 'Z', INIT_BUFSIZE);
|
Obj mSB(buffer, INIT_BUFSIZE);
|
const Obj& SB = mSB;
|
mSB.sputc('h');
|
mSB.sputc('e');
|
mSB.sputc('l');
|
mSB.sputc('l');
|
mSB.sputc('o');
|
stringstream out1;
|
stringstream out2;
|
out1 << mSB;
|
out2 << SB;
|
string str1 = out1.str();
|
string str2 = out2.str();
|
ASSERT(str1 == str2);
|
const string EXPECTED =
|
"\n0000\t01101000 01100101 01101100 01101100 01101111";
|
if (verbose) {
|
T_ P(EXPECTED)
|
T_ P(str1)
|
}
|
ASSERT(EXPECTED == str1);
|
}
|
{
|
if (verbose) cout << "\n\tChecking operator<< output again."
|
<< endl;
|
// One more test, just to see something different
|
char buffer[INIT_BUFSIZE];
|
memset(buffer, 'Z', INIT_BUFSIZE);
|
Obj mSB(buffer, INIT_BUFSIZE);
|
const Obj& SB = mSB;
|
mSB.sputc('0'); mSB.sputc('1'); mSB.sputc('2'); mSB.sputc('3');
|
mSB.sputc('4'); mSB.sputc('5'); mSB.sputc('6'); mSB.sputc('7');
|
mSB.sputc('8'); mSB.sputc('9'); mSB.sputc('A'); mSB.sputc('B');
|
stringstream out1;
|
stringstream out2;
|
out1 << mSB;
|
out2 << SB;
|
string str1 = out1.str();
|
string str2 = out2.str();
|
ASSERT(str1 == str2);
|
const string EXPECTED =
|
"\n0000\t00110000 00110001 00110010 00110011 "
|
"00110100 00110101 00110110 00110111"
|
"\n0008\t00111000 00111001 01000001 01000010";
|
if (verbose) {
|
T_ P(EXPECTED)
|
T_ P(str1)
|
}
|
ASSERT(EXPECTED == str1);
|
}
|
} break;
|
case 2: {
|
// --------------------------------------------------------------------
|
// PRIMARY MANIPULATORS
|
//
|
// Concerns:
|
//: 1 The value constructor can create an object to have any value that
|
//: does not violate the method's documented preconditions.
|
//:
|
//: 2 An object can be safely destroyed.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.