2014-11-26 16:20:55 +01:00
|
|
|
#ifndef __HELPER_H__
|
|
|
|
#define __HELPER_H__
|
|
|
|
|
|
|
|
|
2017-02-08 03:54:38 +01:00
|
|
|
#define TEST_PARSE_SQL_QUERY(query, result, numStatements) \
|
2017-04-09 13:34:40 +02:00
|
|
|
hsql::SQLParserResult result; \
|
2017-07-21 02:47:45 +02:00
|
|
|
hsql::SQLParser::parse(query, &result); \
|
2017-04-07 16:26:00 +02:00
|
|
|
ASSERT(result.isValid()); \
|
|
|
|
ASSERT_EQ(result.size(), numStatements);
|
2015-01-07 13:24:39 +01:00
|
|
|
|
2014-11-26 16:20:55 +01:00
|
|
|
|
2017-02-08 03:54:38 +01:00
|
|
|
#define TEST_PARSE_SINGLE_SQL(query, stmtType, stmtClass, result, outputVar) \
|
|
|
|
TEST_PARSE_SQL_QUERY(query, result, 1); \
|
2017-04-07 16:26:00 +02:00
|
|
|
ASSERT_EQ(result.getStatement(0)->type(), stmtType); \
|
|
|
|
const stmtClass* outputVar = (const stmtClass*) result.getStatement(0);
|
2014-12-18 12:11:26 +01:00
|
|
|
|
2014-11-26 16:20:55 +01:00
|
|
|
|
2017-02-08 03:54:38 +01:00
|
|
|
#define TEST_CAST_STMT(result, stmt_index, stmtType, stmtClass, outputVar) \
|
2017-04-07 16:26:00 +02:00
|
|
|
ASSERT_EQ(result.getStatement(stmt_index)->type(), stmtType); \
|
|
|
|
const stmtClass* outputVar = (const stmtClass*) result.getStatement(stmt_index);
|
2015-01-07 13:42:11 +01:00
|
|
|
|
|
|
|
|
2017-02-08 02:59:07 +01:00
|
|
|
#endif
|