68 using Edges = std::vector<std::pair<int, int>>;
77 std::vector<TopoIndexInfo> expected0 = {{0, 0}};
78 REQUIRE(result0 == expected0);
90 std::vector<TopoIndexInfo> expected1 = {{0, 0}, {1, 1}, {2, 2}, {3, 3}};
91 REQUIRE(result1 == expected1);
102 std::vector<TopoIndexInfo> expected2 = {{3, 0}, {2, 1}, {1, 2}, {0, 1}};
103 REQUIRE(result2 == expected2);
122 std::vector<TopoIndexInfo> expected3 = {{4, 0}, {3, 1}, {1, 2}, {2, 2}, {0, 3}, {5, 4}};
123 REQUIRE(result3 == expected3);
141 std::vector<TopoIndexInfo> expected4 = {{0, 0}, {2, 0}, {1, 1}, {3, 1}, {4, 2}, {5, 3}};
142 REQUIRE(result4 == expected4);
156 std::vector<TopoIndexInfo> expected5 = {{0, 0}, {2, 0}, {1, 1}, {3, 1}, {4, 2}};
157 REQUIRE(result5 == expected5);
170 std::vector<TopoIndexInfo> expected6 = {};
171 REQUIRE(result6 == expected6);
185 std::vector<SlotEdge> edges7 = {
192 &(edges7[0].nodeOut),
195 std::vector<TopoIndexInfo> expected7 = {{0, 0}, {1, 1}, {2, 1}};
196 REQUIRE(result7 == expected7);
204 std::vector<InputSpec> expectedInputs = {
InputSpec{
"y",
"TST",
"A"}};
205 std::vector<OutputSpec> expectedOutputs = {
208 OutputSpec{
"DPL",
"ENUM", 0, Lifetime::Enumeration}};
213 {
"B", {expectedInputs[0]}}};
214 std::vector<DeviceConnectionEdge> logicalEdges;
215 std::vector<OutputSpec> outputs;
216 std::vector<LogicalForwardInfo> availableForwardsInfo;
219 REQUIRE(
result == WorkflowParsingState::Valid);
224 std::vector<std::string> expectedNames = {
"A",
"B",
"internal-dpl-clock",
"internal-dpl-injected-dummy-sink"};
225 REQUIRE(workflow.size() == expectedNames.size());
226 for (
size_t wi = 0, we = workflow.size(); wi != we; ++wi) {
229 REQUIRE(workflow[wi].
name == expectedNames[wi]);
234 availableForwardsInfo);
235 std::vector<DeviceConnectionEdge> expectedEdges{
236 {2, 0, 0, 0, 2, 0,
false, ConnectionKind::Out},
237 {0, 1, 0, 0, 0, 0,
false, ConnectionKind::Out},
238 {1, 3, 0, 1, 1, 0,
false, ConnectionKind::Out},
240 REQUIRE(expectedOutputs.size() == outputs.size());
241 for (
size_t oi = 0, oe = expectedOutputs.size(); oi != oe; ++oi) {
242 INFO(
"With parameter oi = " << oi);
243 REQUIRE(expectedOutputs[oi].lifetime == outputs[oi].lifetime);
245 REQUIRE(expectedEdges.size() == logicalEdges.size());
246 for (
size_t ei = 0, ee = expectedEdges.size(); ei != ee; ++ei) {
249 REQUIRE(expectedEdges[ei].consumer == logicalEdges[ei].consumer);
250 REQUIRE(expectedEdges[ei].producer == logicalEdges[ei].producer);
251 REQUIRE(expectedEdges[ei].outputGlobalIndex == logicalEdges[ei].outputGlobalIndex);
264 std::vector<InputSpec> expectedInputs = {
InputSpec{
"y",
"TST",
"A"}};
265 std::vector<OutputSpec> expectedOutputs = {
270 OutputSpec{
"DPL",
"TIMER", 0, Lifetime::Timer}};
272 {
"A", {},
Outputs{expectedOutputs[0]}},
273 {
"B", {expectedInputs[0]}},
274 {
"C", {expectedInputs[0]}},
275 {
"D", {expectedInputs[0]}}};
276 std::vector<DeviceConnectionEdge> logicalEdges;
277 std::vector<OutputSpec> outputs;
278 std::vector<LogicalForwardInfo> availableForwardsInfo;
284 availableForwardsInfo);
286 std::vector<DeviceConnectionEdge> expectedEdges{
287 {4, 0, 0, 0, 4, 0,
false, ConnectionKind::Out},
288 {0, 1, 0, 0, 0, 0,
false, ConnectionKind::Out},
289 {1, 2, 0, 0, 0, 0,
true, ConnectionKind::Out},
290 {2, 3, 0, 0, 0, 0,
true, ConnectionKind::Out},
292 {1, 5, 0, 0, 1, 0,
true, ConnectionKind::Out},
293 {2, 5, 0, 0, 2, 1,
true, ConnectionKind::Out},
294 {3, 5, 0, 0, 3, 2,
true, ConnectionKind::Out},
296 REQUIRE(expectedOutputs.size() == outputs.size());
297 REQUIRE(expectedEdges.size() == logicalEdges.size());
298 for (
size_t ei = 0, ee = expectedEdges.size(); ei != ee; ++ei) {
301 REQUIRE(expectedEdges[ei].consumer == logicalEdges[ei].consumer);
302 REQUIRE(expectedEdges[ei].producer == logicalEdges[ei].producer);
303 REQUIRE(expectedEdges[ei].outputGlobalIndex == logicalEdges[ei].outputGlobalIndex);
304 REQUIRE(expectedEdges[ei].consumerInputIndex == logicalEdges[ei].consumerInputIndex);
324 std::vector<DeviceConnectionEdge>
expected{
325 {3, 0, 0, 0, 3, 0,
false, ConnectionKind::Out},
326 {0, 1, 0, 0, 0, 0,
false, ConnectionKind::Out},
327 {0, 1, 1, 0, 0, 0,
false, ConnectionKind::Out},
328 {0, 1, 2, 0, 0, 0,
false, ConnectionKind::Out},
329 {1, 2, 0, 0, 1, 0,
false, ConnectionKind::Out},
330 {1, 2, 0, 1, 1, 0,
false, ConnectionKind::Out},
331 {1, 2, 0, 2, 1, 0,
false, ConnectionKind::Out},
332 {1, 2, 1, 0, 1, 0,
false, ConnectionKind::Out},
333 {1, 2, 1, 1, 1, 0,
false, ConnectionKind::Out},
334 {1, 2, 1, 2, 1, 0,
false, ConnectionKind::Out},
336 {2, 4, 0, 0, 2, 0,
false, ConnectionKind::Out},
337 {2, 4, 0, 1, 2, 0,
false, ConnectionKind::Out},
339 std::list<LogicalOutputInfo> availableOutputsInfo;
340 std::vector<DeviceConnectionEdge> logicalEdges;
341 std::vector<LogicalForwardInfo> availableForwardsInfo;
345 std::vector<OutputSpec> outputs;
352 availableForwardsInfo);
353 std::vector<ConcreteDataMatcher> expectedMatchers = {
360 std::vector<Lifetime> expectedLifetimes = {
364 Lifetime::Enumeration,
367 REQUIRE(expectedMatchers.size() == expectedLifetimes.size());
368 REQUIRE(outputs.size() == expectedMatchers.size());
372 for (
size_t i = 0;
i < outputs.size(); ++
i) {
376 REQUIRE(concrete.origin.as<std::string>() == expectedMatchers[
i].origin.as<std::string>());
377 REQUIRE(concrete.description.as<std::string>() == expectedMatchers[
i].description.as<std::string>());
378 REQUIRE(concrete.subSpec == expectedMatchers[
i].subSpec);
379 REQUIRE(outputs[
i].lifetime == expectedLifetimes[
i]);
383 REQUIRE(
expected.size() == logicalEdges.size());
384 for (
size_t i = 0;
i < logicalEdges.size(); ++
i) {
387 REQUIRE(logicalEdges[
i].producer ==
expected[
i].producer);
388 REQUIRE(logicalEdges[
i].consumer ==
expected[
i].consumer);
389 REQUIRE(logicalEdges[
i].timeIndex ==
expected[
i].timeIndex);
390 REQUIRE(logicalEdges[
i].producerTimeIndex ==
expected[
i].producerTimeIndex);
391 REQUIRE(logicalEdges[
i].outputGlobalIndex ==
expected[
i].outputGlobalIndex);
395 std::vector<size_t> inIndex;
396 std::vector<size_t> outIndex;
400 std::vector<size_t> expectedOutIndex{
401 1, 2, 3, 4, 7, 5, 8, 6, 9, 10, 11, 0};
403 std::vector<size_t> expectedInIndex{
404 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
406 REQUIRE_THAT(expectedOutIndex, Catch::Matchers::RangeEquals(outIndex));
407 REQUIRE_THAT(expectedInIndex, Catch::Matchers::RangeEquals(inIndex));
412 std::vector<EdgeAction> expectedActionsOut{
427 REQUIRE(expectedActionsOut.size() == actions.size());
428 for (
size_t i = 0;
i < outIndex.size();
i++) {
429 size_t j = outIndex[
i];
432 REQUIRE(expectedActionsOut[
j].requiresNewDevice == actions[
j].requiresNewDevice);
436 std::vector<EdgeAction> expectedActionsIn{
453 REQUIRE(expectedActionsIn.size() == inActions.size());
454 for (
size_t i = 0;
i < inIndex.size();
i++) {
455 size_t j = inIndex[
i];
456 auto expectedValue = expectedActionsIn[
j].requiresNewDevice;
457 auto actualValue = inActions[
j].requiresNewDevice;
461 REQUIRE(expectedValue == actualValue);
500 {.name =
"A", .outputs = {
OutputSpec{
"TST",
"A"}}},
501 {.name =
"B", .inputs = {
InputSpec{
"a",
"TST",
"A"}}}};
508 {.name =
"A", .outputs = {
OutputSpec{
"TST",
"A"}}},
509 {.name =
"B", .inputs = {
InputSpec{
"a",
"TST",
"B"}}}};
513 {.name =
"B", .inputs = {
InputSpec{
"a",
"TST",
"A"}}}};
517 {.name =
"B", .inputs = {
InputSpec{
"a",
"TST",
"A"}}}};
520 std::vector<InputSpec> expected0{};
521 REQUIRE_THAT(dangling0, Catch::Matchers::RangeEquals(expected0));
524 std::vector<InputSpec> expected1{
InputSpec{
"dangling0",
"TST",
"A"}};
525 REQUIRE_THAT(dangling1, Catch::Matchers::RangeEquals(expected1));
528 std::vector<InputSpec> expected2{
InputSpec{
"dangling0",
"TST",
"A"}};
529 REQUIRE_THAT(dangling2, Catch::Matchers::RangeEquals(expected2));
532 std::vector<InputSpec> expected3{
InputSpec{
"dangling0",
"TST",
"B"}};
533 REQUIRE_THAT(dangling3, Catch::Matchers::RangeEquals(expected3));
536 std::vector<InputSpec> expected4{
InputSpec{
"dangling0",
"TST",
"B"},
InputSpec{
"dangling1",
"TST",
"C"}};
537 REQUIRE_THAT(dangling4, Catch::Matchers::RangeEquals(expected4));
557 std::vector<OutputSpec> expectedOutputs = {
560 OutputSpec{
"DPL",
"TIMER", 0, Lifetime::Timer},
563 {
"A", {}, {expectedOutputs[0], expectedOutputs[1]}},
564 {
"B", expectedInputs, {}},
566 std::vector<DeviceConnectionEdge> logicalEdges;
567 std::vector<OutputSpec> outputs;
568 std::vector<LogicalForwardInfo> availableForwardsInfo;
573 REQUIRE(workflow.size() == 4);
574 REQUIRE(workflow.size() >= 4);
575 REQUIRE(workflow[0].
name ==
"A");
576 REQUIRE(workflow[1].
name ==
"B");
577 REQUIRE(workflow[2].
name ==
"internal-dpl-clock");
578 REQUIRE(workflow[3].
name ==
"internal-dpl-injected-dummy-sink");
579 for (
size_t wi = 4; wi < workflow.size(); ++wi) {
580 REQUIRE(workflow[wi].
name ==
"");
584 availableForwardsInfo);
586 std::vector<DeviceConnectionEdge> expectedEdges{
587 {2, 0, 0, 0, 3, 0,
false, ConnectionKind::Out},
588 {0, 1, 0, 0, 0, 0,
false, ConnectionKind::Out},
589 {0, 1, 0, 0, 1, 0,
false, ConnectionKind::Out},
590 {1, 3, 0, 0, 2, 0,
false, ConnectionKind::Out},
593 std::vector<size_t> expectedOutEdgeIndex = {1, 2, 3, 0};
594 std::vector<size_t> expectedInEdgeIndex = {0, 1, 2, 3};
595 std::vector<EdgeAction> expectedActions = {
603 std::vector<EdgeAction> expectedInActions = {
610 REQUIRE(expectedOutputs.size() == outputs.size());
611 REQUIRE(expectedEdges.size() == logicalEdges.size());
612 for (
size_t ei = 0, ee = expectedEdges.size(); ei != ee; ++ei) {
615 REQUIRE(expectedEdges[ei].consumer == logicalEdges[ei].consumer);
616 REQUIRE(expectedEdges[ei].producer == logicalEdges[ei].producer);
617 REQUIRE(expectedEdges[ei].outputGlobalIndex == logicalEdges[ei].outputGlobalIndex);
618 REQUIRE(expectedEdges[ei].consumerInputIndex == logicalEdges[ei].consumerInputIndex);
622 std::vector<size_t> inEdgeIndex;
623 std::vector<size_t> outEdgeIndex;
625 REQUIRE_THAT(outEdgeIndex, Catch::Matchers::RangeEquals(expectedOutEdgeIndex));
626 REQUIRE_THAT(inEdgeIndex, Catch::Matchers::RangeEquals(expectedInEdgeIndex));
627 REQUIRE(inEdgeIndex.size() == 4);
630 REQUIRE(outActions.size() == expectedActions.size());
631 for (
size_t ai = 0; ai < outActions.size(); ++ai) {
634 REQUIRE(outActions[ai].requiresNewDevice == expectedActions[ai].requiresNewDevice);
635 REQUIRE(outActions[ai].requiresNewChannel == expectedActions[ai].requiresNewChannel);
642 REQUIRE(inActions.size() == expectedInActions.size());
643 for (
size_t ai = 0; ai < inActions.size(); ++ai) {
646 REQUIRE(inActions[ai].requiresNewDevice == expectedInActions[ai].requiresNewDevice);
647 REQUIRE(inActions[ai].requiresNewChannel == expectedInActions[ai].requiresNewChannel);