Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
c1c01b2c
Commit
c1c01b2c
authored
Oct 25, 2016
by
Marek Kurdej
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle the case when the argument name is an empty string.
parent
17e1c405
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
benchmark_register.cc
src/benchmark_register.cc
+8
-4
reporter_output_test.cc
test/reporter_output_test.cc
+5
-4
No files found.
src/benchmark_register.cc
View file @
c1c01b2c
...
@@ -153,12 +153,16 @@ bool BenchmarkFamilies::FindBenchmarks(
...
@@ -153,12 +153,16 @@ bool BenchmarkFamilies::FindBenchmarks(
// Add arguments to instance name
// Add arguments to instance name
size_t
arg_i
=
0
;
size_t
arg_i
=
0
;
for
(
auto
const
&
arg
:
args
)
{
for
(
auto
const
&
arg
:
args
)
{
instance
.
name
+=
"/"
;
if
(
arg_i
<
family
->
arg_names_
.
size
())
{
if
(
arg_i
<
family
->
arg_names_
.
size
())
{
instance
.
name
+=
const
auto
&
arg_name
=
family
->
arg_names_
[
arg_i
];
StringPrintF
(
"/%s:"
,
family
->
arg_names_
[
arg_i
].
c_str
());
if
(
!
arg_name
.
empty
())
{
}
else
{
instance
.
name
+=
instance
.
name
+=
"/"
;
StringPrintF
(
"%s:"
,
family
->
arg_names_
[
arg_i
].
c_str
());
}
}
}
AppendHumanReadable
(
arg
,
&
instance
.
name
);
AppendHumanReadable
(
arg
,
&
instance
.
name
);
++
arg_i
;
++
arg_i
;
}
}
...
...
test/reporter_output_test.cc
View file @
c1c01b2c
...
@@ -86,10 +86,11 @@ void BM_arg_names(benchmark::State& state) {
...
@@ -86,10 +86,11 @@ void BM_arg_names(benchmark::State& state) {
while
(
state
.
KeepRunning
())
{
while
(
state
.
KeepRunning
())
{
}
}
}
}
BENCHMARK
(
BM_arg_names
)
->
Args
({
2
,
4
})
->
ArgNames
({
"first"
,
"second"
});
BENCHMARK
(
BM_arg_names
)
->
Args
({
2
,
5
,
4
})
->
ArgNames
({
"first"
,
""
,
"third"
});
ADD_CASES
(
TC_ConsoleOut
,
{{
"^BM_arg_names/first:2/second:4 %console_report$"
}});
ADD_CASES
(
TC_ConsoleOut
,
ADD_CASES
(
TC_JSONOut
,
{{
"
\"
name
\"
:
\"
BM_arg_names/first:2/second:4
\"
,$"
}});
{{
"^BM_arg_names/first:2/5/third:4 %console_report$"
}});
ADD_CASES
(
TC_CSVOut
,
{{
"^
\"
BM_arg_names/first:2/second:4
\"
,%csv_report$"
}});
ADD_CASES
(
TC_JSONOut
,
{{
"
\"
name
\"
:
\"
BM_arg_names/first:2/5/third:4
\"
,$"
}});
ADD_CASES
(
TC_CSVOut
,
{{
"^
\"
BM_arg_names/first:2/5/third:4
\"
,%csv_report$"
}});
// ========================================================================= //
// ========================================================================= //
// ----------------------- Testing Complexity Output ----------------------- //
// ----------------------- Testing Complexity Output ----------------------- //
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment