unit test: Set up unit test based on gtest.
authorJunsuChoi <jsuya.choi@samsung.com>
Fri, 21 May 2021 04:52:45 +0000 (13:52 +0900)
committerHermet Park <chuneon.park@samsung.com>
Mon, 24 May 2021 07:10:09 +0000 (16:10 +0900)
In test directory, set up unit_test based on gtest

Change-Id: I5b16914f10ab548ccd4bc564cf15d0d7615c79f2

meson.build
meson_options.txt
test/meson.build [new file with mode: 0644]
test/test_controller.cpp [new file with mode: 0644]
test/testsuite.cpp [new file with mode: 0644]

index 42de241..d53229b 100644 (file)
@@ -325,3 +325,8 @@ if get_option('example') == true
        message('Enable Examples')
        subdir('example')
 endif
+
+if get_option('test') == true
+   subdir('test')
+endif
+
index ac8e742..4842482 100644 (file)
@@ -2,3 +2,9 @@ option('example',
     type: 'boolean',
     value: false,
     description: 'Enable building example')
+
+option('test',
+   type: 'boolean',
+   value: false,
+   description: 'Enable building unit tests')
+
diff --git a/test/meson.build b/test/meson.build
new file mode 100644 (file)
index 0000000..4d96f69
--- /dev/null
@@ -0,0 +1,19 @@
+
+override_default = ['werror=false']
+
+gtest_dep  = dependency('gtest')
+
+controller_test_sources = [
+    'testsuite.cpp',
+    'test_controller.cpp',
+    ]
+
+rive_tizen_controller_testsuite = executable('ControllerTestSuite',
+                                              controller_test_sources,
+                                              include_directories : headers,
+                                              override_options : override_default,
+                                              dependencies : [gtest_dep, thorvg_dep, rive_cpp_dep, rive_tizen_dep, rive_tizen_renderer_dep],
+                                              )
+
+test('Controller Testsuite', rive_tizen_controller_testsuite)
+
diff --git a/test/test_controller.cpp b/test/test_controller.cpp
new file mode 100644 (file)
index 0000000..a4e26f0
--- /dev/null
@@ -0,0 +1,18 @@
+#include <gtest/gtest.h>
+#include <iostream>
+
+class ControllerTest : public ::testing::Test {
+public:
+    void SetUp() {
+    }
+    void TearDown() {
+    }
+public:
+    //Controller controller;
+};
+
+TEST_F(ControllerTest, GenerateController) {
+    //ASSERT_TRUE(controller != nullptr);
+    ASSERT_TRUE(true); //temporary
+}
+
diff --git a/test/testsuite.cpp b/test/testsuite.cpp
new file mode 100644 (file)
index 0000000..5633721
--- /dev/null
@@ -0,0 +1,7 @@
+#include <gtest/gtest.h>
+
+int main(int argc, char **argv) {
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
+