text stringlengths 0 2.2M |
|---|
//: per row) and their corresponding ISO 8601 string representations.
|
//:
|
//: 3 For each element 'R' in the cross product of the tables from P-1
|
//: and P-2: (C-1..5)
|
//:
|
//: 1 Create a 'const' 'DateTz' object, 'X', from 'R'.
|
//:
|
//: 2 Invoke the six methods under test on 'X' for all possible
|
//: configurations. Also exercise the method taking 'bufferLength'
|
//: for all buffer lengths in the range '[0 .. L]', where 'L'
|
//: provides sufficient capacity for a null terminator and a few
|
//: extra characters. For each call, verify that the generated
|
//: output matches the string from 'R' (taking the effect of the
|
//: configuration into account), a null terminator is appended when
|
//: expected, and the return value is correct. (C-1..5)
|
//:
|
//: 3 Verify that, in appropriate build modes, defensive checks are
|
//: triggered for invalid arguments, but not triggered for adjacent
|
//: valid ones (using the 'BSLS_ASSERTTEST_*' macros). (C-6)
|
//
|
// Testing:
|
// int generate(char *, int, const DateTz&);
|
// int generate(char *, int, const DateTz&, const Config&);
|
// int generate(string *, const DateTz&);
|
// int generate(string *, const DateTz&, const Config&);
|
// ostream generate(ostream&, const DateTz&);
|
// ostream generate(ostream&, const DateTz&, const Config&);
|
// int generateRaw(char *, const DateTz&);
|
// int generateRaw(char *, const DateTz&, const Config&);
|
#ifndef BDE_OMIT_INTERNAL_DEPRECATED
|
// int generate(char *, const DateTz&, int);
|
// int generate(char *, const DateTz&, int, bool useZ);
|
// ostream generate(ostream&, const DateTz&, bool useZ);
|
// int generateRaw(char *, const DateTz&, bool useZ);
|
#endif // BDE_OMIT_INTERNAL_DEPRECATED
|
// --------------------------------------------------------------------
|
if (verbose) cout << endl
|
<< "GENERATE 'DateTz'" << endl
|
<< "=================" << endl;
|
typedef bdlt::DateTz TYPE;
|
const int OBJLEN = Util::k_DATETZ_STRLEN;
|
const int BUFLEN = OBJLEN + 4;
|
char buffer[BUFLEN];
|
char chaste[BUFLEN]; bsl::memset(chaste, '?', BUFLEN);
|
const int NUM_DATE_DATA = NUM_DEFAULT_DATE_DATA;
|
const DefaultDateDataRow (&DATE_DATA)[NUM_DATE_DATA] =
|
DEFAULT_DATE_DATA;
|
const int NUM_ZONE_DATA = NUM_DEFAULT_ZONE_DATA;
|
const DefaultZoneDataRow (&ZONE_DATA)[NUM_ZONE_DATA] =
|
DEFAULT_ZONE_DATA;
|
const int NUM_CNFG_DATA = NUM_DEFAULT_CNFG_DATA;
|
const DefaultCnfgDataRow (&CNFG_DATA)[NUM_CNFG_DATA] =
|
DEFAULT_CNFG_DATA;
|
for (int ti = 0; ti < NUM_DATE_DATA; ++ti) {
|
const int ILINE = DATE_DATA[ti].d_line;
|
const int YEAR = DATE_DATA[ti].d_year;
|
const int MONTH = DATE_DATA[ti].d_month;
|
const int DAY = DATE_DATA[ti].d_day;
|
const char *ISO8601 = DATE_DATA[ti].d_iso8601;
|
const bdlt::Date DATE(YEAR, MONTH, DAY);
|
const bsl::string EXPECTED_DATE(ISO8601);
|
for (int tj = 0; tj < NUM_ZONE_DATA; ++tj) {
|
const int JLINE = ZONE_DATA[tj].d_line;
|
const int OFFSET = ZONE_DATA[tj].d_offset;
|
const char *ISO8601 = ZONE_DATA[tj].d_iso8601;
|
const bsl::string EXPECTED_ZONE(ISO8601);
|
const TYPE X(DATE, OFFSET);
|
const bsl::string BASE_EXPECTED(EXPECTED_DATE + EXPECTED_ZONE);
|
if (veryVerbose) {
|
T_ P_(ILINE) P_(JLINE) P_(X) P(BASE_EXPECTED)
|
}
|
for (int tc = 0; tc < NUM_CNFG_DATA; ++tc) {
|
const int CLINE = CNFG_DATA[tc].d_line;
|
const bool OMITCOLON = CNFG_DATA[tc].d_omitColon;
|
const int PRECISION = CNFG_DATA[tc].d_precision;
|
const bool USECOMMA = CNFG_DATA[tc].d_useComma;
|
const bool USEZ = CNFG_DATA[tc].d_useZ;
|
if (veryVerbose) {
|
T_ P_(CLINE) P_(OMITCOLON) P_(PRECISION)
|
P_(USECOMMA) P(USEZ)
|
}
|
Config mC; const Config& C = mC;
|
gg(&mC, PRECISION, OMITCOLON, USECOMMA, USEZ);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.