mirror of https://github.com/google/benchmark.git
Allow calling Args and ArgNames in any order.
This commit is contained in:
parent
cfee1a54e4
commit
3f23832a09
|
@ -422,7 +422,11 @@ Benchmark* Benchmark::ThreadPerCpu() {
|
|||
void Benchmark::SetName(const char* name) { name_ = name; }
|
||||
|
||||
int Benchmark::ArgsCnt() const {
|
||||
return args_.empty() ? -1 : static_cast<int>(args_.front().size());
|
||||
if (args_.empty()) {
|
||||
if (arg_names_.empty()) return -1;
|
||||
return static_cast<int>(arg_names_.size());
|
||||
}
|
||||
return static_cast<int>(args_.front().size());
|
||||
}
|
||||
|
||||
//=============================================================================//
|
||||
|
|
|
@ -73,7 +73,7 @@ void BM_arg_name(benchmark::State& state) {
|
|||
while (state.KeepRunning()) {
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_arg_name)->Arg(3)->ArgName("first");
|
||||
BENCHMARK(BM_arg_name)->ArgName("first")->Arg(3);
|
||||
ADD_CASES(TC_ConsoleOut, {{"^BM_arg_name/first:3 %console_report$"}});
|
||||
ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_arg_name/first:3\",$"}});
|
||||
ADD_CASES(TC_CSVOut, {{"^\"BM_arg_name/first:3\",%csv_report$"}});
|
||||
|
|
Loading…
Reference in New Issue