text
stringlengths
0
2.2M
IN_DATETIMETZ == decoded);
}
{
balxml::EncoderOptions options;
options.setUseZAbbreviationForUtc(true);
bsl::ostringstream ss;
Print::printDefault(ss, IN_DATETIMETZ, &options);
ASSERTV(LINE, ss.good());
const bsl::string ENCODED(ss.str());
bdlt::DatetimeTz decoded;
ASSERTV(LINE, ENCODED,
0 == Util::parseDefault(&decoded,
ENCODED.data(),
intLength(ENCODED)));
ASSERTV(LINE, ENCODED, IN_DATETIMETZ, decoded,
IN_DATETIMETZ == decoded);
}
}
}
} break;
case 13: {
// --------------------------------------------------------------------
// TESTING 'printText' ROUND TRIP
//
// Concerns:
//: 1 That booleans and enumerations are printed as text properly.
//:
//: 2 That types that have the CustomizedString trait are printed
//: correctly.
//:
//: 3 That invalid characters (single- and multi-bytes) are not
//: printed.
//:
//: 4 That valid strings are printed correctly, and strings with
//: invalid characters printed until the first invalid character.
//
// Plan:
// Exercise 'printText' with typical data to ascertain that it prints
// as expected for concerns 1 and 2. For concerns 3 and 4, select
// test data with the boundary and area testing methods, and verify
// that output is as expected. Note that since we are in effect
// testing the internal method 'printTextReplacingXMLEscapes', there
// is no need to test it for several types, since it is called on the
// internal text buffer. For this reason, we test only with 'char*'
// data thoroughly, and trust that the forwarding for 'bsl::string'
// and other string types will call the same method.
// --------------------------------------------------------------------
if (verbose) cout << "\nTESTING 'printText' ROUND TRIP"
<< "\n==============================" << endl;
using TestMachinery::RoundTripTestData;
using TestMachinery::printTextRoundTripScalarTester;
if (verbose) cout << "\nTesting 'bool'." << endl;
{
static const RoundTripTestData<bool> DATA[] =
{
//line input
//---- -----
{ L_, true },
{ L_, false },
};
printTextRoundTripScalarTester(DATA);
}
if (verbose) cout << "\nTesting 'char'." << endl;
{
static const RoundTripTestData<char> DATA[] =
{
//line input
//---- -----
{ L_, 0x09 },
{ L_, 0x0a },
{ L_, 0x0d },
{ L_, 0x20 },
{ L_, 0x21 },
{ L_, 0x22 },
{ L_, 0x23 },
{ L_, 0x24 },
{ L_, 0x25 },
{ L_, 0x26 },
{ L_, 0x27 },
{ L_, 0x28 },
{ L_, 0x29 },
{ L_, 0x2a },
{ L_, 0x2b },
{ L_, 0x2c },
{ L_, 0x2d },
{ L_, 0x2e },
{ L_, 0x2f },
{ L_, 0x30 },
{ L_, 0x31 },
{ L_, 0x32 },
{ L_, 0x33 },
{ L_, 0x34 },
{ L_, 0x35 },