#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
// 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);