Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Gaudi
Gaudi
Commits
db183448
Commit
db183448
authored
2 years ago
by
Marco Clemencic
Browse files
Options
Downloads
Plain Diff
Make Catch2 based test compatible with Catch2 v3
Closes
#252
See merge request
!1407
parents
120d966c
d77132d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1407
Make Catch2 based test compatible with Catch2 v3
Pipeline
#5034589
passed
2 years ago
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GaudiKernel/tests/src/CounterSerializationTest.cpp
+15
-4
15 additions, 4 deletions
GaudiKernel/tests/src/CounterSerializationTest.cpp
GaudiKernel/tests/src/MonitoringEntityUnitTest.cpp
+8
-1
8 additions, 1 deletion
GaudiKernel/tests/src/MonitoringEntityUnitTest.cpp
with
23 additions
and
5 deletions
GaudiKernel/tests/src/CounterSerializationTest.cpp
+
15
−
4
View file @
db183448
...
...
@@ -9,7 +9,18 @@
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#include
<Gaudi/Accumulators.h>
#include
<catch2/catch.hpp>
#if __has_include( <catch2/catch.hpp>)
// Catch2 v2
# include <catch2/catch.hpp>
namespace
Catch
{
using
Detail
::
Approx
;
}
#else
// Catch2 v3
# include <catch2/catch_approx.hpp>
# include <catch2/catch_template_test_macros.hpp>
# include <catch2/catch_test_macros.hpp>
#endif
using
namespace
Gaudi
::
Accumulators
;
...
...
@@ -109,7 +120,7 @@ namespace {
CHECK
(
j
[
"sum"
].
get
<
double
>
()
==
60
);
CHECK
(
j
[
"mean"
].
get
<
double
>
()
==
20
);
CHECK
(
j
[
"sum2"
].
get
<
double
>
()
==
1400
);
CHECK
(
j
[
"standard_deviation"
].
get
<
double
>
()
==
Approx
(
8.164966
)
);
CHECK
(
j
[
"standard_deviation"
].
get
<
double
>
()
==
Catch
::
Approx
(
8.164966
)
);
}
}
};
...
...
@@ -134,7 +145,7 @@ namespace {
CHECK
(
j
[
"sum"
].
get
<
double
>
()
==
60
);
CHECK
(
j
[
"mean"
].
get
<
double
>
()
==
20
);
CHECK
(
j
[
"sum2"
].
get
<
double
>
()
==
1400
);
CHECK
(
j
[
"standard_deviation"
].
get
<
double
>
()
==
Approx
(
8.164966
)
);
CHECK
(
j
[
"standard_deviation"
].
get
<
double
>
()
==
Catch
::
Approx
(
8.164966
)
);
CHECK
(
j
[
"min"
].
get
<
double
>
()
==
10
);
CHECK
(
j
[
"max"
].
get
<
double
>
()
==
30
);
}
...
...
@@ -160,7 +171,7 @@ namespace {
CHECK
(
j
[
"nTrueEntries"
].
get
<
double
>
()
==
5
);
CHECK
(
j
[
"nFalseEntries"
].
get
<
double
>
()
==
5
);
CHECK
(
j
[
"efficiency"
].
get
<
double
>
()
==
0.5
);
CHECK
(
j
[
"efficiencyErr"
].
get
<
double
>
()
==
Approx
(
0.158114
)
);
CHECK
(
j
[
"efficiencyErr"
].
get
<
double
>
()
==
Catch
::
Approx
(
0.158114
)
);
}
}
};
...
...
This diff is collapsed.
Click to expand it.
GaudiKernel/tests/src/MonitoringEntityUnitTest.cpp
+
8
−
1
View file @
db183448
...
...
@@ -9,12 +9,19 @@
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#include
<Gaudi/Accumulators.h>
#include
<catch2/catch.hpp>
#include
<map>
#include
<optional>
#include
<string>
#include
<utility>
#if __has_include( <catch2/catch.hpp>)
// Catch2 v2
# include <catch2/catch.hpp>
#else
// Catch2 v3
# include <catch2/catch_test_macros.hpp>
#endif
namespace
{
/// Mock helpers to be able to invoke counters auto registering constructor.
Gaudi
::
Monitoring
::
Hub
localHub
;
...
...
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