From e866ba7b763a2b58ee731b569b1a06b3ccfd228d Mon Sep 17 00:00:00 2001 From: DD Date: Tue, 1 Jun 2021 10:30:38 +0800 Subject: [PATCH] add invalid input type test case --- ngraph/test/type_prop/softplus.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ngraph/test/type_prop/softplus.cpp b/ngraph/test/type_prop/softplus.cpp index 7d6ddb49144..d0cec9fdd27 100644 --- a/ngraph/test/type_prop/softplus.cpp +++ b/ngraph/test/type_prop/softplus.cpp @@ -40,3 +40,23 @@ TEST(type_prop, softplus_partial_static_rank) (PartialShape{1, Dimension::dynamic(), 6}))); ASSERT_TRUE(softplus_func->get_output_partial_shape(0).rank().is_static()); } + +TEST(type_prop, softplus_invalid_element_type) +{ + auto data = make_shared(element::i32, Shape{2, 2}); + + try + { + auto softplus = make_shared(data); + // Input element type is boolean + FAIL() << "Invalid int element type for input not detected"; + } + catch (const NodeValidationFailure& error) + { + EXPECT_HAS_SUBSTRING(error.what(), "Input element type must be float"); + } + catch (...) + { + FAIL() << "Numeric element type node validation check failed for unexpected reason"; + } +}