Generalize connectStageInsideFallbacks

Let's consider the following simple situation, where generators produce solutions in the given order.

GEN           1 3
Fallbacks     |X
GEN           2 4

When passing state 4 to the Fallbacks' connector, it forms pending pairs with both 1 and 3.
Thus, the container needs to check whether 1-4 or 3-4 was processed when receiving a success or failure,
to correctly forward the failed one to the next child.
This commit is contained in:
Robert Haschke 2021-11-26 09:12:39 +01:00
parent 4be448641f
commit b2056745a8

View File

@ -161,16 +161,16 @@ TEST_F(FallbacksFixturePropagate, activeChildReset) {
using FallbacksFixtureConnect = TaskTestBase;
TEST_F(FallbacksFixtureConnect, DISABLED_connectStageInsideFallbacks) {
TEST_F(FallbacksFixtureConnect, connectStageInsideFallbacks) {
t.add(std::make_unique<GeneratorMockup>(PredefinedCosts({ 1.0, 2.0 })));
auto fallbacks = std::make_unique<Fallbacks>("Fallbacks");
fallbacks->add(std::make_unique<ConnectMockup>(PredefinedCosts::constant(0.0)));
fallbacks->add(std::make_unique<ConnectMockup>(PredefinedCosts({ 0.0, 0.0, INF, 0.0 })));
fallbacks->add(std::make_unique<ConnectMockup>(PredefinedCosts::constant(100.0)));
t.add(std::move(fallbacks));
t.add(std::make_unique<GeneratorMockup>(PredefinedCosts({ 10.0, 20.0 })));
EXPECT_TRUE(t.plan());
EXPECT_COSTS(t.solutions(), testing::ElementsAre(11, 12, 21, 22));
EXPECT_COSTS(t.solutions(), testing::ElementsAre(11, 12, 22, 121));
}