tools/nnapi_unittest runs as GTest (#1757)
author윤현식/동작제어Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Wed, 27 Jun 2018 01:02:03 +0000 (10:02 +0900)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 27 Jun 2018 01:02:03 +0000 (10:02 +0900)
Changes each test to GTest.

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
26 files changed:
tools/nnapi_unittests/CMakeLists.txt
tools/nnapi_unittests/tests/add_1.cpp
tools/nnapi_unittests/tests/add_2.cpp
tools/nnapi_unittests/tests/add_3.cpp
tools/nnapi_unittests/tests/avg_pool_1.cpp
tools/nnapi_unittests/tests/cast_1.cpp
tools/nnapi_unittests/tests/cast_2.cpp
tools/nnapi_unittests/tests/concat_1.cpp
tools/nnapi_unittests/tests/conv_1.cpp
tools/nnapi_unittests/tests/dconv_1.cpp
tools/nnapi_unittests/tests/div_1.cpp
tools/nnapi_unittests/tests/div_2.cpp
tools/nnapi_unittests/tests/fully_connected_1.cpp
tools/nnapi_unittests/tests/gather_1.cpp
tools/nnapi_unittests/tests/gather_2.cpp
tools/nnapi_unittests/tests/max_pool_1.cpp
tools/nnapi_unittests/tests/mul_1.cpp
tools/nnapi_unittests/tests/mul_2.cpp
tools/nnapi_unittests/tests/reshape_1.cpp
tools/nnapi_unittests/tests/resize_bilinear_1.cpp
tools/nnapi_unittests/tests/softmax_1.cpp
tools/nnapi_unittests/tests/sub_1.cpp
tools/nnapi_unittests/tests/sub_2.cpp
tools/nnapi_unittests/tests/sub_3.cpp
tools/nnapi_unittests/tests/sub_4.cpp
tools/nnapi_unittests/tests/topk_v2_1.cpp

index 9ccd090..9ce65d1 100644 (file)
@@ -12,6 +12,8 @@ target_link_libraries(nnapi_unittest_lib_env_test nnapi_unittest_common)
 
 function(add_nnapi_unittest NAME)
   add_executable(nnapi_unittest_${NAME} "tests/${NAME}.cpp")
+  add_dependencies(nnapi_unittest_${NAME} googletest)
+  target_link_libraries(nnapi_unittest_${NAME} libgtest.a libgtest_main.a pthread)
   target_link_libraries(nnapi_unittest_${NAME} nnapi_unittest_common)
   install(TARGETS nnapi_unittest_${NAME} DESTINATION unittest)
 endfunction(add_nnapi_unittest)
index 91e84f6..d73f3a2 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_add_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -151,5 +153,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 6780842..71f6df1 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_add_2, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -169,5 +171,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 9d028ee..4d93632 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -36,7 +38,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_add_3, simple_test)
 {
   // Set random seed
   int SEED = std::chrono::system_clock::now().time_since_epoch().count();
@@ -129,5 +131,7 @@ int main(int argc, char **argv)
   nnfw::util::env::IntAccessor("VERBOSE").access(param.verbose);
   nnfw::util::env::IntAccessor("TOLERANCE").access(param.tolerance);
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 75835bb..bae1221 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -32,7 +34,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_avg_pool_1, simple_test)
 {
   // Set random seed
   int SEED = std::chrono::system_clock::now().time_since_epoch().count();
@@ -142,5 +144,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 9f78d95..526cf8b 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -34,7 +36,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_cast_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -128,5 +130,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 586c2e8..415e290 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_cast_2, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -126,5 +128,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index a8fafc9..c09c438 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_concat_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -153,5 +155,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index d5a3fd4..7e709b5 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_conv_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -199,5 +201,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 27808c0..a3abc7a 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_dconv_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -197,5 +199,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 51ae3a7..58f2a25 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_div_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -151,5 +153,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 9b9e8d3..62d6816 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_div_2, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -144,5 +146,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index c432fae..396a00e 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -36,7 +38,7 @@ using namespace tflite::ops::builtin;
 
 template <typename T> T *make_malloc(void) { return reinterpret_cast<T *>(malloc(sizeof(T))); }
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_fully_connected_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -179,5 +181,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 6d01a10..bb21555 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -31,7 +33,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_gather_1, simple_test)
 {
   // Set random seed
   int SEED = std::chrono::system_clock::now().time_since_epoch().count();
@@ -124,5 +126,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index de80828..b1a8622 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -31,7 +33,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_gather_2, simple_test)
 {
   // Set random seed
   int SEED = std::chrono::system_clock::now().time_since_epoch().count();
@@ -128,5 +130,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index ae11133..e34d157 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -32,7 +34,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_max_pool_1, simple_test)
 {
   // Set random seed
   int SEED = std::chrono::system_clock::now().time_since_epoch().count();
@@ -148,5 +150,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 6044b32..c470375 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -34,7 +36,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_mul_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -142,5 +144,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 5b1e94a..e3cb1f7 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -34,7 +36,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_mul_2, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -142,5 +144,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 563eed9..98da5f2 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -32,7 +34,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_reshape_1, simple_test)
 {
   // Set random seed
   int SEED = std::chrono::system_clock::now().time_since_epoch().count();
@@ -133,5 +135,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 59fc315..98dc40f 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -32,7 +34,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_resize_bilinear_1, simple_test)
 {
   // Set random seed
   int SEED = std::chrono::system_clock::now().time_since_epoch().count();
@@ -133,5 +135,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index f80700f..6415ef1 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_softmax_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -112,5 +114,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index ea4a34d..e5ade26 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_sub_1, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -151,5 +153,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 732ce0e..208de17 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_sub_2, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -144,5 +146,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index ec9b34c..934b3d4 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_sub_3, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -136,5 +138,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index ea06222..d0a34ac 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -35,7 +37,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_sub_4, simple_test)
 {
   int verbose = 0;
   int tolerance = 1;
@@ -144,5 +146,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }
index 146c9c7..b313c81 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "gtest/gtest.h"
+
 #include "support/tflite/kernels/register.h"
 #include "tensorflow/contrib/lite/model.h"
 #include "tensorflow/contrib/lite/builtin_op_data.h"
@@ -32,7 +34,7 @@
 using namespace tflite;
 using namespace tflite::ops::builtin;
 
-int main(int argc, char **argv)
+TEST(NNAPI_Unittest_topk_v2_1, simple_test)
 {
   // Set random seed
   int SEED = std::chrono::system_clock::now().time_since_epoch().count();
@@ -130,5 +132,7 @@ int main(int argc, char **argv)
   param.verbose = verbose;
   param.tolerance = tolerance;
 
-  return RandomTestRunner{SEED, param}.run(builder);
+  int res = RandomTestRunner{SEED, param}.run(builder);
+
+  EXPECT_EQ(res, 0);
 }