Fixing bad test [#METR-23472].

This commit is contained in:
Alexey Milovidov 2016-11-13 05:19:38 +03:00
parent 667db6b5ae
commit be7cc18d00
2 changed files with 1082 additions and 1079 deletions

View File

@ -48,6 +48,7 @@ target_link_libraries (logical_expressions_optimizer dbms)
add_executable (in_join_subqueries_preprocessor in_join_subqueries_preprocessor.cpp)
target_link_libraries (in_join_subqueries_preprocessor dbms)
add_check(in_join_subqueries_preprocessor)
add_executable (users users.cpp)
target_link_libraries (users dbms ${BOOST_FILESYSTEM_LIB})

View File

@ -62,17 +62,13 @@ struct TestEntry
using TestEntries = std::vector<TestEntry>;
using TestResult = std::pair<bool, std::string>;
void run();
void performTests(const TestEntries & entries);
TestResult check(const TestEntry & entry);
bool parse(DB::ASTPtr & ast, const std::string & query);
bool equals(const DB::ASTPtr & lhs, const DB::ASTPtr & rhs);
void reorder(DB::IAST * ast);
void run()
TestEntries entries =
{
TestEntries entries =
{
/// Тривиальный запрос.
{
@ -1138,12 +1134,10 @@ void run()
DB::DistributedProductMode::DENY,
true
}
};
};
performTests(entries);
}
void performTests(const TestEntries & entries)
bool performTests(const TestEntries & entries)
{
unsigned int count = 0;
unsigned int i = 1;
@ -1157,12 +1151,21 @@ void performTests(const TestEntries & entries)
std::cout << "Test " << i << " passed.\n";
}
else
std::cout << "Test " << i << " at line " << entry.line_num << " failed. Expected: "
<< entry.expected_output << ". Received: " << res.second << "\n";
std::cout << "Test " << i << " at line " << entry.line_num << " failed.\n"
"Expected: " << entry.expected_output << ".\n"
"Received: " << res.second << "\n";
++i;
}
std::cout << count << " out of " << entries.size() << " test(s) passed.\n";
return count == entries.size();
}
bool run()
{
return performTests(entries);
}
TestResult check(const TestEntry & entry)
@ -1270,6 +1273,5 @@ void reorder(DB::IAST * ast)
int main()
{
run();
return 0;
return run() ? EXIT_SUCCESS : EXIT_FAILURE;
}