From 53135c3ec604e72f8eebd431b8f8745d2ece1466 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Mon, 3 Sep 2018 11:31:00 +0900 Subject: [PATCH] [neurun] Update use-def init test (#2545) Use SimpleMockNode in header Remove unused namespace alias Signed-off-by: Hyeongseok Oh --- runtimes/neurun/test/graph/operand/UseDef.cc | 48 ++++++---------------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/runtimes/neurun/test/graph/operand/UseDef.cc b/runtimes/neurun/test/graph/operand/UseDef.cc index e89eeb6..b80fd62 100644 --- a/runtimes/neurun/test/graph/operand/UseDef.cc +++ b/runtimes/neurun/test/graph/operand/UseDef.cc @@ -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 -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(input_operand, operand_index1)); + auto mocknode_index1 = graph.addOperation( + nnfw::make_unique(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(input_operand, operand_index2)); + auto mocknode_index2 = graph.addOperation( + nnfw::make_unique(IndexSet{input_operand}, IndexSet{operand_index2})); graph.operands().at(operand_index2).setAsOperationOutput(); - // MultiInputMockNode - auto multiinput_index = graph.addOperation(nnfw::make_unique( - IndexSet{operand_index1, operand_index2}, output_operand)); + // MockNode3(two input) + auto multiinput_index = graph.addOperation(nnfw::make_unique( + IndexSet{operand_index1, operand_index2}, IndexSet{output_operand})); graph.operands().at(output_operand).setAsOperationOutput(); ASSERT_EQ(verifier.verify(graph), true); -- 2.7.4