[Test/Transform/Typecast] Add more test cases
authorWook Song <wook16.song@samsung.com>
Tue, 12 Mar 2019 02:24:15 +0000 (11:24 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 13 Mar 2019 01:06:30 +0000 (10:06 +0900)
This patch adds more unit test cases for the typecast mode of the
tensor_transform element.

Signed-off-by: Wook Song <wook16.song@samsung.com>
tests/nnstreamer_plugins/unittest_plugins.cpp
tests/transform_typecast/runTest.sh

index 04d4b77..52aa2dc 100644 (file)
@@ -1122,6 +1122,76 @@ TEST (test_tensor_transform, typecast_7_accel)
 }
 
 /**
+ * @brief Test for tensor_transform typecast (uint64 -> int64)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_8, 3, 5, uint64_t, _NNS_UINT64, int64_t, "int64", _NNS_INT64, FALSE)
+
+/**
+ * @brief Test for tensor_transform typecast (acceleration, uint64 -> int64)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_8_accel, 3, 5, uint64_t, _NNS_UINT64, int64_t, "int64", _NNS_INT64, TRUE)
+
+/**
+ * @brief Test for tensor_transform typecast (float -> uint32)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_9, 3, 5, float, _NNS_FLOAT32, uint32_t, "uint32", _NNS_UINT32, FALSE)
+
+/**
+ * @brief Test for tensor_transform typecast (acceleration, float -> uint32)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_9_accel, 3, 5, float, _NNS_FLOAT32, uint32_t, "uint32", _NNS_UINT32, TRUE)
+
+/**
+ * @brief Test for tensor_transform typecast (uint8 -> int8)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_10, 3, 5, uint8_t, _NNS_UINT8, int8_t, "int8", _NNS_INT8, FALSE)
+
+/**
+ * @brief Test for tensor_transform typecast (acceleration, uint8 -> int8)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_10_accel, 3, 5, uint8_t, _NNS_UINT8, int8_t, "int8", _NNS_INT8, TRUE)
+
+/**
+ * @brief Test for tensor_transform typecast (uint32 -> int16)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_11, 3, 5, uint32_t, _NNS_UINT32, int16_t, "int16", _NNS_INT16, FALSE)
+
+/**
+ * @brief Test for tensor_transform typecast (acceleration, uint32 -> int16)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_11_accel, 3, 5, uint32_t, _NNS_UINT32, int16_t, "int16", _NNS_INT16, TRUE)
+
+/**
+ * @brief Test for tensor_transform typecast (float -> uint8)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_12, 3, 5, float, _NNS_FLOAT32, uint8_t, "uint8", _NNS_UINT8, FALSE)
+
+/**
+ * @brief Test for tensor_transform typecast (acceleration, float -> uint8)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_12_accel, 3, 5, float, _NNS_FLOAT32, uint8_t, "uint8", _NNS_UINT8, TRUE)
+
+/**
+ * @brief Test for tensor_transform typecast (double -> uint16)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_13, 3, 5, double, _NNS_FLOAT64, uint16_t, "uint16", _NNS_UINT16, FALSE)
+
+/**
+ * @brief Test for tensor_transform typecast (acceleration, double -> uint16)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_13_accel, 3, 5, double, _NNS_FLOAT64, uint16_t, "uint16", _NNS_UINT16, TRUE)
+
+/**
+ * @brief Test for tensor_transform typecast (double -> uint64)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_14, 3, 5, double, _NNS_FLOAT64, uint64_t, "uint64", _NNS_UINT64, FALSE)
+
+/**
+ * @brief Test for tensor_transform typecast (acceleration, double -> uint64)
+ */
+TEST_TRANSFORM_TYPECAST (typecast_14_accel, 3, 5, double, _NNS_FLOAT64, uint64_t, "uint64", _NNS_UINT64, TRUE)
+
+/**
  * @brief Test for tensor_transform arithmetic (float32, add .5)
  */
 TEST (test_tensor_transform, arithmetic_1)
index 8d79eb7..6903682 100644 (file)
@@ -45,6 +45,9 @@ gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} multifilesrc location=\"testsequenc
 python checkResult.py typecast testcase02.direct.log testcase02.typecast.log uint8 1 B uint16 2 H
 testResult $? 2 "Golden test comparison" 0 1
 
+# Fail Test: Unknown data type is given
+# uint8 -> uint128
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} multifilesrc location=\"testsequence_%1d.png\" index=0 caps=\"image/png,framerate=\(fraction\)30/1\" ! pngdec ! videoconvert ! video/x-raw, format=BGRx ! tensor_converter ! tee name=t ! queue ! tensor_transform mode=typecast option=uint128 ! filesink location=\"testcase02-F.typecast.log\" sync=true t. ! queue ! filesink location=\"testcase02-F.direct.log\" sync=true" 2-F 0 1 $PERFORMANCE
 
 gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} multifilesrc location=\"testsequence_%1d.png\" index=0 caps=\"image/png,framerate=\(fraction\)30/1\" ! pngdec ! videoconvert ! video/x-raw, format=BGRx ! tensor_converter ! tee name=t ! queue ! tensor_transform mode=typecast option=int8 ! filesink location=\"testcase03.typecast.log\" sync=true t. ! queue ! filesink location=\"testcase03.direct.log\" sync=true" 3 0 0 $PERFORMANCE
 # uint8 -> int8