1818
1919using namespace edm ;
2020
21-
22-
23-
24-
25-
2621TEST_CASE (" ProductResolverIndexHelper" , " [ProductResolverIndexHelper]" ) {
2722 TypeID typeID_ProductID (typeid (ProductID));
2823 TypeID typeID_EventID (typeid (EventID));
@@ -31,12 +26,15 @@ TEST_CASE("ProductResolverIndexHelper", "[ProductResolverIndexHelper]") {
3126 edm::ProductResolverIndexHelper helper;
3227 helper.setFrozen (" processA" );
3328
34- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) == ProductResolverIndexInvalid);
35- REQUIRE (helper.index (ELEMENT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) == ProductResolverIndexInvalid);
29+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) ==
30+ ProductResolverIndexInvalid);
31+ REQUIRE (helper.index (ELEMENT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) ==
32+ ProductResolverIndexInvalid);
3633 REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " " ) == ProductResolverIndexInvalid);
3734 REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" ) == ProductResolverIndexInvalid);
3835
39- edm::ProductResolverIndexHelper::Matches matches = helper.relatedIndexes (PRODUCT_TYPE, typeID_ProductID, " label_A" , " instance_A" );
36+ edm::ProductResolverIndexHelper::Matches matches =
37+ helper.relatedIndexes (PRODUCT_TYPE, typeID_ProductID, " label_A" , " instance_A" );
4038 REQUIRE (matches.numberOfMatches () == 0 );
4139 matches = helper.relatedIndexes (PRODUCT_TYPE, typeID_ProductID);
4240 REQUIRE (matches.numberOfMatches () == 0 );
@@ -51,12 +49,15 @@ TEST_CASE("ProductResolverIndexHelper", "[ProductResolverIndexHelper]") {
5149 TypeID typeIDProductID (typeid (ProductID));
5250 helper.insert (typeIDProductID, " labelA" , " instanceA" , " processA" );
5351
54- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) == ProductResolverIndexInvalid);
55- REQUIRE (helper.index (ELEMENT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) == ProductResolverIndexInvalid);
52+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) ==
53+ ProductResolverIndexInvalid);
54+ REQUIRE (helper.index (ELEMENT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) ==
55+ ProductResolverIndexInvalid);
5656 REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " " ) == ProductResolverIndexInvalid);
5757 REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" ) == ProductResolverIndexInvalid);
5858
59- edm::ProductResolverIndexHelper::Matches matches = helper.relatedIndexes (PRODUCT_TYPE, typeID_ProductID, " label_A" , " instance_A" );
59+ edm::ProductResolverIndexHelper::Matches matches =
60+ helper.relatedIndexes (PRODUCT_TYPE, typeID_ProductID, " label_A" , " instance_A" );
6061 REQUIRE (matches.numberOfMatches () == 0 );
6162 matches = helper.relatedIndexes (PRODUCT_TYPE, typeID_ProductID);
6263 REQUIRE (matches.numberOfMatches () == 0 );
@@ -72,21 +73,30 @@ TEST_CASE("ProductResolverIndexHelper", "[ProductResolverIndexHelper]") {
7273 REQUIRE (indexWithProcess < 2 );
7374 REQUIRE (indexEmptyProcess != indexWithProcess);
7475
75- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" ) == indexEmptyProcess);
76- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " " ) == indexEmptyProcess);
77- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , 0 ) == indexEmptyProcess);
76+ // wit only one entry, all should resolve to the one with process name
77+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" ) == indexWithProcess);
78+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " " ) == indexWithProcess);
79+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , 0 ) == indexWithProcess);
7880 REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) == indexWithProcess);
7981
80- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instance" , " processA" ) == ProductResolverIndexInvalid);
81- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceAX" , " processA" ) == ProductResolverIndexInvalid);
82- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " label" , " instanceA" , " processA" ) == ProductResolverIndexInvalid);
83- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelAX" , " instanceA" , " processA" ) == ProductResolverIndexInvalid);
84- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " process" ) == ProductResolverIndexInvalid);
85- REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processAX" ) == ProductResolverIndexInvalid);
86- REQUIRE (helper.index (PRODUCT_TYPE, typeID_EventID, " labelA" , " instanceA" , " processA" ) == ProductResolverIndexInvalid);
82+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instance" , " processA" ) ==
83+ ProductResolverIndexInvalid);
84+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceAX" , " processA" ) ==
85+ ProductResolverIndexInvalid);
86+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " label" , " instanceA" , " processA" ) ==
87+ ProductResolverIndexInvalid);
88+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelAX" , " instanceA" , " processA" ) ==
89+ ProductResolverIndexInvalid);
90+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " process" ) ==
91+ ProductResolverIndexInvalid);
92+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processAX" ) ==
93+ ProductResolverIndexInvalid);
94+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_EventID, " labelA" , " instanceA" , " processA" ) ==
95+ ProductResolverIndexInvalid);
8796
8897 REQUIRE (helper.index (ELEMENT_TYPE, typeID_ProductID, " labelA" , " instanceA" ) == ProductResolverIndexInvalid);
89- REQUIRE (helper.index (ELEMENT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) == ProductResolverIndexInvalid);
98+ REQUIRE (helper.index (ELEMENT_TYPE, typeID_ProductID, " labelA" , " instanceA" , " processA" ) ==
99+ ProductResolverIndexInvalid);
90100
91101 matches = helper.relatedIndexes (PRODUCT_TYPE, typeID_ProductID);
92102 REQUIRE (matches.numberOfMatches () == 2 );
@@ -125,19 +135,19 @@ TEST_CASE("ProductResolverIndexHelper", "[ProductResolverIndexHelper]") {
125135 TypeID typeIDSetInt (typeid (std::set<int >));
126136 TypeID typeIDVSimpleDerived (typeid (std::vector<edmtest::SimpleDerived>));
127137
128- helper.insert (typeIDVectorInt, " labelC" , " instanceC" , " processC" ); // 0, 1, 2
129- helper.insert (typeIDVectorInt, " label" , " instance" , " process" ); // 3, 4, 5
130- helper.insert (typeIDEventID, " labelB" , " instanceB" , " processB" ); // 6, 7
131- helper.insert (typeIDEventID, " label" , " instanceB" , " processB" ); // 8, 9
132- helper.insert (typeIDEventID, " labelX" , " instanceB" , " processB" ); // 10, 11
133- helper.insert (typeIDEventID, " labelB" , " instance" , " processB" ); // 12, 13
134- helper.insert (typeIDEventID, " labelB" , " instanceX" , " processB" ); // 14, 15
135- helper.insert (typeIDEventID, " labelB" , " instanceB" , " processB1" ); // 16, 5
136- helper.insert (typeIDEventID, " labelB" , " instanceB" , " processB3" ); // 17, 5
137- helper.insert (typeIDEventID, " labelB" , " instanceB" , " processB2" ); // 18, 5
138- helper.insert (typeIDProductID, " label" , " instance" , " process" ); // 19, 20
139- helper.insert (typeIDEventID, " label" , " instance" , " process" ); // 21, 22
140- helper.insert (typeIDProductID, " labelA" , " instanceA" , " processA" ); // 23, 24
138+ helper.insert (typeIDVectorInt, " labelC" , " instanceC" , " processC" ); // 0, 1, 2
139+ helper.insert (typeIDVectorInt, " label" , " instance" , " process" ); // 3, 4, 5
140+ helper.insert (typeIDEventID, " labelB" , " instanceB" , " processB" ); // 6, 7
141+ helper.insert (typeIDEventID, " label" , " instanceB" , " processB" ); // 8, 9
142+ helper.insert (typeIDEventID, " labelX" , " instanceB" , " processB" ); // 10, 11
143+ helper.insert (typeIDEventID, " labelB" , " instance" , " processB" ); // 12, 13
144+ helper.insert (typeIDEventID, " labelB" , " instanceX" , " processB" ); // 14, 15
145+ helper.insert (typeIDEventID, " labelB" , " instanceB" , " processB1" ); // 16, 5
146+ helper.insert (typeIDEventID, " labelB" , " instanceB" , " processB3" ); // 17, 5
147+ helper.insert (typeIDEventID, " labelB" , " instanceB" , " processB2" ); // 18, 5
148+ helper.insert (typeIDProductID, " label" , " instance" , " process" ); // 19, 20
149+ helper.insert (typeIDEventID, " label" , " instance" , " process" ); // 21, 22
150+ helper.insert (typeIDProductID, " labelA" , " instanceA" , " processA" ); // 23, 24
141151 REQUIRE_THROWS_AS (helper.insert (typeIDProductID, " labelA" , " instanceA" , " processA" ), cms::Exception); // duplicate
142152
143153 helper.insert (typeIDSetInt, " labelC" , " instanceC" , " processC" ); // 25, 26
@@ -149,7 +159,7 @@ TEST_CASE("ProductResolverIndexHelper", "[ProductResolverIndexHelper]") {
149159 TypeID typeID_int (typeid (int ));
150160 REQUIRE (helper.index (ELEMENT_TYPE, typeID_int, " labelC" , " instanceC" , " processC" ) == ProductResolverIndexAmbiguous);
151161 REQUIRE (helper.index (ELEMENT_TYPE, typeID_int, " labelC" , " instanceC" , " processQ" ) == ProductResolverIndexInvalid);
152- REQUIRE (helper.index (ELEMENT_TYPE, typeID_int, " labelC" , " instanceC" ) == 2 );
162+ REQUIRE (helper.index (ELEMENT_TYPE, typeID_int, " labelC" , " instanceC" ) == ProductResolverIndexAmbiguous );
153163 edm::ProductResolverIndexHelper::Matches matches = helper.relatedIndexes (ELEMENT_TYPE, typeID_int);
154164 REQUIRE (matches.numberOfMatches () == 4 );
155165 REQUIRE (matches.index (0 ) == 5 );
@@ -159,22 +169,22 @@ TEST_CASE("ProductResolverIndexHelper", "[ProductResolverIndexHelper]") {
159169
160170 TypeID typeID_vint (typeid (std::vector<int >));
161171 REQUIRE (helper.index (PRODUCT_TYPE, typeID_vint, " labelC" , " instanceC" , " processC" ) == 0 );
162- REQUIRE (helper.index (PRODUCT_TYPE, typeID_vint, " labelC" , " instanceC" ) == 1 );
172+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_vint, " labelC" , " instanceC" ) == 0 ); // only one with no process
163173
164174 TypeID typeID_sint (typeid (std::set<int >));
165175 REQUIRE (helper.index (PRODUCT_TYPE, typeID_sint, " labelC" , " instanceC" , " processC" ) == 25 );
166- REQUIRE (helper.index (PRODUCT_TYPE, typeID_sint, " labelC" , " instanceC" ) == 26 );
176+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_sint, " labelC" , " instanceC" ) == 25 ); // only one with no process
167177
168178 TypeID typeID_Simple (typeid (edmtest::Simple));
169- REQUIRE (helper.index (ELEMENT_TYPE, typeID_Simple, " labelC" , " instanceC" ) == 30 );
179+ REQUIRE (helper.index (ELEMENT_TYPE, typeID_Simple, " labelC" , " instanceC" ) == 27 ); // only one with no process
170180 REQUIRE (helper.index (ELEMENT_TYPE, typeID_Simple, " labelC" , " instanceC" , " processC" ) == 27 );
171181
172182 TypeID typeID_SimpleDerived (typeid (edmtest::SimpleDerived));
173- REQUIRE (helper.index (ELEMENT_TYPE, typeID_SimpleDerived, " labelC" , " instanceC" ) == 29 );
183+ REQUIRE (helper.index (ELEMENT_TYPE, typeID_SimpleDerived, " labelC" , " instanceC" ) == 27 ); // only one with no process
174184 REQUIRE (helper.index (ELEMENT_TYPE, typeID_SimpleDerived, " labelC" , " instanceC" , " processC" ) == 27 );
175185
176186 TypeID typeID_VSimpleDerived (typeid (std::vector<edmtest::SimpleDerived>));
177- REQUIRE (helper.index (PRODUCT_TYPE, typeID_VSimpleDerived, " labelC" , " instanceC" ) == 28 );
187+ REQUIRE (helper.index (PRODUCT_TYPE, typeID_VSimpleDerived, " labelC" , " instanceC" ) == 27 ); // only one with no process
178188 REQUIRE (helper.index (PRODUCT_TYPE, typeID_VSimpleDerived, " labelC" , " instanceC" , " processC" ) == 27 );
179189
180190 matches = helper.relatedIndexes (PRODUCT_TYPE, typeID_EventID, " labelB" , " instanceB" );
0 commit comments