2014-11-26 16:20:55 +01:00
|
|
|
#ifndef __HELPER_H__
|
|
|
|
#define __HELPER_H__
|
|
|
|
|
|
|
|
|
2015-01-07 13:24:39 +01:00
|
|
|
#define TEST_PARSE_SQL_QUERY(query, output_var, num_statements) \
|
2016-02-27 14:24:23 +01:00
|
|
|
SQLParserResult* output_var = SQLParser::parseSQLString(query); \
|
2015-01-07 13:24:39 +01:00
|
|
|
ASSERT(output_var->isValid); \
|
2016-02-27 14:45:59 +01:00
|
|
|
ASSERT_EQ(output_var->size(), num_statements);
|
2015-01-07 13:24:39 +01:00
|
|
|
|
2014-11-26 16:20:55 +01:00
|
|
|
|
2014-12-18 12:11:26 +01:00
|
|
|
#define TEST_PARSE_SINGLE_SQL(query, stmt_type, stmt_class, output_var) \
|
2015-01-07 13:24:39 +01:00
|
|
|
TEST_PARSE_SQL_QUERY(query, stmt_list, 1); \
|
2015-01-06 19:47:59 +01:00
|
|
|
ASSERT_EQ(stmt_list->getStatement(0)->type(), stmt_type); \
|
|
|
|
stmt_class* output_var = (stmt_class*) stmt_list->getStatement(0);
|
2014-12-18 12:11:26 +01:00
|
|
|
|
2014-11-26 16:20:55 +01:00
|
|
|
|
2015-01-07 13:42:11 +01:00
|
|
|
#define TEST_CAST_STMT(stmt_list, stmt_index, stmt_type, stmt_class, output_var) \
|
|
|
|
ASSERT_EQ(stmt_list->getStatement(stmt_index)->type(), stmt_type); \
|
|
|
|
stmt_class* output_var = (stmt_class*) stmt_list->getStatement(stmt_index);
|
|
|
|
|
|
|
|
|
2014-11-26 16:20:55 +01:00
|
|
|
#endif
|