Add tests for SUBSTR support (#96)
* Add test for SUBSTR support * Trigger CI * Trigger * Trigger * Trigger * Remove CMake file
This commit is contained in:
parent
73ed061d7d
commit
1f564e16b8
|
@ -16,6 +16,7 @@ SELECT a, MAX(b), MAX(c, d), CUSTOM(q, UP(r)) AS f FROM t1;
|
|||
SELECT * FROM t WHERE a BETWEEN 1 and c;
|
||||
SELECT * FROM t WHERE a = ? AND b = ?;
|
||||
SELECT City.name, Product.category, SUM(price) FROM fact INNER JOIN City ON fact.city_id = City.id INNER JOIN Product ON fact.product_id = Product.id GROUP BY City.name, Product.category;
|
||||
SELECT SUBSTR(a, 3, 5) FROM t;
|
||||
# JOIN
|
||||
SELECT t1.a, t1.b, t2.c FROM "table" AS t1 JOIN (SELECT * FROM foo JOIN bar ON foo.id = bar.id) t2 ON t1.a = t2.b WHERE (t1.b OR NOT t1.a) AND t2.c = 12.5
|
||||
SELECT * FROM t1 JOIN t2 ON c1 = c2;
|
||||
|
|
|
@ -55,6 +55,35 @@ TEST(SelectExprTest) {
|
|||
ASSERT_STREQ(stmt->selectList->at(2)->exprList->at(1)->exprList->at(0)->getName(), "un");
|
||||
}
|
||||
|
||||
TEST(SelectSubstrTest) {
|
||||
TEST_PARSE_SINGLE_SQL(
|
||||
"SELECT SUBSTR(a, 3, 5) FROM students;",
|
||||
kStmtSelect,
|
||||
SelectStatement,
|
||||
result,
|
||||
stmt);
|
||||
|
||||
ASSERT_NULL(stmt->whereClause);
|
||||
ASSERT_NULL(stmt->groupBy);
|
||||
|
||||
ASSERT_EQ(stmt->selectList->size(), 1);
|
||||
|
||||
ASSERT(stmt->selectList->at(0)->isType(kExprFunctionRef));
|
||||
ASSERT_STREQ(stmt->selectList->at(0)->getName(), "SUBSTR");
|
||||
|
||||
ASSERT_NOTNULL(stmt->selectList->at(0)->exprList);
|
||||
ASSERT_EQ(stmt->selectList->at(0)->exprList->size(), 3);
|
||||
|
||||
ASSERT(stmt->selectList->at(0)->exprList->at(0)->isType(kExprColumnRef));
|
||||
ASSERT_STREQ(stmt->selectList->at(0)->exprList->at(0)->getName(), "a");
|
||||
|
||||
ASSERT(stmt->selectList->at(0)->exprList->at(1)->isType(kExprLiteralInt));
|
||||
ASSERT_EQ(stmt->selectList->at(0)->exprList->at(1)->ival, 3);
|
||||
|
||||
ASSERT(stmt->selectList->at(0)->exprList->at(2)->isType(kExprLiteralInt));
|
||||
ASSERT_EQ(stmt->selectList->at(0)->exprList->at(2)->ival, 5);
|
||||
}
|
||||
|
||||
|
||||
TEST(SelectHavingTest) {
|
||||
TEST_PARSE_SINGLE_SQL(
|
||||
|
|
Loading…
Reference in New Issue