text
stringlengths 0
2.2M
|
---|
//:
|
//: 3 QoI: Asserted precondition violations are detected when enabled.
|
//:
|
//: 4 'sputc' method writes printing and non-printing characters
|
//: correctly.
|
//:
|
//: 5 'sputc' method writes bytes with leading bit set correctly.
|
//:
|
//: 6 'sputc' method writes only one character at once.
|
//:
|
//: 7 Data is landed only into client-provided buffer.
|
//:
|
//: 8 'sputc' method returns given parameter value in case of success.
|
//:
|
//: 9 Streambuf capacity exceeding does not corrupt the streambuf.
|
//
|
// Plan:
|
//: 1 Create and object with the user provided buffer of the specified
|
//: length. Verify, using the (as yet unproven) 'length', 'capacity'
|
//: and 'data' accessors, that all streambuf machinery has been set
|
//: up properly. (C-1)
|
//:
|
//: 2 Let the object created in P-1 go out of scope. (C-2)
|
//:
|
//: 3 Verify that, in appropriate build modes, defensive checks are
|
//: triggered for invalid attribute values, but not triggered for
|
//: adjacent valid ones (using the 'BSLS_ASSERTTEST_*' macros). (C-3)
|
//:
|
//: 4 Using the table-driven technique, specify a set of characters for
|
//: writing and their expected buffer presentations.
|
//:
|
//: 5 For each row 'R' in the table of P-4:
|
//:
|
//: 1 Create FixedMemOutput object.
|
//:
|
//: 2 Use 'sputc' to write character from the table to the object.
|
//:
|
//: 3 Verify that character was written to the buffer correctly.
|
//: (C-3..5)
|
//:
|
//: 4 Verify that next character in the buffer hasn't been changed.
|
//: (C-6)
|
//:
|
//: 6 Using the table-driven technique, specify a set of initial object
|
//: states, symbols for adding, expected resulting streambuf contents
|
//: and expected 'sputc' return values.
|
//:
|
//: 7 For each row 'R' in the table of P-6:
|
//:
|
//: 1 Create FixedMemOutput object.
|
//:
|
//: 2 Use 'sputc' to bring an object to required state.
|
//:
|
//: 3 Use 'sputc' to write character from the table to the object.
|
//:
|
//: 4 Verify obtained character set, comparing it with table model.
|
//: (C-3..5)
|
//:
|
//: 5 Verify obtained 'sputc' result, comparing it with table model.
|
//: (C-8)
|
//:
|
//: 6 Verify that no data has been changed outside of client-provided
|
//: buffer. (C-7)
|
//:
|
//: 8 Create an object, write enough characters to fulfil available
|
//: memory, and then write one more. Verify that written data hasn't
|
//: been corrupted. (C-9)
|
//
|
// Testing:
|
// FixedMemOutput(char *buffer, bsl::streamsize length);
|
// ~FixedMemOutput();
|
// int_type sputc(char_type);
|
// --------------------------------------------------------------------
|
if (verbose) cout << endl
|
<< "PRIMARY MANIPULATORS" << endl
|
<< "====================" << endl;
|
if (verbose) cout << "\nTesting value constructor" << endl;
|
{
|
char buffer[INIT_BUFSIZE];
|
Obj mSB(buffer, INIT_BUFSIZE);
|
const Obj& SB = mSB;
|
if (verbose) cout <<
|
"\tEnsure that the stream buffer pointer is set correctly."
|
<< endl;
|
ASSERT(buffer == SB.data());
|
if (verbose) cout <<
|
"\tEnsure that the stream buffer has specified capacity."
|
<< endl;
|
ASSERT(INIT_BUFSIZE == SB.capacity());
|
if (verbose) cout <<
|
"\tEnsure that the stream buffer contains no data on construction."
|
<< endl;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.