text
stringlengths
0
2.2M
const int LINE = DATA[i].d_line;
const char *INPUT = DATA[i].d_input;
const bsl::size_t INPUT_LENGTH = bsl::strlen(INPUT);
const bsl::string IN(INPUT, INPUT + INPUT_LENGTH);
bsl::stringstream ss;
Print::printHex(ss, IN);
ASSERTV(LINE, ss.good());
const bsl::string ENCODED(ss.str());
using TestMachinery::intLength;
{
typedef bsl::string Type;
Type mDecoded; const Type& DECODED = mDecoded;
ASSERTV(LINE, 0 == Util::parseHex(&mDecoded,
ENCODED.data(),
intLength(ENCODED)));
ASSERTV(LINE, ENCODED, DECODED, INPUT, INPUT == DECODED);
}
{
typedef bsl::vector<char> Type;
Type mDecoded; const Type& DECODED = mDecoded;
ASSERTV(LINE, 0 == Util::parseHex(&mDecoded,
ENCODED.data(),
intLength(ENCODED)));
const Type IN_VEC(IN.begin(), IN.end());
ASSERTV(LINE, ENCODED, DECODED, IN_VEC, IN_VEC == DECODED);
}
}
} break;
case 10: {
// --------------------------------------------------------------------
// TESTING 'printDecimal' ROUND TRIP
//
// Concerns:
//
// Plan:
// --------------------------------------------------------------------
if (verbose) cout << "\nTESTING 'printDecimal' ROUND TRIP"
<< "\n=================================" << endl;
using TestMachinery::RoundTripTestData;
using TestMachinery::printDecimalRoundTripTester;
if (verbose) cout << "\nTesting 'bool'." << endl;
{
static const RoundTripTestData<bool> DATA[] =
{
//line input
//---- -----
{ L_, true },
{ L_, false },
};
printDecimalRoundTripTester(DATA);
}
if (verbose) cout << "\nTesting 'char'." << endl;
{
static const RoundTripTestData<char> DATA[] =
{
//line input
//---- -----
{ L_, -128 },
{ L_, -127 },
{ L_, -1 },
{ L_, 0 },
{ L_, 1 },
{ L_, 126 },
{ L_, 127 },
};
printDecimalRoundTripTester(DATA);
}
if (verbose) cout << "\nTesting 'short'." << endl;
{
static const RoundTripTestData<short> DATA[] =
{
//line input
//---- -----
{ L_, -32768 },
{ L_, -32767 },
{ L_, -1 },
{ L_, 0 },
{ L_, 1 },
{ L_, 32766 },
{ L_, 32767 },
};
printDecimalRoundTripTester(DATA);
}
if (verbose) cout << "\nTesting 'int'." << endl;
{
static const RoundTripTestData<int> DATA[] =