forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node_test.cpp
49 lines (37 loc) · 1.38 KB
/
node_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "openvino/core/node.hpp"
#include <gtest/gtest.h>
#include "common_test_utils/test_assertions.hpp"
using namespace testing;
class TestNode : public ov::Node {
public:
TestNode() : Node() {}
static const type_info_t& get_type_info_static() {
static const type_info_t info{"TestNode", ""};
info.hash();
return info;
}
const type_info_t& get_type_info() const override {
return get_type_info_static();
}
std::shared_ptr<Node> clone_with_new_inputs(const ov::OutputVector&) const override {
return std::make_shared<TestNode>();
}
};
class NodeValidationFailureTest : public Test {
protected:
TestNode test_node;
};
TEST_F(NodeValidationFailureTest, node_failure_message) {
OV_EXPECT_THROW(NODE_VALIDATION_CHECK(&test_node, false, "Test message"),
ov::NodeValidationFailure,
HasSubstr("':\nTest message"));
}
TEST_F(NodeValidationFailureTest, node_shape_infer_failure_message) {
const auto input_shapes = std::vector<ov::PartialShape>{{1, 2, 3}, {1}};
OV_EXPECT_THROW(NODE_SHAPE_INFER_CHECK(&test_node, input_shapes, false, "Test message"),
ov::NodeValidationFailure,
HasSubstr("':\nShape inference input shapes {[1,2,3],[1]}\nTest message"));
}