test: Add new test cases for a new BindBackend function 54/233254/4
authorInki Dae <inki.dae@samsung.com>
Wed, 13 May 2020 08:09:10 +0000 (17:09 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 13 May 2020 09:09:49 +0000 (18:09 +0900)
Change-Id: I9829475e6fe9bbe3794d7e01a1c523fbaa0e6c34
Signed-off-by: Inki Dae <inki.dae@samsung.com>
test/src/inference_engine_tc.cpp

index 0110fef980986da3df717507b08dfdb0c9ca4ab1..4f0b5cae0672466c26b99ca4bf8e20150f655f7e 100644 (file)
@@ -33,6 +33,7 @@ typedef std::tuple<std::string, int> ParamType_Two;
 typedef std::tuple<std::string, int, std::vector<std::string>> ParamType_Three;
 typedef std::tuple<std::string, int, int, int, int, std::vector<std::string>> ParamType_Six;
 typedef std::tuple<std::string, int, int, int, int, std::vector<std::string>, int, int, int, std::vector<std::string>, std::vector<std::string>, std::vector<std::string>, std::vector<int>> ParamType_Many;
+typedef std::tuple<int> ParamType_One_Int;
 
 class InferenceEngineTestCase_G1 : public testing::TestWithParam<ParamType_One> { };
 class InferenceEngineTestCase_G2 : public testing::TestWithParam<ParamType_Two> { };
@@ -40,6 +41,8 @@ class InferenceEngineTestCase_G3 : public testing::TestWithParam<ParamType_Three
 class InferenceEngineTestCase_G4 : public testing::TestWithParam<ParamType_Six> { };
 class InferenceEngineTestCase_G5 : public testing::TestWithParam<ParamType_Six> { };
 class InferenceEngineTestCase_G6 : public testing::TestWithParam<ParamType_Many> { };
+class InferenceEngineTestCase_G7 : public testing::TestWithParam<ParamType_One_Int> { };
+class InferenceEngineTestCase_G8 : public testing::TestWithParam<ParamType_One_Int> { };
 
 static auto InferenceEngineInit_One_Param = [](InferenceEngineCommon *engine, std::string &backend_name) -> int {
        inference_engine_config config = { backend_name, 0 };
@@ -572,6 +575,34 @@ TEST_P(InferenceEngineTestCase_G6, Inference_P)
        models.clear();
 }
 
+TEST_P(InferenceEngineTestCase_G7, Bind_P)
+{
+       int backend_type;
+
+       std::tie(backend_type) = GetParam();
+
+       auto engine = std::make_unique<InferenceEngineCommon>();
+       ASSERT_TRUE(engine);
+
+       int ret = engine->BindBackend(backend_type);
+       ASSERT_EQ(ret, INFERENCE_ENGINE_ERROR_NONE);
+
+       engine->UnbindBackend();
+}
+
+TEST_P(InferenceEngineTestCase_G8, Bind_N)
+{
+       int backend_type;
+
+       std::tie(backend_type) = GetParam();
+
+       auto engine = std::make_unique<InferenceEngineCommon>();
+       ASSERT_TRUE(engine);
+
+       int ret = engine->BindBackend(backend_type);
+       ASSERT_EQ(ret, INFERENCE_ENGINE_ERROR_INVALID_PARAMETER);
+}
+
 INSTANTIATE_TEST_CASE_P(Prefix, InferenceEngineTestCase_G1,
                testing::Values(
                        // parameter order : backend name
@@ -648,4 +679,24 @@ INSTANTIATE_TEST_CASE_P(Prefix, InferenceEngineTestCase_G6,
                        ParamType_Many("tflite", INFERENCE_TARGET_CPU, TEST_IMAGE_CLASSIFICATION, 10, INFERENCE_TENSOR_DATA_TYPE_FLOAT32, { "/opt/usr/images/image_classification.bin" }, 224, 224, 3, { "input_2" }, { "dense_3/Softmax" }, { "/usr/share/capi-media-vision/models/IC/tflite/ic_tflite_model.tflite" }, { 3 })
                        /* TODO */
                )
+);
+
+INSTANTIATE_TEST_CASE_P(Prefix, InferenceEngineTestCase_G7,
+               testing::Values(
+                       // parameter order : backend type
+                       // ARMNN.
+                       ParamType_One_Int(INFERENCE_BACKEND_ARMNN),
+                       // TFLITE.
+                       ParamType_One_Int(INFERENCE_BACKEND_TFLITE)
+                       /* TODO */
+               )
+);
+
+INSTANTIATE_TEST_CASE_P(Prefix, InferenceEngineTestCase_G8,
+               testing::Values(
+                       // parameter order : backend type
+                       // Wrong backend type.
+                       ParamType_One_Int(-1)
+                       /* TODO */
+               )
 );
\ No newline at end of file