mv_machine_learning: check value range in FaceRecognition testcase
authorVibhav Aggarwal <v.aggarwal@samsung.com>
Tue, 21 Nov 2023 06:19:26 +0000 (15:19 +0900)
committerKwanghoon Son <k.son@samsung.com>
Wed, 6 Dec 2023 01:36:46 +0000 (10:36 +0900)
[Issue type] code refactoring

In the FaceRecognition.RawResultAfterInferenceShouldBeOk testcase,
check if the output raw values lie inside an acceptable range,
instead of comparing them with the exact value. The exact value
may change based on many factors like the underlying engine version.

Change-Id: Id917bb94716c6dda369dbe8ba4de1bf6311d6e73
Signed-off-by: Vibhav Aggarwal <v.aggarwal@samsung.com>
test/testsuites/machine_learning/face_recognition/test_face_recognition.cpp

index bf306c7..f457d7f 100644 (file)
@@ -204,8 +204,9 @@ TEST(FaceRecognitionTest, DISABLED_RawResultAfterInferenceShouldBeOk)
                        ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
 
                        ASSERT_EQ(label_answers[idx], out_label);
-                       ASSERT_EQ(static_cast<int>(tensor_answers[tensor_answer_idx++] * 100),
-                                         static_cast<int>(confidences[idx] * 100));
+                       ASSERT_LE(abs(static_cast<int>(tensor_answers[tensor_answer_idx++] * 100) -
+                                                 static_cast<int>(confidences[idx] * 100)),
+                                         1);
                }
        }