@@ -82,6 +82,7 @@ TEST_F(IterableGraphTest, NoInternalConnections)
8282 auto i = dynamic_cast <NumberNode *>(root->createNode (" Number" , " i" ));
8383 auto a = dynamic_cast <AddNode *>(loop->createNode (" Add" , " a" ));
8484 auto b = dynamic_cast <AddNode *>(loop->createNode (" Add" , " b" ));
85+ auto c = dynamic_cast <AddNode *>(loop->createNode (" Add" , " c" ));
8586 ASSERT_TRUE (loop->setOption <Number>(" N" , 1 ));
8687 EXPECT_TRUE (root->addEdge ({" i" , " X" , " Iterator" , " I" }));
8788
@@ -93,11 +94,12 @@ TEST_F(IterableGraphTest, NoInternalConnections)
9394 i->setOption <Number>(" X" , 1 );
9495 a->setInput <Number>(" Y" , 1 );
9596 b->setInput <Number>(" Y" , 1 );
97+ c->setInput <Number>(" Y" , 1 );
9698 EXPECT_TRUE (loop->addEdge ({" Inputs" , " I" , " a" , " X" }));
9799 EXPECT_EQ (loop->run (), NodeConstants::ProcessResult::Success);
98100 auto res1 = a->getOutputValue <Number>(" Result" ).asInteger ();
99101 EXPECT_TRUE (a->versionIndex () == 0 );
100- ASSERT_EQ (res1, 2 ); // Should be 2
102+ ASSERT_EQ (res1, 2 );
101103
102104 /*
103105 * i, 1 -> itA, 1 + 1 = 2 -> itB, 1 + 2 = 3
@@ -109,6 +111,25 @@ TEST_F(IterableGraphTest, NoInternalConnections)
109111 EXPECT_TRUE (a->versionIndex () == 1 );
110112 EXPECT_TRUE (b->versionIndex () == 0 );
111113 ASSERT_EQ (res2, 3 );
114+
115+ /*
116+ * i, 1 -> itA, 1 + 1 = 2 -> itB, 1 + 2 = 3 -> itC, 3 + 1 = 4
117+ */
118+ EXPECT_TRUE (loop->addEdge ({" b" , " Result" , " c" , " X" }));
119+ ASSERT_TRUE (loop->setOption <Number>(" N" , 1 ));
120+ EXPECT_EQ (loop->run (), NodeConstants::ProcessResult::Success);
121+ auto res3 = c->getOutputValue <Number>(" Result" ).asInteger ();
122+ EXPECT_TRUE (a->versionIndex () == 2 );
123+ EXPECT_TRUE (b->versionIndex () == 1 );
124+ EXPECT_TRUE (c->versionIndex () == 0 );
125+ ASSERT_EQ (res3, 4 );
126+
127+ // Run 100 times
128+ ASSERT_TRUE (loop->setOption <Number>(" N" , 100 ));
129+ EXPECT_EQ (loop->run (), NodeConstants::ProcessResult::Success);
130+ ASSERT_EQ (a->getOutputValue <Number>(" Result" ).asInteger (), 2 );
131+ ASSERT_EQ (b->getOutputValue <Number>(" Result" ).asInteger (), 3 );
132+ ASSERT_EQ (c->getOutputValue <Number>(" Result" ).asInteger (), 4 );
112133}
113134
114135TEST_F (IterableGraphTest, NoRun)
0 commit comments