Verify that output of 'query' has the same precision and scale as 'expected_type'. 'query' is an expression, optionally followed by a from clause which is needed for testing aggregate expressions.
| 604 | // 'query' is an expression, optionally followed by a from clause which is needed |
| 605 | // for testing aggregate expressions. |
| 606 | void TestDecimalResultType(const string& query, const ColumnType& expected_type) { |
| 607 | // For the case with from clause, we need to generate the "typeof query" by first |
| 608 | // extracting the select list. |
| 609 | size_t from_offset = query.find("from"); |
| 610 | string typeof_query; |
| 611 | if (from_offset != string::npos) { |
| 612 | int query_len = query.length(); |
| 613 | typeof_query = "typeof(" + query.substr(0, from_offset) + ")" + |
| 614 | query.substr(from_offset, query_len - from_offset); |
| 615 | } else { |
| 616 | typeof_query = "typeof(" + query + ")"; |
| 617 | } |
| 618 | const string typeof_result = GetValue(typeof_query, ColumnType(TYPE_STRING)); |
| 619 | EXPECT_EQ(expected_type.DebugString(), typeof_result) << typeof_query; |
| 620 | } |
| 621 | |
| 622 | // Decimals don't work with TestValue. |
| 623 | // TODO: figure out what operators need to be implemented to work with EXPECT_EQ |
nothing calls this directly
no test coverage detected