You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
759 B

/**
* Copyright (c) 2018 Niklas Rosenstein
* MIT licensed.
*/
#include <benchmark/benchmark.h>
#include <gtest/gtest.h>
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
::benchmark::Initialize(&argc, argv);
bool run_tests = true;
bool run_benchmarks = true;
if (argc == 2) {
if (strcmp(argv[1], "test") == 0) {
run_benchmarks = false;
--argc;
}
else if (strcmp(argv[1], "benchmark") == 0) {
run_tests = false;
--argc;
}
}
if (argc > 1) {
fprintf(stdout, "%s: error: unhandled argument: %s", argv[0], argv[1]);
return 1;
}
int res = 0;
if (run_tests)
res = RUN_ALL_TESTS();
if (run_benchmarks)
::benchmark::RunSpecifiedBenchmarks();
return res;
}