fea9031605
Summary: Fix tests Reviewers: buda, florijan, teon.banek Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D435
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#define LOG_NO_INFO 1
|
|
|
|
#include "benchmark/benchmark_api.h"
|
|
#include "logging/default.hpp"
|
|
#include "logging/streams/stdout.hpp"
|
|
#include "query/stripped.hpp"
|
|
#include "yaml-cpp/yaml.h"
|
|
|
|
auto BM_Strip = [](benchmark::State &state, auto &function, std::string query) {
|
|
while (state.KeepRunning()) {
|
|
for (int start = 0; start < state.range(0); start++) {
|
|
function(query);
|
|
}
|
|
}
|
|
state.SetComplexityN(state.range(0));
|
|
};
|
|
|
|
int main(int argc, char **argv) {
|
|
logging::init_async();
|
|
logging::log->pipe(std::make_unique<Stdout>());
|
|
|
|
YAML::Node dataset = YAML::LoadFile(
|
|
"../../tests/data/cypher_queries/stripper/query_dict.yaml");
|
|
|
|
auto preprocess = [](const std::string &query) {
|
|
return query::StrippedQuery(query);
|
|
};
|
|
|
|
auto tests = dataset["benchmark_queries"].as<std::vector<std::string>>();
|
|
for (auto &test : tests) {
|
|
benchmark::RegisterBenchmark(test.c_str(), BM_Strip, preprocess, test)
|
|
->Range(1, 1)
|
|
->Complexity(benchmark::oN);
|
|
}
|
|
|
|
benchmark::Initialize(&argc, argv);
|
|
benchmark::RunSpecifiedBenchmarks();
|
|
|
|
return 0;
|
|
}
|