update tpch tests to use new interface
This commit is contained in:
parent
cfe69a44de
commit
d318ef0de4
|
@ -39,15 +39,15 @@ TEST(TPCHQueryGrammarTests) {
|
|||
for (const std::string& file_path : files) {
|
||||
std::string query = readFileContents(file_path);
|
||||
|
||||
SQLParserResult* result = SQLParser::parseSQLString(query.c_str());
|
||||
if (!result->isValid()) {
|
||||
SQLParserResult result;
|
||||
SQLParser::parseSQLString(query.c_str(), &result);
|
||||
if (!result.isValid()) {
|
||||
mt::printFailed(file_path.c_str());
|
||||
printf("%s %s (L%d:%d)%s\n", mt::red(), result->errorMsg(), result->errorLine(), result->errorColumn(), mt::def());
|
||||
printf("%s %s (L%d:%d)%s\n", mt::red(), result.errorMsg(), result.errorLine(), result.errorColumn(), mt::def());
|
||||
++testsFailed;
|
||||
} else {
|
||||
mt::printOk(file_path.c_str());
|
||||
}
|
||||
delete result;
|
||||
}
|
||||
ASSERT_EQ(testsFailed, 0);
|
||||
}
|
||||
|
@ -55,11 +55,12 @@ TEST(TPCHQueryGrammarTests) {
|
|||
TEST(TPCHQueryDetailTest) {
|
||||
std::string query = readFileContents("test/queries/tpc-h-16-22.sql");
|
||||
|
||||
SQLParserResult* result = SQLParser::parseSQLString(query.c_str());
|
||||
ASSERT(result->isValid());
|
||||
ASSERT_EQ(result->size(), 7);
|
||||
SQLParserResult result;
|
||||
SQLParser::parseSQLString(query.c_str(), &result);
|
||||
ASSERT(result.isValid());
|
||||
ASSERT_EQ(result.size(), 7);
|
||||
|
||||
const SQLStatement* stmt20 = result->getStatement(4);
|
||||
const SQLStatement* stmt20 = result.getStatement(4);
|
||||
ASSERT_EQ(stmt20->type(), kStmtSelect);
|
||||
|
||||
const SelectStatement* select20 = (const SelectStatement*) stmt20;
|
||||
|
@ -95,6 +96,4 @@ TEST(TPCHQueryDetailTest) {
|
|||
ASSERT_EQ(select20->order->size(), 1);
|
||||
ASSERT(select20->order->at(0)->expr->isType(kExprColumnRef));
|
||||
ASSERT_STREQ(select20->order->at(0)->expr->getName(), "S_NAME");
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue