[neurun] Use MockNode.h in verifier TC (#2772)
author김수진/동작제어Lab(SR)/Engineer/삼성전자 <sjsujin.kim@samsung.com>
Wed, 19 Sep 2018 06:57:43 +0000 (15:57 +0900)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 19 Sep 2018 06:57:43 +0000 (15:57 +0900)
This commit makes the verifier TC uses `MockNode.h`.

Signed-off-by: sjsujinkim <sjsujin.kim@samsung.com>
runtimes/neurun/test/graph/MockNode.h [moved from runtimes/neurun/test/graph/operation/MockNode.h with 84% similarity]
runtimes/neurun/test/graph/operand/UseDef.cc
runtimes/neurun/test/graph/operation/Insert.cc
runtimes/neurun/test/graph/operation/Set.cc
runtimes/neurun/test/graph/verifier/Verifier.cc

similarity index 84%
rename from runtimes/neurun/test/graph/operation/MockNode.h
rename to runtimes/neurun/test/graph/MockNode.h
index 9456b97..589ccb5 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef __NEURUN_TEST_GRAPH_OPERATION_MOCK_NODE_H__
-#define __NEURUN_TEST_GRAPH_OPERATION_MOCK_NODE_H__
+#ifndef __NEURUN_TEST_GRAPH_MOCK_NODE_H__
+#define __NEURUN_TEST_GRAPH_MOCK_NODE_H__
 
 #include "graph/operation/Node.h"
 #include "graph/operand/IndexSet.h"
@@ -24,8 +24,6 @@ namespace neurun_test
 {
 namespace graph
 {
-namespace operation
-{
 
 class SimpleMockNode : public neurun::graph::operation::Node
 {
@@ -41,8 +39,7 @@ public:
   virtual void accept(neurun::graph::operation::NodeVisitor &&) const override {}
 };
 
-} // namespace operation
 } // namespace graph
 } // namespace neurun_test
 
-#endif // __NEURUN_TEST_GRAPH_OPERATION_MOCK_NODE_H__
+#endif // __NEURUN_TEST_GRAPH_MOCK_NODE_H__
index caaea1f..1a2e6d7 100644 (file)
@@ -19,7 +19,7 @@
 #include "graph/Graph.h"
 #include "graph/verifier/IVerifier.h"
 #include "nnfw/std/memory.h"
-#include "../operation/MockNode.h"
+#include "../MockNode.h"
 
 #include <typeindex>
 
@@ -27,7 +27,7 @@ namespace
 {
 
 using IndexSet = neurun::graph::operand::IndexSet;
-using MockNode = neurun_test::graph::operation::SimpleMockNode;
+using MockNode = neurun_test::graph::SimpleMockNode;
 
 } // namespace anonymous
 
index dab89c2..1b9995f 100644 (file)
 #include "graph/verifier/IVerifier.h"
 #include "nnfw/std/memory.h"
 #include "graph/operand/Index.h"
-#include "MockNode.h"
+#include "../MockNode.h"
 
 #include <typeindex>
 
 using IOIndex = neurun::graph::operand::IO::Index;
 using Index = neurun::graph::operand::Index;
 using IndexSet = neurun::graph::operand::IndexSet;
-using MockNode = neurun_test::graph::operation::SimpleMockNode;
+using MockNode = neurun_test::graph::SimpleMockNode;
 
 TEST(graph_operation_manipulation, operation_insertion)
 {
index df680ff..9fee441 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <gtest/gtest.h>
 
-#include "MockNode.h"
+#include "../MockNode.h"
 #include "graph/operation/Set.h"
 
 using neurun::graph::operation::Set;
@@ -26,8 +26,8 @@ using neurun::graph::operation::Index;
 TEST(graph_operation_Set, operation_test)
 {
   Set set;
-  set.append(std::unique_ptr<Node>(
-      new neurun_test::graph::operation::SimpleMockNode({1, 2, 3, 4}, {5, 6, 7})));
+  set.append(
+      std::unique_ptr<Node>(new neurun_test::graph::SimpleMockNode({1, 2, 3, 4}, {5, 6, 7})));
   Index idx{0u};
   ASSERT_EQ(set.at(idx).getInputs().size(), 4);
   ASSERT_EQ(set.at(idx).getOutputs().size(), 3);
index 68c8e8e..219ac1d 100644 (file)
 #include "graph/verifier/IVerifier.h"
 #include "nnfw/std/memory.h"
 #include "graph/operand/Object.h"
+#include "../MockNode.h"
 
-class MockNode : public neurun::graph::operation::Node
-{
-public:
-  MockNode(const neurun::graph::operand::Index &input, const neurun::graph::operand::Index &output)
-  {
-    setInputs({input});
-    setOutputs({output});
-  }
-
-public:
-  virtual void accept(neurun::graph::operation::NodeVisitor &&) const override {}
-};
+using IndexSet = neurun::graph::operand::IndexSet;
+using MockNode = neurun_test::graph::SimpleMockNode;
 
 TEST(Verifier, dag_checker)
 {
@@ -52,13 +43,13 @@ TEST(Verifier, dag_checker)
   graph.addOutput(operand2);
   graph.operands().at(operand2).setAsOperationOutput();
 
-  graph.addOperation(nnfw::make_unique<MockNode>(operand1, operand2));
+  graph.addOperation(nnfw::make_unique<MockNode>(IndexSet{operand1}, IndexSet{operand2}));
 
   ASSERT_EQ(verifier.verify(graph), true);
 
   // Create cycle
   graph.operands().at(operand1).setAsOperationOutput();
-  graph.addOperation(nnfw::make_unique<MockNode>(operand2, operand1));
+  graph.addOperation(nnfw::make_unique<MockNode>(IndexSet{operand2}, IndexSet{operand1}));
 
   ASSERT_EQ(verifier.verify(graph), false);
 }