text
stringlengths
0
2.2M
intLength(ENCODED4)));
ASSERTV(LINE, ENCODED4, decoded, INPUT4,
INPUT4 == decoded);
}
}
}
if (verbose) cout << "\nTesting 'MyEnumeration::Value'." << endl;
{
static const RoundTripTestData<test::MyEnumeration::Value> DATA[] =
{
//line input
//---- -----
{ L_, test::MyEnumeration::VALUE1 },
{ L_, test::MyEnumeration::VALUE2 },
};
printTextRoundTripScalarTester(DATA);
}
} break;
case 12: {
// --------------------------------------------------------------------
// TESTING 'printList' ROUND TRIP
//
// Concerns:
//
// Plan:
// --------------------------------------------------------------------
if (verbose) cout << "\nTESTING 'printList' ROUND TRIP"
<< "\n==============================" << endl;
typedef int ElemType;
typedef bsl::vector<ElemType> Type;
static const struct TestData {
int d_line;
ElemType d_input[5];
int d_numInput;
} DATA[] = {
//line input numInput
//---- ----- --------
{ L_, { }, 0, },
{ L_, { 1 }, 1, },
{ L_, { 1, 4 }, 2, },
{ L_, { 1, 4, 2 }, 3, },
{ L_, { 1, 4, 2, 8 }, 4, },
{ L_, { 1, 4, 2, 8, 23 }, 5, },
};
const int NUM_DATA = sizeof DATA / sizeof *DATA;
for (int i = 0; i < NUM_DATA; ++i) {
const int LINE = DATA[i].d_line;
const ElemType *INPUT = DATA[i].d_input;
const int NUM_INPUT = DATA[i].d_numInput;
const Type IN(INPUT, INPUT + NUM_INPUT);
bsl::stringstream ss;
Print::printList(ss, IN);
ASSERTV(LINE, ss.good());
const bsl::string ENCODED(ss.str());
using TestMachinery::intLength;
Type mDecoded; const Type& DECODED = mDecoded;
ASSERTV(LINE, 0 == Util::parseList(&mDecoded,
ENCODED.data(),
intLength(ENCODED)));
ASSERTV(LINE, ENCODED, DECODED, IN, IN == DECODED);
}
} break;
case 11: {
// --------------------------------------------------------------------
// TESTING 'printHex' ROUND TRIP
//
// Concerns:
//
// Plan:
// --------------------------------------------------------------------
if (verbose) cout << "\nTESTING 'printHex' ROUND TRIP"
<< "\n=============================" << endl;
static const struct TestData {
int d_line;
const char *d_input;
} DATA[] = {
//line input
//---- -------
{ L_, "", },
{ L_, "a", },
{ L_, "ab", },
{ L_, "abc", },
{ L_, "abcd", },
};
const int NUM_DATA = sizeof DATA / sizeof *DATA;
for (int i = 0; i < NUM_DATA; ++i) {