From fffb49a6fdfced2873e5186cdd7f2f620ccb62e0 Mon Sep 17 00:00:00 2001 From: Jaeyun Date: Tue, 16 Jun 2020 16:35:35 +0900 Subject: [PATCH] [Test/C-Api] add testcase of internal functions add simple testcases to handle the case of invalid param. Signed-off-by: Jaeyun --- tests/tizen_capi/unittest_tizen_capi.cc | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/tizen_capi/unittest_tizen_capi.cc b/tests/tizen_capi/unittest_tizen_capi.cc index 6b8e1f3..fe25ccf 100644 --- a/tests/tizen_capi/unittest_tizen_capi.cc +++ b/tests/tizen_capi/unittest_tizen_capi.cc @@ -1280,6 +1280,36 @@ TEST (nnstreamer_capi_switch, failure_01_n) } /** + * @brief Test NNStreamer Utility for checking plugin availability (invalid param) + */ +TEST (nnstreamer_capi_util, plugin_availability_fail_invalid_n) +{ + int status; + + status = ml_check_plugin_availability ("nnstreamer", NULL); + EXPECT_NE (status, ML_ERROR_NONE); + + status = ml_check_plugin_availability (NULL, "tensor_filter"); + EXPECT_NE (status, ML_ERROR_NONE); +} + +/** + * @brief Test NNStreamer Utility for checking nnfw availability (invalid param) + */ +TEST (nnstreamer_capi_util, nnfw_availability_fail_invalid_n) +{ + bool result; + int status; + + status = ml_check_nnfw_availability (ML_NNFW_TYPE_TENSORFLOW_LITE, ML_NNFW_HW_ANY, NULL); + EXPECT_NE (status, ML_ERROR_NONE); + + /* any is unknown nnfw type */ + status = ml_check_nnfw_availability (ML_NNFW_TYPE_ANY, ML_NNFW_HW_ANY, &result); + EXPECT_NE (status, ML_ERROR_NONE); +} + +/** * @brief Test NNStreamer Utility for checking availability of NNFW */ TEST (nnstreamer_capi_util, availability_00) @@ -2084,6 +2114,17 @@ TEST (nnstreamer_capi_util, data_create_n) ASSERT_EQ (status, ML_ERROR_NONE); } +/** + * @brief Test utility functions (internal) + */ +TEST (nnstreamer_capi_util, data_create_internal_n) +{ + int status; + + status = ml_tensors_data_create_no_alloc (NULL, NULL); + EXPECT_NE (status, ML_ERROR_NONE); +} + /* * @brief Test utility functions (public) */ -- 2.7.4