Add initial gtest codes 90/166790/2
authorchleun.moon <chleun.moon@samsung.com>
Fri, 12 Jan 2018 02:35:21 +0000 (11:35 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Fri, 12 Jan 2018 02:37:29 +0000 (11:37 +0900)
Change-Id: I7951485546aa4cd541a3ead525a27573dd943938
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
13 files changed:
CMakeLists.txt
packaging/asp-manager.spec
unittest/CMakeLists.txt [new file with mode: 0755]
unittest/asp-manager-fixture.h [new file with mode: 0644]
unittest/asp-manager-test-util.h [new file with mode: 0644]
unittest/asp-manager-test.cpp [new file with mode: 0644]
unittest/service/asp-service-factory.cpp [new file with mode: 0644]
unittest/service/asp-service-factory.h [new file with mode: 0644]
unittest/service/asp-service-fixture.h [new file with mode: 0644]
unittest/service/asp-service-test.cpp [new file with mode: 0644]
unittest/session/asp-session-fixture.h [new file with mode: 0644]
unittest/session/asp-session-test.cpp [new file with mode: 0644]
unittest/unittest.cpp [new file with mode: 0644]

index 6cc046f..c4250c2 100755 (executable)
@@ -17,7 +17,7 @@
 
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 
-PROJECT(asp-manager C)
+PROJECT(asp-manager C CXX)
 
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 
@@ -36,7 +36,11 @@ FOREACH(flag ${asp_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fpic -Wall -Werror-implicit-function-declaration -fvisibility=hidden")
+IF(BUILD_GTESTS)
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fpic -Wall -Werror-implicit-function-declaration -fvisibility=hidden")
+ELSE(BUILD_GTESTS)
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fpic -Wall -Werror-implicit-function-declaration")
+ENDIF(BUILD_GTESTS)
 
 SET(ARM_CFLAGS "${ARM_CFLAGS} -mapcs -mabi=aapcs-linux -msoft-float -Uarm -fpic")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
@@ -45,3 +49,8 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
 
 ADD_SUBDIRECTORY(src)
 ADD_SUBDIRECTORY(interfaces)
+
+IF(BUILD_GTESTS)
+       ADD_SUBDIRECTORY(unittest)
+ENDIF(BUILD_GTESTS)
+
index c3144d5..eecd620 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       asp-manager
 Summary:    ASP(application service platform) manager
-Version:    0.0.27
+Version:    0.0.28
 Release:    1
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
@@ -22,6 +22,10 @@ BuildRequires:  python
 BuildRequires:  python-xml
 Requires:       security-config
 
+%if 0%{?gtests:1}
+BuildRequires: pkgconfig(gmock)
+%endif
+
 %description
 An application service platform manager to manage services and sessions
 
@@ -40,6 +44,7 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 
 %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+-DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
 -DBIN_DIR=%{_bindir}
 
 make %{?_smp_mflags}
@@ -61,6 +66,9 @@ cp asp-manager.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/asp-manager.conf
 %license LICENSE
 %defattr(-,network_fw,network_fw,-)
 %attr(500,network_fw,network_fw) %{_bindir}/*
+%if 0%{?gtests:1}
+       %{_bindir}/gtest-asp-manager
+%endif
 
 #DBus DAC
 %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/asp-manager.conf
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..5e9c439
--- /dev/null
@@ -0,0 +1,63 @@
+# Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+# @file        CMakeLists.txt
+#
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(GTEST_TEST "gtest-asp-manager")
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(gtest_pkgs REQUIRED glib-2.0 gmock)
+
+INCLUDE_DIRECTORIES(${gtest_pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${gtest_pkgs_LIBRARY_DIRS})
+
+INCLUDE_DIRECTORIES(${asp_pkgs_INCLUDE_DIRS})
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/interfaces)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/unittest)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpie")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie")
+
+SET(SRCS
+       ${CMAKE_SOURCE_DIR}/src/asp-manager.c
+       ${CMAKE_SOURCE_DIR}/src/asp-manager-event.c
+       ${CMAKE_SOURCE_DIR}/src/asp-manager-gdbus.c
+       ${CMAKE_SOURCE_DIR}/src/asp-manager-util.c
+       ${CMAKE_SOURCE_DIR}/interfaces/generated-code.c
+       )
+
+SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/interfaces/generated-code.c PROPERTIES GENERATED TRUE)
+
+FILE(GLOB SERVICE_SRCS ${CMAKE_SOURCE_DIR}/src/service/*.c)
+FILE(GLOB SESSION_SRCS ${CMAKE_SOURCE_DIR}/src/session/*.c)
+FILE(GLOB TECH_SRCS ${CMAKE_SOURCE_DIR}/src/tech/*.c)
+FILE(GLOB GTEST_SRCS
+       ${CMAKE_SOURCE_DIR}/unittest/*.cpp
+       ${CMAKE_SOURCE_DIR}/unittest/service/*.cpp
+       ${CMAKE_SOURCE_DIR}/unittest/session/*.cpp
+       )
+
+ADD_DEFINITIONS("-DUSE_DLOG")
+
+ADD_EXECUTABLE(${GTEST_TEST} ${SRCS} ${SERVICE_SRCS} ${SESSION_SRCS} ${TECH_SRCS} ${GTEST_SRCS})
+ADD_DEPENDENCIES(${GTEST_TEST} GENERATED_DBUS_CODE)
+
+TARGET_LINK_LIBRARIES(${GTEST_TEST} ${gtest_pkgs_LIBRARIES} ${asp_pkgs_LDFLAGS} -ldl)
+
+INSTALL(TARGETS ${GTEST_TEST} RUNTIME DESTINATION ${BIN_DIR})
diff --git a/unittest/asp-manager-fixture.h b/unittest/asp-manager-fixture.h
new file mode 100644 (file)
index 0000000..f078eed
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef __ASP_MANAGER_FIXTURE_H__
+#define __ASP_MANAGER_FIXTURE_H__
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "asp-manager.h"
+
+class AspManager : public ::testing::Test
+{
+protected:
+       virtual void SetUp() {
+               asp_manager_load();
+       }
+
+       virtual void TearDown() {
+               asp_manager_unload();
+       }
+};
+
+#endif
diff --git a/unittest/asp-manager-test-util.h b/unittest/asp-manager-test-util.h
new file mode 100644 (file)
index 0000000..f838f3c
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef __ASP_MANAGER_TEST_UTIL_H__
+#define __ASP_MANAGER_TEST_UTIL_H__
+
+#include <dlog.h>
+
+#include "asp-manager-util.h"
+
+//#undef LOG_TAG
+//#define LOG_TAG "ASP_MANAGER_TEST"
+
+#define __ASP_MANAGER_TEST_ENTER__ ASP_LOGD("Testcase %s Start", __PRETTY_FUNCTION__)
+#define __ASP_MANAGER_TEST_EXIT__ ASP_LOGD("Testcase %s Done", __PRETTY_FUNCTION__)
+
+#endif
diff --git a/unittest/asp-manager-test.cpp b/unittest/asp-manager-test.cpp
new file mode 100644 (file)
index 0000000..8203252
--- /dev/null
@@ -0,0 +1,22 @@
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "asp-manager.h"
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+
+TEST(asp_manager, __asp_manager_load_unload_p)
+{
+       int ret = 0;
+       ret = asp_manager_load();
+       ASSERT_EQ(ret, 0);
+       asp_manager_unload();
+       ASSERT_TRUE(1);
+}
diff --git a/unittest/service/asp-service-factory.cpp b/unittest/service/asp-service-factory.cpp
new file mode 100644 (file)
index 0000000..f8d367e
--- /dev/null
@@ -0,0 +1,112 @@
+#include "asp-service-factory.h"
+
+#define CONVERT_TECH(a) (1 << ((a) - 1))
+asp_service_advertise_s*
+ServiceFactory::CreateAdvertiseService(asp_tech_e tech)
+{
+       asp_service_advertise_s* service = new asp_service_advertise_s;
+//     SetP2PService(service);
+       switch (tech) {
+       case ASP_TECH_P2P:
+               SetP2PService(service);
+               break;
+       case ASP_TECH_INFRA:
+               SetInfraService(service);
+               break;
+       default:
+               ReleaseAdvertiseService(service);
+               return NULL;
+       }
+       return service;
+}
+
+void
+ServiceFactory::SetP2PService(asp_service_advertise_s* service)
+{
+       service->adv_id = 0;
+       service->discovery_tech = CONVERT_TECH(ASP_TECH_P2P);
+       service->preferred_connection = CONVERT_TECH(ASP_TECH_P2P);
+       service->auto_accept = 1;
+       service->status = 0;
+       service->role = ASP_SERVICE_P2P_ROLE_NEW;
+       service->config_method = 0;
+       service->instance_name = g_strdup("test_service_name");
+       service->service_type = g_strdup("_http._tcp");
+       // service->service_info_map --> g_hash_table
+       // service->rsp_info --> string
+}
+
+void
+ServiceFactory::SetInfraService(asp_service_advertise_s* service)
+{
+       service->adv_id = 0;
+       service->discovery_tech = CONVERT_TECH(ASP_TECH_INFRA);
+       service->preferred_connection = CONVERT_TECH(ASP_TECH_P2P);
+       service->auto_accept = 1;
+       service->status = 0;
+       service->config_method = 0;
+       service->instance_name = g_strdup("test_service_name");
+       service->service_type = g_strdup("_http._tcp");
+       // service->service_info_map --> g_hash_table
+       // service->rsp_info --> string
+}
+
+void
+ServiceFactory::ReleaseAdvertiseService(asp_service_advertise_s* service)
+{
+       g_free(service->instance_name);
+       g_free(service->service_type);
+
+       delete service;
+}
+
+asp_service_seek_s*
+ServiceFactory::CreateSeekService(asp_tech_e tech)
+{
+       asp_service_seek_s* service = new asp_service_seek_s;
+//     SetP2PService(service);
+       switch (tech) {
+       case ASP_TECH_P2P:
+               SetP2PService(service);
+               break;
+       case ASP_TECH_INFRA:
+               SetInfraService(service);
+               break;
+       default:
+               ReleaseSeekService(service);
+               return NULL;
+       }
+       return service;
+}
+
+void
+ServiceFactory::SetP2PService(asp_service_seek_s* service)
+{
+       service->discovery_tech = CONVERT_TECH(ASP_TECH_P2P);
+       service->preferred_connection = CONVERT_TECH(ASP_TECH_P2P);
+       service->status = 0;
+       service->config_method = 0;
+       service->service_type = g_strdup("_http._tcp");
+       // service->service_info_map --> g_hash_table
+       // service->rsp_info --> string
+}
+
+void
+ServiceFactory::SetInfraService(asp_service_seek_s* service)
+{
+       service->discovery_tech = CONVERT_TECH(ASP_TECH_INFRA);
+       service->preferred_connection = CONVERT_TECH(ASP_TECH_INFRA);
+       service->status = 0;
+       service->service_type = g_strdup("_http._tcp");
+       // service->service_info_map --> g_hash_table
+       // service->rsp_info --> string
+}
+
+void
+ServiceFactory::ReleaseSeekService(asp_service_seek_s* service)
+{
+       g_free(service->service_type);
+
+       delete service;
+}
+
diff --git a/unittest/service/asp-service-factory.h b/unittest/service/asp-service-factory.h
new file mode 100644 (file)
index 0000000..d131742
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef __ASP_SERVICE_FACTORY_H__
+#define __ASP_SERVICE_FACTORY_H__
+
+#include "asp-service.h"
+#include "asp-tech.h"
+
+class ServiceFactory
+{
+public:
+       static asp_service_advertise_s* CreateAdvertiseService(asp_tech_e tech);
+       static void ReleaseAdvertiseService(asp_service_advertise_s* service);
+
+       static asp_service_seek_s* CreateSeekService(asp_tech_e tech);
+       static void ReleaseSeekService(asp_service_seek_s* service);
+private:
+       static void SetP2PService(asp_service_advertise_s* service);
+       static void SetInfraService(asp_service_advertise_s* service);
+       static void SetP2PService(asp_service_seek_s* service);
+       static void SetInfraService(asp_service_seek_s* service);
+};
+#endif
diff --git a/unittest/service/asp-service-fixture.h b/unittest/service/asp-service-fixture.h
new file mode 100644 (file)
index 0000000..18c4ea5
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef __ASP_SERVICE_FIXTURE_H__
+#define __ASP_SERVICE_FIXTURE_H__
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "asp-manager-fixture.h"
+class AspManager_AspService : public AspManager
+{
+       /*
+private:
+       asp_s *manager = NULL;
+       GMainLoop *main_loop = NULL;
+       */
+protected:
+       virtual void SetUp() {
+               AspManager::SetUp();
+               /*
+               manager = asp_get_manager();
+               if (!manager) {
+                       ASP_LOGE("Failed to get asp_s");
+                       return;
+               }
+               main_loop = g_main_loop_new(NULL, FALSE);
+               manager->main_loop = main_loop;
+               g_main_loop_run(main_loop);
+               */
+       }
+
+       virtual void TearDown() {
+               AspManager::TearDown();
+//             g_main_loop_unref(main_loop);
+       }
+};
+
+#endif
diff --git a/unittest/service/asp-service-test.cpp b/unittest/service/asp-service-test.cpp
new file mode 100644 (file)
index 0000000..9ae5ee5
--- /dev/null
@@ -0,0 +1,104 @@
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include <glib.h>
+
+#include "asp-service.h"
+#include "asp-tech.h"
+#include "asp-manager-util.h"
+
+#include "asp-service-fixture.h"
+#include "asp-service-factory.h"
+#include "asp-manager-test-util.h"
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+
+TEST_F(AspManager_AspService, asp_service_init_deinit_p)
+{
+       __ASP_MANAGER_TEST_ENTER__;
+       int ret = 0;
+       ret = asp_service_init();
+       ASSERT_EQ(ret, ASP_ERROR_NONE) << "FAIL asp_service_init " << ret;
+       asp_service_deinit();
+       __ASP_MANAGER_TEST_EXIT__;
+}
+
+TEST_F(AspManager_AspService, asp_service_advertise_infra_p)
+{
+       __ASP_MANAGER_TEST_ENTER__;
+       int ret = 0;
+       asp_service_advertise_s* service = ServiceFactory::CreateAdvertiseService(ASP_TECH_INFRA);
+       ASSERT_TRUE(service) << "FAIL asp_service_advertise_s " << ret;
+
+       ret = asp_service_advertise(service, 0);
+       ASSERT_GE(ret, ASP_ERROR_NONE) << "FAIL asp_service_advertise " << ret;
+
+       ret = asp_service_cancel_advertise(service);
+       ASSERT_EQ(ret, ASP_ERROR_NONE) << "FAIL asp_service_cancel_advertise " << ret;
+
+       ServiceFactory::ReleaseAdvertiseService(service);
+       __ASP_MANAGER_TEST_EXIT__;
+}
+
+TEST_F(AspManager_AspService, asp_service_seek_infra_p)
+{
+       __ASP_MANAGER_TEST_ENTER__;
+       int ret = 0;
+       guint64 search_id = 0;
+       asp_service_seek_s* service = ServiceFactory::CreateSeekService(ASP_TECH_INFRA);
+       ASSERT_TRUE(service) << "FAIL CreateSeekService";
+
+       ret = asp_service_seek(service, &search_id);
+       ASSERT_GE(ret, ASP_ERROR_NONE) << "FAIL asp_service_seek " << ret;
+       ASSERT_GE(search_id, 0) << "FAIL invalid search_id " << search_id;
+
+       ret = asp_service_cancel_seek(service);
+       ASSERT_EQ(ret, ASP_ERROR_NONE) << "FAIL asp_service_cancel_seek";
+
+       ServiceFactory::ReleaseSeekService(service);
+       __ASP_MANAGER_TEST_EXIT__;
+}
+
+TEST_F(AspManager_AspService, asp_service_notify_advertise_status_p)
+{
+       __ASP_MANAGER_TEST_ENTER__;
+       int ret = 0;
+       int adv_id = 1;
+       asp_service_advertise_status_e status = ASP_SERVICE_ADV_STATUS_ADVERTISED;
+       asp_service_advertise_reason_e reason = ASP_SERVICE_ADVERTISE_REASON_SUCCESS;
+
+       ret = asp_service_notify_advertise_status(adv_id, status, reason);
+       ASSERT_EQ(ret, ASP_ERROR_NONE) << "FAIL asp_service_notify_advertise_status (ADVERTISED) " << ret;
+
+       status = ASP_SERVICE_ADV_STATUS_NOT_ADVERTISED;
+       reason = ASP_SERVICE_ADVERTISE_REASON_OTHER;
+       ret = asp_service_notify_advertise_status(adv_id, status, reason);
+       ASSERT_EQ(ret, ASP_ERROR_NONE) << "FAIL asp_service_notify_advertise_status (NOT_ADVERTISED) " << ret;
+
+       __ASP_MANAGER_TEST_EXIT__;
+}
+
+TEST_F(AspManager_AspService, asp_service_notify_search_result_p)
+{
+       __ASP_MANAGER_TEST_ENTER__;
+       int ret = 0;
+       int search_id = 1;
+       int adv_id = 1;
+       char service_mac[20] = "12:34:56:78:90:ab";
+       char instance_name[10] = "service";
+       char device[10] = "dev";
+       asp_service_status_e status = ASP_SERVICE_STATUS_AVAILABLE;
+
+       ret = asp_service_notify_search_result(search_id, service_mac,
+                       device, adv_id, instance_name, NULL, status);
+       ASSERT_EQ(ret, ASP_ERROR_NONE) << "FAIL asp_service_notify_search_result " << ret;
+       __ASP_MANAGER_TEST_EXIT__;
+}
+
diff --git a/unittest/session/asp-session-fixture.h b/unittest/session/asp-session-fixture.h
new file mode 100644 (file)
index 0000000..2e8f65c
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef __ASP_SERVICE_FIXTURE_H__
+#define __ASP_SERVICE_FIXTURE_H__
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "asp-manager-fixture.h"
+class AspManager_AspSession : public AspManager
+{
+protected:
+       virtual void SetUp() {
+               AspManager::SetUp();
+       }
+
+       virtual void TearDown() {
+               AspManager::TearDown();
+       }
+};
+
+#endif
diff --git a/unittest/session/asp-session-test.cpp b/unittest/session/asp-session-test.cpp
new file mode 100644 (file)
index 0000000..04bcde4
--- /dev/null
@@ -0,0 +1,65 @@
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include <glib.h>
+
+#include "asp-session.h"
+#include "asp-tech.h"
+#include "asp-manager-util.h"
+
+#include "asp-session-fixture.h"
+#include "asp-manager-test-util.h"
+
+#define MAC_LEN 6
+#define MACSTR_LEN 17
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+
+TEST(asp_session, asp_session_init_deinit_p)
+{
+       __ASP_MANAGER_TEST_ENTER__;
+
+       gboolean ret = false;
+       ret = asp_session_initialize();
+       ASSERT_TRUE(ret) << "FAIL asp_session_initialize";
+       ret = asp_session_deinitialize();
+       ASSERT_TRUE(ret) << "FAIL asp_session_deinitialize";
+
+       __ASP_MANAGER_TEST_EXIT__;
+}
+
+TEST_F(AspManager_AspSession, asp_session_connect_session_over_p2p_p)
+{
+       __ASP_MANAGER_TEST_ENTER__;
+
+       gboolean ret = false;
+       guint8 service_mac[MAC_LEN] = {0, };
+       gchar service_mac_str[MACSTR_LEN + 1] = "12:34:56:78:90:ab";
+       guint32 adv_id = 1;
+       guint8* session_info = NULL;
+       size_t info_length = 0;
+       guint8 network_role = 0;
+       guint8 network_config = 0;
+       guint8 session_mac[MAC_LEN] = {0, };
+       gchar session_mac_str[MACSTR_LEN + 1] = "ab:cd:ef:12:34:56";
+       guint32 p_session_id;
+       macaddr_atoe(service_mac_str, service_mac);
+       macaddr_atoe(session_mac_str, session_mac);
+       ret =  asp_session_connect_session_over_p2p(
+                       service_mac,
+                       adv_id,
+                       session_info,
+                       info_length,
+                       network_role,
+                       network_config,
+                       session_mac,
+                       &p_session_id);
+       ASSERT_TRUE(ret) << "FAIL asp_session_connect_session_over_p2p";;
+}
diff --git a/unittest/unittest.cpp b/unittest/unittest.cpp
new file mode 100644 (file)
index 0000000..9315711
--- /dev/null
@@ -0,0 +1,18 @@
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include "asp-manager.h"
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+
+int main(int argc, char **argv)
+{
+       InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}