HyriseSQLParser/test/lib/helper.h

22 lines
740 B
C
Raw Normal View History

2014-11-26 16:20:55 +01:00
#ifndef __HELPER_H__
#define __HELPER_H__
2016-02-27 15:22:22 +01:00
#define TEST_PARSE_SQL_QUERY(query, outputVar, numStatements) \
SQLParserResult* outputVar = SQLParser::parseSQLString(query); \
ASSERT(outputVar->isValid); \
ASSERT_EQ(outputVar->size(), numStatements);
2015-01-07 13:24:39 +01:00
2014-11-26 16:20:55 +01:00
2016-02-27 15:22:22 +01:00
#define TEST_PARSE_SINGLE_SQL(query, stmtType, stmtClass, outputVar) \
2015-01-07 13:24:39 +01:00
TEST_PARSE_SQL_QUERY(query, stmt_list, 1); \
2016-02-27 15:22:22 +01:00
ASSERT_EQ(stmt_list->getStatement(0)->type(), stmtType); \
stmtClass* outputVar = (stmtClass*) stmt_list->getStatement(0);
2014-12-18 12:11:26 +01:00
2014-11-26 16:20:55 +01:00
2016-02-27 15:22:22 +01:00
#define TEST_CAST_STMT(stmt_list, stmt_index, stmtType, stmtClass, outputVar) \
ASSERT_EQ(stmt_list->getStatement(stmt_index)->type(), stmtType); \
stmtClass* outputVar = (stmtClass*) stmt_list->getStatement(stmt_index);
2015-01-07 13:42:11 +01:00
2014-11-26 16:20:55 +01:00
#endif