text
stringlengths
0
2.2M
};
const int NUM_BAD_TIME_DATA =
static_cast<int>(sizeof BAD_TIME_DATA / sizeof *BAD_TIME_DATA);
// *** Bad Zone Data ***
struct BadZoneDataRow {
int d_line; // source line number
const char *d_invalid; // test string
};
static
const BadZoneDataRow BAD_ZONE_DATA[] =
{
//LINE INPUT STRING
//---- -------------------------
{ L_, "0" }, // length = 1
{ L_, "+" },
{ L_, "-" },
{ L_, "T" },
{ L_, "+0" }, // length = 2
{ L_, "-0" },
{ L_, "Z0" },
{ L_, "+01" }, // length = 3
{ L_, "-01" },
{ L_, "+10:" }, // length = 4
{ L_, "-10:" },
{ L_, "+120" },
{ L_, "-030" },
{ L_, "+01:1" }, // length = 5
{ L_, "-01:1" },
{ L_, "+1:12" },
{ L_, "+12:1" },
{ L_, "+2360" },
{ L_, "-2360" },
{ L_, "+2400" },
{ L_, "-2400" },
{ L_, "+12:1x" }, // length = 6
{ L_, "+12:1 " },
{ L_, "+1200x" },
{ L_, "+23:60" },
{ L_, "-23:60" },
{ L_, "+24:00" },
{ L_, "-24:00" },
{ L_, "+123:23" }, // length = 7
{ L_, "+12:123" },
{ L_, "+011:23" },
{ L_, "+12:011" },
{ L_, "+123:123" }, // length = 8
};
const int NUM_BAD_ZONE_DATA =
static_cast<int>(sizeof BAD_ZONE_DATA / sizeof *BAD_ZONE_DATA);
//=============================================================================
// GLOBAL HELPER FUNCTIONS FOR TESTING
//-----------------------------------------------------------------------------
static
Config& gg(Config *object,
int fractionalSecondPrecision,
bool omitColonInZoneDesignatorFlag,
bool useCommaForDecimalSignFlag,
bool useZAbbreviationForUtcFlag)
// Return, by reference, the specified '*object' with its value adjusted
// according to the specified 'omitColonInZoneDesignatorFlag',
// 'useCommaForDecimalSignFlag', and 'useZAbbreviationForUtcFlag'.
{
if (fractionalSecondPrecision > 6) {
fractionalSecondPrecision = 6;
}
object->setFractionalSecondPrecision(fractionalSecondPrecision);
object->setOmitColonInZoneDesignator(omitColonInZoneDesignatorFlag);
object->setUseCommaForDecimalSign(useCommaForDecimalSignFlag);
object->setUseZAbbreviationForUtc(useZAbbreviationForUtcFlag);
return *object;
}
static
void updateExpectedPerConfig(bsl::string *expected,
const Config& configuration,
int maxPrecision)
// Update the specified 'expected' ISO 8601 string as if it were generated
// using the specified 'configuration'. The behavior is undefined unless
// the zone designator within 'expected' (if any) is of the form
// "(+|-)dd:dd".
{
ASSERT(expected);
const bsl::string::size_type index = expected->find('.');
if (configuration.useCommaForDecimalSign()) {