2 * Copyright (c) 2020 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 "luci/IR/Nodes/CirclePadV2.h"
19 #include "luci/IR/CircleDialect.h"
20 #include "luci/IR/CircleNodeVisitor.h"
22 #include <gtest/gtest.h>
24 TEST(CirclePadV2Test, constructor_P)
26 luci::CirclePadV2 node;
28 ASSERT_EQ(luci::CircleDialect::get(), node.dialect());
29 ASSERT_EQ(luci::CircleOpcode::PADV2, node.opcode());
31 ASSERT_EQ(nullptr, node.input());
32 ASSERT_EQ(nullptr, node.paddings());
33 ASSERT_EQ(nullptr, node.constant_values());
36 TEST(CirclePadV2Test, input_NEG)
38 luci::CirclePadV2 pad_node;
39 luci::CirclePadV2 node;
41 pad_node.input(&node);
42 pad_node.paddings(&node);
43 pad_node.constant_values(&node);
44 ASSERT_NE(nullptr, pad_node.input());
45 ASSERT_NE(nullptr, pad_node.paddings());
46 ASSERT_NE(nullptr, pad_node.constant_values());
48 pad_node.input(nullptr);
49 pad_node.paddings(nullptr);
50 pad_node.constant_values(nullptr);
51 ASSERT_EQ(nullptr, pad_node.input());
52 ASSERT_EQ(nullptr, pad_node.paddings());
53 ASSERT_EQ(nullptr, pad_node.constant_values());
56 TEST(CirclePadV2Test, arity_NEG)
58 luci::CirclePadV2 pad_node;
60 ASSERT_NO_THROW(pad_node.arg(2));
61 ASSERT_THROW(pad_node.arg(3), std::out_of_range);
64 TEST(CirclePadV2Test, visit_mutable_NEG)
66 struct TestVisitor final : public luci::CircleNodeMutableVisitor<void>
70 luci::CirclePadV2 pad_node;
73 ASSERT_THROW(pad_node.accept(&tv), std::exception);
76 TEST(CirclePadV2Test, visit_NEG)
78 struct TestVisitor final : public luci::CircleNodeVisitor<void>
82 luci::CirclePadV2 pad_node;
85 ASSERT_THROW(pad_node.accept(&tv), std::exception);