text
stringlengths 0
2.2M
|
---|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
}
|
}
|
if (verbose) cout << "\nUsing 'MyEnumeration::Value'." << endl;
|
{
|
typedef test::MyEnumeration::Value Type;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
Type d_result;
|
} DATA[] = {
|
//line input result
|
//---- ----- ------
|
{ L_, "VALUE1X", test::MyEnumeration::VALUE1, },
|
{ L_, "VALUE2X", test::MyEnumeration::VALUE2, },
|
};
|
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 Type EXPECTED_RESULT = DATA[i].d_result;
|
Type mX; const Type& X = mX;
|
int retCode = Util::parseDefault(&mX, INPUT, INPUT_LENGTH);
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
}
|
}
|
if (verbose) cout << "\nUsing 'CustomizedString'." << endl;
|
{
|
typedef test::CustomizedString Type;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
Type d_result;
|
} DATA[] = {
|
//line input result
|
//---- ----- ------
|
{ L_, "X", Type(""), },
|
{ L_, "aX", Type("a"), },
|
{ L_, "abX", Type("ab"), },
|
{ L_, "abcX", Type("abc"), },
|
{ L_, "abcdX", Type("abcd"), },
|
{ L_, "abcdeX", Type("abcde"), },
|
};
|
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 Type EXPECTED_RESULT = DATA[i].d_result;
|
Type mX; const Type& X = mX;
|
int retCode = Util::parseDefault(&mX, INPUT, INPUT_LENGTH);
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
}
|
}
|
if (verbose) cout << "\nUsing 'CustomizedInt'." << endl;
|
{
|
typedef test::CustomizedInt Type;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
Type d_result;
|
} DATA[] = {
|
//line input result
|
//---- ----- ------
|
{ L_, "-2147483648X", Type(-2147483647-1), },
|
{ L_, "-2147483647X", Type(-2147483647), },
|
{ L_, "-1X", Type(-1), },
|
{ L_, "0X", Type(0), },
|
{ L_, "1X", Type(1), },
|
{ L_, "2X", Type(2), },
|
{ L_, "3X", Type(3), },
|
{ L_, "4X", Type(4), },
|
{ L_, "5X", Type(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;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.