File tree Expand file tree Collapse file tree
Framework/Foundation/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -164,3 +164,32 @@ TEST_CASE("TestStructToTuple")
164164 REQUIRE (t6.size () == 3 );
165165 REQUIRE (t6[0 ] == true );
166166}
167+
168+ // / Empty base class, mirroring o2::framework::ConfigurableGroup: structs
169+ // / deriving from it must decompose to their own members only, and the empty
170+ // / base must not be counted or bound. Exercised with B=true, as the option
171+ // / group handling in AnalysisManagers.h does.
172+ struct EmptyBase {
173+ };
174+
175+ struct DerivedGroup : EmptyBase {
176+ int a = 3 ;
177+ int b = 30 ;
178+ int c = 300 ;
179+ };
180+
181+ TEST_CASE (" EmptyBaseDestructuring" )
182+ {
183+ DerivedGroup g;
184+ auto t = o2::framework::homogeneous_apply_refs<true >([](auto i) -> bool { return i > 20 ; }, g);
185+ REQUIRE (t.size () == 3 );
186+ REQUIRE (t[0 ] == false );
187+ REQUIRE (t[1 ] == true );
188+ REQUIRE (t[2 ] == true );
189+
190+ // The binding must reach the derived members, not the base.
191+ o2::framework::homogeneous_apply_refs<true >([](auto & i) { i += 1 ; return true ; }, g);
192+ REQUIRE (g.a == 4 );
193+ REQUIRE (g.b == 31 );
194+ REQUIRE (g.c == 301 );
195+ }
You can’t perform that action at this time.
0 commit comments