Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
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
LHCb
Rec
Commits
7b7ca845
Commit
7b7ca845
authored
1 year ago
by
Tommaso Fulghesu
Committed by
Sebastien Ponce
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for empty RelationTable
parent
95c43f63
No related branches found
No related tags found
2 merge requests
!3788
Draft: Update SciFi cluster monitoring
,
!3694
Add tests for empty RelationTable
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Phys/FunctorCore/include/Functors/Functional.h
+4
-0
4 additions, 0 deletions
Phys/FunctorCore/include/Functors/Functional.h
Phys/FunctorCore/tests/src/TestFunctors.cpp
+14
-0
14 additions, 0 deletions
Phys/FunctorCore/tests/src/TestFunctors.cpp
with
18 additions
and
0 deletions
Phys/FunctorCore/include/Functors/Functional.h
+
4
−
0
View file @
7b7ca845
...
...
@@ -221,6 +221,8 @@ namespace Functors::Functional {
using
std
::
next
;
using
std
::
make_pair
;
if
(
begin
(
range
)
==
end
(
range
)
)
throw
std
::
runtime_error
(
"Attempt to iterate over an empty range"
);
auto
min_entry
=
std
::
accumulate
(
next
(
begin
(
range
)
),
end
(
range
),
make_pair
(
*
begin
(
range
),
functor
(
mask_arg
,
mask
,
*
begin
(
range
),
input
...
)
),
...
...
@@ -264,6 +266,8 @@ namespace Functors::Functional {
using
std
::
next
;
using
std
::
make_pair
;
if
(
begin
(
range
)
==
end
(
range
)
)
throw
std
::
runtime_error
(
"Attempt to iterate over an empty range"
);
auto
max_entry
=
std
::
accumulate
(
next
(
begin
(
range
)
),
end
(
range
),
make_pair
(
*
begin
(
range
),
functor
(
mask_arg
,
mask
,
*
begin
(
range
),
input
...
)
),
...
...
This diff is collapsed.
Click to expand it.
Phys/FunctorCore/tests/src/TestFunctors.cpp
+
14
−
0
View file @
7b7ca845
...
...
@@ -1222,6 +1222,7 @@ BOOST_AUTO_TEST_CASE( test_relation_table_isolation ) {
Functors
::
TopLevelInfo
top_level
;
IsolationTable
table
=
make_relations2D
(
parts
);
IsolationTable
empty_table
;
auto
const
front_weight
=
Functors
::
chain
(
Functors
::
Common
::
Weight
{},
Functors
::
Functional
::
Front
{},
Functors
::
Common
::
Relations
{}
);
...
...
@@ -1246,13 +1247,26 @@ BOOST_AUTO_TEST_CASE( test_relation_table_isolation ) {
PT
,
Functors
::
Common
::
To
{},
Functors
::
Functional
::
EntryWithMaxRelatedValueOf
(
Functors
::
Common
::
Weight
{}
),
Functors
::
Common
::
Relations
{}
);
auto
const
pt_to_max_weight_entry_prepped
=
pt_to_max_weight_entry
.
prepare
(
evtCtx
,
top_level
);
auto
empty_test
=
pt_to_min_weight_entry_prepped
(
true
,
empty_table
,
parts
(
0
)
);
auto
empty_test2
=
pt_to_max_weight_entry_prepped
(
true
,
empty_table
,
parts
(
1
)
);
auto
pt_wmin
=
pt_to_min_weight_entry_prepped
(
true
,
table
,
parts
(
2
)
);
auto
pt_wmax
=
pt_to_max_weight_entry_prepped
(
true
,
table
,
parts
(
2
)
);
BOOST_CHECK
(
!
empty_test
.
has_value
()
);
BOOST_CHECK
(
!
empty_test2
.
has_value
()
);
BOOST_CHECK
(
pt_wmin
.
has_value
()
);
BOOST_CHECK
(
pt_wmax
.
has_value
()
);
BOOST_CHECK
(
LHCb
::
Utils
::
as_arithmetic
(
pt_wmin
.
value
()
)
<
100
);
BOOST_CHECK
(
LHCb
::
Utils
::
as_arithmetic
(
pt_wmax
.
value
()
)
>
100
);
auto
const
value_or_pt_to_min_weight_entry
=
Functors
::
chain
(
Functors
::
Functional
::
ValueOr
{
0
},
PT
,
Functors
::
Common
::
To
{},
Functors
::
Functional
::
EntryWithMinRelatedValueOf
(
Functors
::
Common
::
Weight
{}
),
Functors
::
Common
::
Relations
{}
);
auto
const
value_or_pt_to_min_weight_entry_prepped
=
value_or_pt_to_min_weight_entry
.
prepare
(
evtCtx
,
top_level
);
auto
value_or_empty_test
=
value_or_pt_to_min_weight_entry_prepped
(
true
,
empty_table
,
parts
(
0
)
);
BOOST_CHECK
(
LHCb
::
Utils
::
as_arithmetic
(
value_or_empty_test
)
==
0
);
auto
const
relation
=
Functors
::
Common
::
Relations
{}(
table
,
parts
(
1
)
);
BOOST_CHECK
(
relation
.
has_value
()
);
auto
pt_to
=
chain
(
PT
,
Functors
::
Common
::
To
{}
);
...
...
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