mirror of
https://github.com/pocoproject/poco.git
synced 2025-12-11 20:37:30 +01:00
* chore(CppParser): 0, NULL --> nullptr * chore(Crypto): 0, NULL --> nullptr * chore(DNSSD): 0, NULL --> nullptr * chore(Encodings): 0, NULL --> nullptr * chore(CppUnit): Correct indentation. * chore(Foundation): 0, NULL --> nullptr * chore(CMake): Always warn about wrong nullptr usage when compiling with GCC or CLang * chore(Net): 0, NULL --> nullptr * chore(Foundation): 0, NULL --> nullptr * chore(Data): 0, NULL --> nullptr * chore(macOS): 0, NULL --> nullptr * chore(XML): 0, NULL --> nullptr * chore(Zip): 0, NULL --> nullptr * chore(Util): 0, NULL --> nullptr * chore(Net/NetSSL): 0, NULL --> nullptr * chore(Bonjour): 0, NULL --> nullptr * chore(MongoDB, Redis): 0, NULL --> nullptr * chore(Poco): 0, NULL --> nullptr * chore(Win32): 0, NULL --> nullptr * chore(CMake): Only warn about nullptr when verbose warnings are enabled. * Potential fix for code scanning alert no. 1634: Guarded Free Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * chore(Net): Fix warning reported by gitlab. * chore(gitlab CI): attempt to clean to gain disk space on the runner. * chore(gitlab CI): Run build with --parallel 4, correct docker cleanup. --------- Co-authored-by: Aleksandar Fabijanic <aleks-f@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
@@ -22,59 +22,59 @@ TEST(AutoQueryFileTest) {
|
||||
// Parse command line arguments to retrieve query files.
|
||||
uint i = 1;
|
||||
for (; i < args.size(); ++i) {
|
||||
if (args[i] == "-f") {
|
||||
query_files.push_back(args[++i]);
|
||||
}
|
||||
if (args[i] == "-f") {
|
||||
query_files.push_back(args[++i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Read list of queries from all input files.
|
||||
std::vector<std::string> lines;
|
||||
for (std::string path : query_files) {
|
||||
std::vector<std::string> tmp = readlines(path);
|
||||
lines.insert(lines.end(), tmp.begin(), tmp.end());
|
||||
std::vector<std::string> tmp = readlines(path);
|
||||
lines.insert(lines.end(), tmp.begin(), tmp.end());
|
||||
}
|
||||
|
||||
// Execute queries.
|
||||
size_t num_executed = 0;
|
||||
size_t num_failed = 0;
|
||||
for (std::string line : lines) {
|
||||
bool expected_result = true;
|
||||
std::string query = line;
|
||||
bool expected_result = true;
|
||||
std::string query = line;
|
||||
|
||||
// If a line starts with '!' parsing is expected to fail.
|
||||
if (query.at(0) == '!') {
|
||||
expected_result = false;
|
||||
query = query.substr(1);
|
||||
}
|
||||
// If a line starts with '!' parsing is expected to fail.
|
||||
if (query.at(0) == '!') {
|
||||
expected_result = false;
|
||||
query = query.substr(1);
|
||||
}
|
||||
|
||||
// Measuring the parsing time.
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
// Measuring the parsing time.
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
// Parse the query.
|
||||
hsql::SQLParserResult result;
|
||||
hsql::SQLParser::parse(query, &result);
|
||||
// Parse the query.
|
||||
hsql::SQLParserResult result;
|
||||
hsql::SQLParser::parse(query, &result);
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
double us = elapsed_seconds.count() * 1000 * 1000;
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
double us = elapsed_seconds.count() * 1000 * 1000;
|
||||
|
||||
if (expected_result == result.isValid()) {
|
||||
printf("\033[0;32m{ ok} (%.1fus)\033[0m %s\n", us, line.c_str());
|
||||
} else {
|
||||
printf("\033[0;31m{ failed}\033[0m\n");
|
||||
printf("\t\033[0;31m%s (L%d:%d)\n\033[0m", result.errorMsg(), result.errorLine(), result.errorColumn());
|
||||
printf("\t%s\n", line.c_str());
|
||||
++num_failed;
|
||||
}
|
||||
++num_executed;
|
||||
if (expected_result == result.isValid()) {
|
||||
printf("\033[0;32m{ ok} (%.1fus)\033[0m %s\n", us, line.c_str());
|
||||
} else {
|
||||
printf("\033[0;31m{ failed}\033[0m\n");
|
||||
printf("\t\033[0;31m%s (L%d:%d)\n\033[0m", result.errorMsg(), result.errorLine(), result.errorColumn());
|
||||
printf("\t%s\n", line.c_str());
|
||||
++num_failed;
|
||||
}
|
||||
++num_executed;
|
||||
}
|
||||
|
||||
if (num_failed == 0) {
|
||||
printf("\033[0;32m{ ok} \033[0mAll %lu grammar tests completed successfully!\n", num_executed);
|
||||
printf("\033[0;32m{ ok} \033[0mAll %lu grammar tests completed successfully!\n", num_executed);
|
||||
} else {
|
||||
fprintf(stderr, "\033[0;31m{ failed} \033[0mSome grammar tests failed! %lu out of %lu tests failed!\n", num_failed,
|
||||
num_executed);
|
||||
fprintf(stderr, "\033[0;31m{ failed} \033[0mSome grammar tests failed! %lu out of %lu tests failed!\n", num_failed,
|
||||
num_executed);
|
||||
}
|
||||
ASSERT_EQ(num_failed, 0);
|
||||
}
|
||||
@@ -84,14 +84,14 @@ std::vector<std::string> readlines(std::string path) {
|
||||
std::vector<std::string> lines;
|
||||
std::string line;
|
||||
while (std::getline(infile, line)) {
|
||||
std::istringstream iss(line);
|
||||
std::istringstream iss(line);
|
||||
|
||||
// Skip comments.
|
||||
if (line[0] == '#' || (line[0] == '-' && line[1] == '-')) {
|
||||
continue;
|
||||
}
|
||||
// Skip comments.
|
||||
if (line[0] == '#' || (line[0] == '-' && line[1] == '-')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lines.push_back(line);
|
||||
lines.push_back(line);
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user