[neurun] Update use-def init test (#2545)
author오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 3 Sep 2018 02:31:00 +0000 (11:31 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 3 Sep 2018 02:31:00 +0000 (11:31 +0900)
Use SimpleMockNode in header
Remove unused namespace alias

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
runtimes/neurun/test/graph/operand/UseDef.cc

index e89eeb6..b80fd62 100644 (file)
@@ -3,43 +3,15 @@
 #include "graph/Graph.h"
 #include "graph/verifier/IVerifier.h"
 #include "nnfw/std/memory.h"
-#include "graph/operand/Index.h"
-#include "graph/operation/Index.h"
+#include "../operation/MockNode.h"
 
 #include <typeindex>
 
-using IOIndex = neurun::graph::operand::IO::Index;
-using Index = neurun::graph::operand::Index;
-using IndexSet = neurun::graph::operand::IndexSet;
-
 namespace
 {
 
-class MockNode : public neurun::graph::operation::Node
-{
-public:
-  MockNode(Index input, Index output)
-  {
-    setInputs({input});
-    setOutputs({output});
-  }
-
-public:
-  virtual void accept(neurun::graph::operation::NodeVisitor &&) const override {}
-};
-
-class MultiInputMockNode : public neurun::graph::operation::Node
-{
-public:
-  MultiInputMockNode(IndexSet inputs, Index output)
-  {
-    setInputs(inputs);
-    setOutputs({output});
-  }
-
-public:
-  virtual void accept(neurun::graph::operation::NodeVisitor &&) const override {}
-};
+using IndexSet = neurun::graph::operand::IndexSet;
+using MockNode = neurun_test::graph::operation::SimpleMockNode;
 
 } // namespace anonymous
 
@@ -62,18 +34,18 @@ TEST(graph_operand_usedef, usedef_test)
 
   // MockNode1
   auto operand_index1 = graph.addOperand(shape, type);
-  auto mocknode_index1 =
-      graph.addOperation(nnfw::make_unique<MockNode>(input_operand, operand_index1));
+  auto mocknode_index1 = graph.addOperation(
+      nnfw::make_unique<MockNode>(IndexSet{input_operand}, IndexSet{operand_index1}));
   graph.operands().at(operand_index1).setAsOperationOutput();
 
   // MockNode2
   auto operand_index2 = graph.addOperand(shape, type);
-  auto mocknode_index2 =
-      graph.addOperation(nnfw::make_unique<MockNode>(input_operand, operand_index2));
+  auto mocknode_index2 = graph.addOperation(
+      nnfw::make_unique<MockNode>(IndexSet{input_operand}, IndexSet{operand_index2}));
   graph.operands().at(operand_index2).setAsOperationOutput();
-  // MultiInputMockNode
-  auto multiinput_index = graph.addOperation(nnfw::make_unique<MultiInputMockNode>(
-      IndexSet{operand_index1, operand_index2}, output_operand));
+  // MockNode3(two input)
+  auto multiinput_index = graph.addOperation(nnfw::make_unique<MockNode>(
+      IndexSet{operand_index1, operand_index2}, IndexSet{output_operand}));
   graph.operands().at(output_operand).setAsOperationOutput();
 
   ASSERT_EQ(verifier.verify(graph), true);