Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
ag-ohlberger
dune-community
dune-xt
Commits
f2d4c4a2
Commit
f2d4c4a2
authored
6 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[test.common] add means to obtain current test id
parent
223876ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/xt/common/test/common.hh
+47
-0
47 additions, 0 deletions
dune/xt/common/test/common.hh
with
47 additions
and
0 deletions
dune/xt/common/test/common.hh
+
47
−
0
View file @
f2d4c4a2
...
...
@@ -76,6 +76,20 @@ void busywait(const size_t ms);
namespace
Dune
{
namespace
XT
{
namespace
Common
{
namespace
Test
{
/**
* \sa DXTC_TEST_CONFIG_GET
* \sa DXTC_TEST_CONFIG_SET
* \sa DXTC_TEST_CONFIG_SUB
*/
std
::
string
get_unique_test_name
();
}
// namespace Test
}
// namespace Common
namespace
Test
{
namespace
internal
{
...
...
@@ -193,4 +207,37 @@ ostream& operator<<(ostream& out, const map<F, S>& results)
}
// namespace std
/**
* \brief Can be used to access the configuration assosicated with the currently running test
* \sa get_unique_test_name
*/
template
<
typename
T
>
static
auto
DXTC_TEST_CONFIG_GET
(
const
std
::
string
&
key
,
T
def
)
->
decltype
(
DXTC_CONFIG
.
get
(
key
,
def
))
{
return
DXTC_CONFIG
.
get
(
Dune
::
XT
::
Common
::
Test
::
get_unique_test_name
()
+
"."
+
key
,
def
);
}
/**
* \brief Can be used to access the configuration assosicated with the currently running test
* \sa get_unique_test_name
*/
template
<
typename
T
>
static
void
DXTC_TEST_CONFIG_SET
(
const
std
::
string
&
key
,
T
val
)
{
return
DXTC_CONFIG
.
set
(
Dune
::
XT
::
Common
::
Test
::
get_unique_test_name
()
+
"."
+
key
,
val
,
/*overwrite=*/
true
);
}
/**
* \brief Can be used to access the configuration assosicated with the currently running test
* \sa get_unique_test_name
*/
static
Dune
::
XT
::
Common
::
Configuration
DXTC_TEST_CONFIG_SUB
(
const
std
::
string
&
sub_key
)
{
const
auto
key
=
Dune
::
XT
::
Common
::
Test
::
get_unique_test_name
()
+
"."
+
sub_key
;
EXPECT_TRUE
(
DXTC_CONFIG
.
has_sub
(
key
));
return
DXTC_CONFIG
.
sub
(
key
);
}
#endif // DUNE_XT_COMMON_TEST_MAIN_COMMON_HH
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