Changes each test to GTest.
Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
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)
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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();
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);
}
* 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"
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();
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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();
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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();
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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();
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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();
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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();
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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;
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}
* 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"
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();
param.verbose = verbose;
param.tolerance = tolerance;
- return RandomTestRunner{SEED, param}.run(builder);
+ int res = RandomTestRunner{SEED, param}.run(builder);
+
+ EXPECT_EQ(res, 0);
}