2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <gtest/gtest.h>
19 #include "model/Operands.h"
21 TEST(graph_operand_Set, set_test)
23 neurun::model::Operands set;
25 ::neurun::model::Shape shape0{1, 2, 3};
27 ::neurun::model::Shape shape1(4);
33 ::neurun::model::TypeInfo type{neurun::model::DataType::INT32};
35 set.emplace(shape0, type);
36 set.emplace(shape1, type);
38 ASSERT_EQ(set.exist(neurun::model::OperandIndex{0u}), true);
39 ASSERT_EQ(set.exist(neurun::model::OperandIndex{1u}), true);
40 ASSERT_EQ(set.exist(neurun::model::OperandIndex{2u}), false);
42 ASSERT_EQ(set.at(neurun::model::OperandIndex{0u}).shape().dim(0), 1);
43 ASSERT_EQ(set.at(neurun::model::OperandIndex{0u}).shape().dim(1), 2);
44 ASSERT_EQ(set.at(neurun::model::OperandIndex{0u}).shape().dim(2), 3);