Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
physics_benchmarks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
benchmarks
physics_benchmarks
Commits
436c5c0d
Commit
436c5c0d
authored
4 years ago
by
Sylvester Joosten
Browse files
Options
Downloads
Patches
Plain Diff
treat 'weight' as optional variable, initialized to 1
parent
ef72a933
No related branches found
No related tags found
1 merge request
!17
Aggregate benchmark results
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
util/benchmark.hh
+5
-2
5 additions, 2 deletions
util/benchmark.hh
with
5 additions
and
2 deletions
util/benchmark.hh
+
5
−
2
View file @
436c5c0d
...
@@ -69,17 +69,20 @@ struct test_definition_error : exception {
...
@@ -69,17 +69,20 @@ struct test_definition_error : exception {
// - result: pass/fail/error
// - result: pass/fail/error
struct
test
{
struct
test
{
test
(
nlohmann
::
json
definition
)
:
json
{
std
::
move
(
definition
)}
{
test
(
nlohmann
::
json
definition
)
:
json
{
std
::
move
(
definition
)}
{
json
[
"weight"
]
=
1.0
;
// initialize with error (as we don't have a value yet)
// initialize with error (as we don't have a value yet)
error
();
error
();
// Check that all required fields are present
// Check that all required fields are present
for
(
const
auto
&
field
:
{
"name"
,
"title"
,
"description"
,
"quantity"
,
for
(
const
auto
&
field
:
{
"name"
,
"title"
,
"description"
,
"quantity"
,
"target"
,
"value"
,
"weight"
,
"result"
})
{
"target"
,
"value"
,
"result"
})
{
if
(
json
.
find
(
field
)
==
json
.
end
())
{
if
(
json
.
find
(
field
)
==
json
.
end
())
{
throw
test_definition_error
{
throw
test_definition_error
{
fmt
::
format
(
"Error in test definition: field '{}' missing"
,
field
)};
fmt
::
format
(
"Error in test definition: field '{}' missing"
,
field
)};
}
}
}
}
// Default "weight" to 1 if not set
if
(
json
.
find
(
"weight"
)
==
json
.
end
())
{
json
[
"weight"
]
=
1.0
;
}
}
}
// Set this test to pass/fail/error
// Set this test to pass/fail/error
void
pass
(
double
value
)
{
update_result
(
"pass"
,
value
);
}
void
pass
(
double
value
)
{
update_result
(
"pass"
,
value
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment