| 1621 | } |
| 1622 | |
| 1623 | void printResults(const RowVectorPtr& result, std::ostream& out) { |
| 1624 | auto materializedRows = materialize(result); |
| 1625 | const auto& type = result->type(); |
| 1626 | for (const auto& row : materializedRows) { |
| 1627 | out << toString(row, type) << std::endl; |
| 1628 | } |
| 1629 | } |
| 1630 | |
| 1631 | void assertResultsBetween( |
| 1632 | const std::vector<RowVectorPtr>& expectedLess, |
| 1633 | const std::vector<RowVectorPtr>& expectedMore, |
| 1634 | const std::vector<RowVectorPtr>& actual, |
| 1635 | const RowTypePtr& resultType) { |
| 1636 | MaterializedRowMultiset actualRows; |
| 1637 | for (auto vector : actual) { |
| 1638 | auto rows = materialize(vector); |
| 1639 | std::copy( |
| 1640 | rows.begin(), rows.end(), std::inserter(actualRows, actualRows.end())); |
| 1641 | } |
| 1642 | |
| 1643 | MaterializedRowMultiset expectedRowsLess; |
| 1644 | for (auto vector : expectedLess) { |
| 1645 | auto rows = materialize(vector); |
| 1646 | std::copy( |
| 1647 | rows.begin(), |
| 1648 | rows.end(), |
| 1649 | std::inserter(expectedRowsLess, expectedRowsLess.end())); |
| 1650 | } |
| 1651 | |
| 1652 | MaterializedRowMultiset expectedRowsMore; |
| 1653 | for (auto vector : expectedMore) { |
| 1654 | auto rows = materialize(vector); |
| 1655 | std::copy( |
| 1656 | rows.begin(), |
| 1657 | rows.end(), |
| 1658 | std::inserter(expectedRowsMore, expectedRowsMore.end())); |
| 1659 | } |
| 1660 | |
| 1661 | if (not compareMaterializedRowsLess(expectedRowsLess, actualRows)) { |
| 1662 | auto message = |
| 1663 | generateUserFriendlyDiff(expectedRowsLess, actualRows, resultType); |
| 1664 | EXPECT_TRUE(false) << "Expected result above lower bound. Diffs are shown:" |
| 1665 | << message; |
| 1666 | } |
| 1667 | |
| 1668 | if (not compareMaterializedRowsLess(actualRows, expectedRowsMore)) { |
| 1669 | auto message = |
no test coverage detected