From 5b80ac2b90397d53efe543c2f3581c8c109720c2 Mon Sep 17 00:00:00 2001 From: Parichay Kapoor Date: Tue, 11 Feb 2020 19:21:36 +0900 Subject: [PATCH] [nnfw/hw] Unit-test for nnfw accelerators Added unit-tests for nnfw supported accelerators with single API Signed-off-by: Parichay Kapoor --- tests/tizen_capi/unittest_tizen_capi.cc | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/tizen_capi/unittest_tizen_capi.cc b/tests/tizen_capi/unittest_tizen_capi.cc index 5b48fdd..eecedc1 100644 --- a/tests/tizen_capi/unittest_tizen_capi.cc +++ b/tests/tizen_capi/unittest_tizen_capi.cc @@ -1415,6 +1415,54 @@ TEST (nnstreamer_capi_util, availability_fail_03_n) EXPECT_EQ (result, false); } +#ifdef ENABLE_NNFW_RUNTIME +/** + * @brief Test NNStreamer Utility for checking availability of custom backend + */ +TEST (nnstreamer_capi_util, availability_04) +{ + bool result; + int status; + + status = ml_check_nnfw_availability (ML_NNFW_TYPE_NNFW, ML_NNFW_HW_ANY, &result); + EXPECT_EQ (status, ML_ERROR_NONE); + EXPECT_EQ (result, true); + + status = ml_check_nnfw_availability (ML_NNFW_TYPE_NNFW, ML_NNFW_HW_AUTO, &result); + EXPECT_EQ (status, ML_ERROR_NONE); + EXPECT_EQ (result, true); + + status = ml_check_nnfw_availability (ML_NNFW_TYPE_NNFW, ML_NNFW_HW_CPU, &result); + EXPECT_EQ (status, ML_ERROR_NONE); + EXPECT_EQ (result, true); + + status = ml_check_nnfw_availability (ML_NNFW_TYPE_NNFW, ML_NNFW_HW_GPU, &result); + EXPECT_EQ (status, ML_ERROR_NONE); + EXPECT_EQ (result, true); + + status = ml_check_nnfw_availability (ML_NNFW_TYPE_NNFW, ML_NNFW_HW_NPU, &result); + EXPECT_EQ (status, ML_ERROR_NONE); + EXPECT_EQ (result, true); +} + +/** + * @brief Test NNStreamer Utility for checking availability of custom backend + */ +TEST (nnstreamer_capi_util, availability_fail_04_n) +{ + bool result; + int status; + + status = ml_check_nnfw_availability (ML_NNFW_TYPE_NNFW, ML_NNFW_HW_NPU_SR, &result); + EXPECT_EQ (status, ML_ERROR_NONE); + EXPECT_EQ (result, false); + + status = ml_check_nnfw_availability (ML_NNFW_TYPE_NNFW, ML_NNFW_HW_NPU_MOVIDIUS, &result); + EXPECT_EQ (status, ML_ERROR_NONE); + EXPECT_EQ (result, false); +} +#endif /** ENABLE_NNFW_RUNTIME */ + /** * @brief Test NNStreamer Utility for checking tensors info handle */ -- 2.7.4