text
stringlengths 0
2.2M
|
---|
const char *INPUT = DATA[i].d_input;
|
const int INPUT_LENGTH =
|
static_cast<int>(bsl::strlen(INPUT)) - 1;
|
const Type EXPECTED_RESULT = DATA[i].d_result;
|
Type mX(!EXPECTED_RESULT); const Type& X = mX;
|
int retCode = Util::parse(&mX,
|
INPUT,
|
INPUT_LENGTH,
|
bdlat_FormattingMode::e_DEFAULT);
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
}
|
}
|
if (verbose) cout << "\nUsing 'HEX'." << endl;
|
{
|
typedef bsl::vector<char> Type;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
const char *d_result;
|
} DATA[] = {
|
//line input result
|
//---- ----- ------
|
{ L_, "X", "", },
|
{ L_, "61X", "a", },
|
{ L_, "6162X", "ab", },
|
{ L_, "616263X", "abc", },
|
{ L_, "61626364X", "abcd", },
|
};
|
const int NUM_DATA = sizeof DATA / sizeof *DATA;
|
for (int i = 0; i < NUM_DATA; ++i) {
|
const int LINE = DATA[i].d_lineNum;
|
const char *INPUT = DATA[i].d_input;
|
const char *RESULT = DATA[i].d_result;
|
const int INPUT_LENGTH =
|
static_cast<int>(bsl::strlen(INPUT)) - 1;
|
const bsl::size_t RESULT_LENGTH = bsl::strlen(RESULT);
|
const Type EXPECTED_RESULT(RESULT, RESULT + RESULT_LENGTH);
|
Type mX; const Type& X = mX;
|
int retCode = Util::parse(&mX,
|
INPUT,
|
INPUT_LENGTH,
|
bdlat_FormattingMode::e_HEX);
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
}
|
}
|
if (verbose) cout << "\nUsing 'IS_LIST'." << endl;
|
{
|
typedef int ElemType;
|
typedef bsl::vector<ElemType> Type;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
ElemType d_result[5];
|
int d_numResult;
|
} DATA[] = {
|
//line input result numResult
|
//---- ----- ------ ---------
|
{ L_, "X", { }, 0, },
|
{ L_, "1X", { 1 }, 1, },
|
{ L_, "1 4X", { 1, 4 }, 2, },
|
{ L_, "1 4 2X", { 1, 4, 2 }, 3, },
|
{ L_, "1 4 2 8X", { 1, 4, 2, 8 }, 4, },
|
{ L_, "1 4 2 8 23X", { 1, 4, 2, 8, 23 }, 5, },
|
};
|
const int NUM_DATA = sizeof DATA / sizeof *DATA;
|
for (int i = 0; i < NUM_DATA; ++i) {
|
const int LINE = DATA[i].d_lineNum;
|
const char *INPUT = DATA[i].d_input;
|
const int INPUT_LENGTH =
|
static_cast<int>(bsl::strlen(INPUT)) - 1;
|
const ElemType *RESULT = DATA[i].d_result;
|
const int NUM_RESULT = DATA[i].d_numResult;
|
const Type EXPECTED_RESULT(RESULT, RESULT + NUM_RESULT);
|
Type mX; const Type& X = mX;
|
Type mY; const Type& Y = mY;
|
int retCode = Util::parse(&mX,
|
INPUT,
|
INPUT_LENGTH,
|
bdlat_FormattingMode::e_LIST);
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.