Files
cpp-project-template/third_party/benchmark/test/spec_arg_verbosity_test.cc
tqcq ea9d7b5f8c
All checks were successful
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Successful in 1m7s
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Successful in 1m15s
sm-rpc / build (Debug, host.gcc) (push) Successful in 1m4s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Successful in 1m16s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Successful in 1m34s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Successful in 1m33s
sm-rpc / build (Release, host.gcc) (push) Successful in 1m23s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Successful in 1m30s
feat(third_party): add oatpp,googltest,benchmark
2025-08-19 17:19:37 +08:00

44 lines
1.0 KiB
C++

#include <string.h>
#include <iostream>
#include "benchmark/benchmark.h"
// Tests that the user specified verbosity level can be get.
static void BM_Verbosity(benchmark::State& state) {
for (auto _ : state) {
}
}
BENCHMARK(BM_Verbosity);
int main(int argc, char** argv) {
const int32_t flagv = 42;
// Verify that argv specify --v=42.
bool found = false;
for (int i = 0; i < argc; ++i) {
if (strcmp("--v=42", argv[i]) == 0) {
found = true;
break;
}
}
if (!found) {
std::cerr << "This test requires '--v=42' to be passed as a command-line "
<< "argument.\n";
return 1;
}
benchmark::Initialize(&argc, argv);
// Check that the current flag value is reported accurately via the
// GetBenchmarkVerbosity() function.
if (flagv != benchmark::GetBenchmarkVerbosity()) {
std::cerr
<< "Seeing different value for flags. GetBenchmarkVerbosity() returns ["
<< benchmark::GetBenchmarkVerbosity() << "] expected flag=[" << flagv
<< "]\n";
return 1;
}
return 0;
}