From: 오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Mon, 3 Sep 2018 02:31:00 +0000 (+0900) Subject: [neurun] Update use-def init test (#2545) X-Git-Tag: 0.2~119 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53135c3ec604e72f8eebd431b8f8745d2ece1466;p=platform%2Fcore%2Fml%2Fnnfw.git [neurun] Update use-def init test (#2545) Use SimpleMockNode in header Remove unused namespace alias Signed-off-by: Hyeongseok Oh --- 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);