text stringlengths 0 2.2M |
|---|
ASSERT_PASS(Util::parse(&resultTz, INPUT, LENGTH));
|
ASSERT_PASS(Util::parse(&resultTz, INPUT, 0));
|
ASSERT_FAIL(Util::parse(&resultTz, INPUT, -1));
|
}
|
}
|
} break;
|
case 7: {
|
// --------------------------------------------------------------------
|
// GENERATE 'DatetimeTz'
|
//
|
// Concerns:
|
//: 1 The output generated by each method has the expected format and
|
//: contents.
|
//:
|
//: 2 When sufficient capacity is indicated, the method taking
|
//: 'bufferLength' generates a null terminator.
|
//:
|
//: 3 Each method returns the expected value (the correct character
|
//: count or the supplied 'ostream', depending on the return type).
|
//:
|
//: 4 The value of the supplied object is unchanged.
|
//:
|
//: 5 The configuration that is in effect, whether user-supplied or the
|
//: process-wide default, has the desired effect on the output.
|
//:
|
//: 6 QoI: Asserted precondition violations are detected when enabled.
|
//
|
// Plan:
|
//: 1 Using the table-driven technique, specify a set of distinct
|
//: 'Date' values (one per row) and their corresponding ISO 8601
|
//: string representations.
|
//:
|
//: 2 In a second table, specify a set of distinct 'Time' values (one
|
//: per row) and their corresponding ISO 8601 string representations.
|
//:
|
//: 3 In a third table, specify a set of distinct timezone values (one
|
//: per row) and their corresponding ISO 8601 string representations.
|
//:
|
//: 4 For each element 'R' in the cross product of the tables from P-1,
|
//: P-2, and P-3: (C-1..5)
|
//:
|
//: 1 Create a 'const' 'DatetimeTz' 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 DatetimeTz&);
|
// int generate(char *, int, const DatetimeTz&, const Config&);
|
// int generate(string *, const DatetimeTz&);
|
// int generate(string *, const DatetimeTz&, const Config&);
|
// ostream generate(ostream&, const DatetimeTz&);
|
// ostream generate(ostream&, const DatetimeTz&, const Config&);
|
// int generateRaw(char *, const DatetimeTz&);
|
// int generateRaw(char *, const DatetimeTz&, const Config&);
|
#ifndef BDE_OMIT_INTERNAL_DEPRECATED
|
// int generate(char *, const DatetimeTz&, int);
|
// int generate(char *, const DatetimeTz&, int, bool useZ);
|
// ostream generate(ostream&, const DatetimeTz&, bool useZ);
|
// int generateRaw(char *, const DatetimeTz&, bool useZ);
|
#endif // BDE_OMIT_INTERNAL_DEPRECATED
|
// --------------------------------------------------------------------
|
if (verbose) cout << endl
|
<< "GENERATE 'DatetimeTz'" << endl
|
<< "=====================" << endl;
|
typedef bdlt::DatetimeTz TYPE;
|
const int OBJLEN = Util::k_DATETIMETZ_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_TIME_DATA = NUM_DEFAULT_TIME_DATA;
|
const DefaultTimeDataRow (&TIME_DATA)[NUM_TIME_DATA] =
|
DEFAULT_TIME_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] =
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.