From ec2d09a0ea46af3d79ffd5e1949c887920e00cb4 Mon Sep 17 00:00:00 2001 From: Sangjung Woo Date: Thu, 11 Jun 2020 11:12:11 +0900 Subject: [PATCH] [Tests/Filter] Add test case for NNS_custom_easy_unregister() This patch newl adds test cases for NNS_custom_easy_unregister(). Signed-off-by: Sangjung Woo --- tests/nnstreamer_sink/unittest_sink.cc | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/nnstreamer_sink/unittest_sink.cc b/tests/nnstreamer_sink/unittest_sink.cc index 84a99f2..d8dad34 100644 --- a/tests/nnstreamer_sink/unittest_sink.cc +++ b/tests/nnstreamer_sink/unittest_sink.cc @@ -5658,11 +5658,51 @@ TEST (tensor_filter_custom_easy, in_code_func_01) EXPECT_FALSE (g_test_data.test_failed); _free_test_data (); + /** cleanup registered custom_easy filter */ + ret = NNS_custom_easy_unregister("safe_memcpy_10x10"); + ASSERT_EQ(ret, 0); + /** @todo: Check the data at sink */ } /** + * @brief Test unregister custom_easy filter + */ +TEST (tensor_filter_custom_easy, unregister_1_p) +{ + int ret; + const GstTensorsInfo info_in = { + .num_tensors = 1U, + .info = {{ .name = NULL, .type = _NNS_UINT8, .dimension = { 1, 10, 1, 1}}}, + }; + const GstTensorsInfo info_out = { + .num_tensors = 1U, + .info = {{ .name = NULL, .type = _NNS_UINT8, .dimension = { 1, 10, 1, 1}}}, + }; + + ret = NNS_custom_easy_register ("safe_memcpy_10x10", cef_func_safe_memcpy, + NULL, &info_in, &info_out); + ASSERT_EQ(ret, 0); + + /** check unregister custom_easy filter */ + ret = NNS_custom_easy_unregister("safe_memcpy_10x10"); + ASSERT_EQ(ret, 0); +} + +/** + * @brief Test non-registered custom_easy filter + */ +TEST (tensor_filter_custom_easy, unregister_1_n) +{ + int ret; + + /** check non-registered custom_easy filter */ + ret = NNS_custom_easy_unregister("not_registered"); + ASSERT_NE(ret, 0); +} + +/** * @brief Main function for unit test. */ int -- 2.7.4