Fix Unit Test 60/195060/2
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 10 Dec 2018 08:54:21 +0000 (17:54 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 14 Dec 2018 07:09:01 +0000 (16:09 +0900)
The package name is changed to "rpc-port-unittests".
The executable file name is changed to "rpc-port_unittests".
The descriptions are added.

Change-Id: I7bccadd241f938f7ebd75ea0d82a5932fcdfbf5d
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
packaging/rpc-port.spec
unit_tests/CMakeLists.txt
unit_tests/src/rpc_port_parcel_test.cc
unit_tests/src/rpc_port_test.cc

index d58490c..df1d35d 100755 (executable)
@@ -66,15 +66,15 @@ rm -rf %{buildroot}
 %{_libdir}/lib%{name}.so
 
 #################################################
-# gtest-rpc-port
+# rpc-port-unittests
 #################################################
-%package -n gtest-rpc-port
+%package -n rpc-port-unittests
 Summary:    GTest for rpc-port
 Group:      Development/Libraries
 Requires:   %{name}
 
-%description -n gtest-rpc-port
+%description -n rpc-port-unittests
 GTest for rpc-port
 
-%files -n gtest-rpc-port
-%{_bindir}/gtest-rpc-port
+%files -n rpc-port-unittests
+%{_bindir}/rpc-port_unittests
index ecbe1b6..a3b19c4 100644 (file)
@@ -1,14 +1,14 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(gtest-rpc-port CXX)
+PROJECT(rpc-port_unittests CXX)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(gtest-rpc-port REQUIRED
+pkg_check_modules(rpc-port_unittests REQUIRED
     glib-2.0
     gmock
     aul
 )
 
-FOREACH(flag ${gtest-rpc-port_CFLAGS})
+FOREACH(flag ${rpc-port_unittests_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
@@ -25,6 +25,6 @@ ADD_EXECUTABLE(${PROJECT_NAME}
        ${SOURCES}
 )
 
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${gtest-rpc-port_LDFLAGS} rpc-port)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${rpc-port_unittests_LDFLAGS} rpc-port)
 
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin)
index 21e11c4..a04d6a1 100644 (file)
@@ -101,7 +101,12 @@ class ParcelTest : public ::testing::Test {
   bool touch_to_ = false;
 };
 
-TEST(rpc_port_parcel, rpc_port_parcel_create_destroy) {
+/*
+ * @testcase rpc_port_parcel_create_destroy_P
+ * @description Creates and destroys the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_create, rpc_port_parcel_destroy
+ */
+TEST(rpc_port_parcel, rpc_port_parcel_create_destroy_P) {
   rpc_port_parcel_h handle;
 
   int ret = rpc_port_parcel_create(&handle);
@@ -113,7 +118,12 @@ TEST(rpc_port_parcel, rpc_port_parcel_create_destroy) {
   ASSERT_EQ(ret, 0);
 }
 
-TEST_F(ParcelTest, read_write_byte) {
+/*
+ * @testcase rpc_port_parcel_read_write_byte_P
+ * @description Writes and reads the byte data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_byte, rpc_port_parcel_read_byte
+ */
+TEST_F(ParcelTest, rpc_port_parcel_write_read_byte_P) {
   int ret = rpc_port_parcel_write_byte(handle_, 'k');
   ASSERT_EQ(ret, 0);
 
@@ -123,7 +133,12 @@ TEST_F(ParcelTest, read_write_byte) {
   ASSERT_EQ(b, 'k');
 }
 
-TEST_F(ParcelTest, read_write_int16) {
+/*
+ * @testcase rpc_port_parcel_read_write_int16_P
+ * @description Writes and reads the int16 data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_int16, rpc_port_parcel_read_int16
+ */
+TEST_F(ParcelTest, rpc_port_parcel_read_write_in16_P) {
   int ret = rpc_port_parcel_write_int16(handle_, 123);
   ASSERT_EQ(ret, 0);
 
@@ -133,7 +148,12 @@ TEST_F(ParcelTest, read_write_int16) {
   ASSERT_EQ(b, 123);
 }
 
-TEST_F(ParcelTest, read_write_int32) {
+/*
+ * @testcase rpc_port_parcel_read_write_int32_P
+ * @description Writes and reads the int32 data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_int32, rpc_port_parcel_read_int32
+ */
+TEST_F(ParcelTest, rpc_port_parcel_read_write_int32_P) {
   int ret = rpc_port_parcel_write_int32(handle_, 123456);
   ASSERT_EQ(ret, 0);
 
@@ -143,7 +163,12 @@ TEST_F(ParcelTest, read_write_int32) {
   ASSERT_EQ(b, 123456);
 }
 
-TEST_F(ParcelTest, read_write_int64) {
+/*
+ * @testcase rpc_port_parcel_read_write_int64_P
+ * @description Writes and reads the int64 data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_int64, rpc_port_parcel_read_int64
+ */
+TEST_F(ParcelTest, rpc_port_parcel_read_write_int64_P) {
   int ret = rpc_port_parcel_write_int64(handle_, 12345678);
   ASSERT_EQ(ret, 0);
 
@@ -153,7 +178,12 @@ TEST_F(ParcelTest, read_write_int64) {
   ASSERT_EQ(b, 12345678);
 }
 
-TEST_F(ParcelTest, read_write_float) {
+/*
+ * @testcase rpc_port_parcel_read_write_float_P
+ * @description Writes and reads the float data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_float, rpc_port_parcel_read_float
+ */
+TEST_F(ParcelTest, rpc_port_parcel_read_write_float_P) {
   int ret = rpc_port_parcel_write_float(handle_, 123.456f);
   ASSERT_EQ(ret, 0);
 
@@ -163,7 +193,12 @@ TEST_F(ParcelTest, read_write_float) {
   ASSERT_EQ(b, 123.456f);
 }
 
-TEST_F(ParcelTest, read_write_double) {
+/*
+ * @testcase rpc_port_parcel_read_write_double_P
+ * @description Writes and reads the double data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_double, rpc_port_parcel_read_double
+ */
+TEST_F(ParcelTest, rpc_port_parcel_read_write_double_P) {
   int ret = rpc_port_parcel_write_double(handle_, 123.456f);
   ASSERT_EQ(ret, 0);
 
@@ -173,7 +208,12 @@ TEST_F(ParcelTest, read_write_double) {
   ASSERT_EQ(b, 123.456f);
 }
 
-TEST_F(ParcelTest, read_write_string) {
+/*
+ * @testcase rpc_port_parcel_read_write_string_P
+ * @description Writes and reads the string data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_string, rpc_port_parcel_read_string
+ */
+TEST_F(ParcelTest, rpc_port_parcel_read_write_string_P) {
   const char str[] = "abcdef";
   int ret = rpc_port_parcel_write_string(handle_, str);
   ASSERT_EQ(ret, 0);
@@ -185,7 +225,12 @@ TEST_F(ParcelTest, read_write_string) {
   ASSERT_STREQ(s1.Get(), str);
 }
 
-TEST_F(ParcelTest, read_write_bool) {
+/*
+ * @testcase rpc_port_parcel_read_write_bool_P
+ * @description Writes and reads the boolean data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_bool, rpc_port_parcel_read_bool
+ */
+TEST_F(ParcelTest, rpc_port_parcel_read_write_bool_P) {
   int ret = rpc_port_parcel_write_bool(handle_, true);
   ASSERT_EQ(ret, 0);
 
@@ -195,7 +240,12 @@ TEST_F(ParcelTest, read_write_bool) {
   ASSERT_TRUE(b);
 }
 
-TEST_F(ParcelTest, read_write_bundle) {
+/*
+ * @testcase rpc_port_parcel_read_write_bundle_P
+ * @description Writes and reads the bundle data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_bundle, rpc_port_parcel_read_bundle
+ */
+TEST_F(ParcelTest, rpc_port_parcel_read_write_bundle_P) {
   bundle* b = bundle_create();
   ASSERT_NE(b, nullptr);
 
@@ -218,7 +268,12 @@ TEST_F(ParcelTest, read_write_bundle) {
   ASSERT_STREQ("Value", str);
 }
 
-TEST_F(ParcelTest, read_write_array_count) {
+/*
+ * @testcase rpc_port_parcel_read_write_array_count_P
+ * @description Writes and reads the array count data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write_array_count, rpc_port_parcel_read_array_count
+ */
+TEST_F(ParcelTest, rpc_port_parcle_read_write_array_count_P) {
   int ret = rpc_port_parcel_write_array_count(handle_, 123);
   ASSERT_EQ(ret, 0);
 
@@ -228,7 +283,12 @@ TEST_F(ParcelTest, read_write_array_count) {
   ASSERT_EQ(c, 123);
 }
 
-TEST_F(ParcelTest, read_write) {
+/*
+ * @testcase rpc_port_parcel_read_write_P
+ * @description Writes and reads the data to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_write, rpc_port_parcel_read
+ */
+TEST_F(ParcelTest, rpc_port_parcel_read_write_P) {
   rpc_port_parcelable_t p = {
     .to = WriteParcelable,
     .from = ReadParcelable
@@ -243,7 +303,12 @@ TEST_F(ParcelTest, read_write) {
   ASSERT_TRUE(touch_from_);
 }
 
-TEST_F(ParcelTest, burst_read_write) {
+/*
+ * @testcase rpc_port_parcel_burst_read_write_P
+ * @description Writes and reads the data by burst mode to the rpc-port parcel handle
+ * @apicovered rpc_port_parcel_burst_write, rpc_port_parcel_burst_read
+ */
+TEST_F(ParcelTest, rpc_port_parcel_burst_read_write_P) {
   unsigned char buf[] = { 0, 1, 2, 3, 4 };
   int ret = rpc_port_parcel_burst_write(handle_, buf, sizeof(buf));
   ASSERT_EQ(ret, 0);
index dd2dc87..601f4c4 100644 (file)
@@ -168,6 +168,13 @@ class RpcPortConnection : public RpcPortBase {
   bool touch_proxy_received_event_cb_ = false;
 };
 
+/*
+ * @testcase rpc_port_event_connect_P
+ * @description After the rpc_port_proxy_connect() is called,
+ *              the rambda function is called by connected events.
+ * @apicovered rpc_port_stub_add_connected_event_cb, rpc_port_stub_listen,
+ *             rpc_port_proxy_add_connected_event_cb, rpc_port_proxy_connect,
+ */
 TEST_F(RpcPortBase, rpc_port_event_connect) {
   int ret = rpc_port_stub_add_connected_event_cb(stub_handle_,
       [](const char *sender, const char* instance, void *data) {
@@ -195,7 +202,14 @@ TEST_F(RpcPortBase, rpc_port_event_connect) {
   ASSERT_TRUE(touch_stub_connected_event_cb_);
 }
 
-TEST_F(RpcPortBase, rpc_port_proxy_event_reject) {
+/*
+ * @testcase rpc_port_proxy_event_reject_n
+ * @description After the rpc_port_proxy_connect() is called,
+ *              the rambda function is called by the rejected event.
+ * @apicovered rpc_port_stub_listen, rpc_port_proxy_add_connected_event_cb,
+ *             rpc_port_proxy_connect,
+ */
+TEST_F(RpcPortBase, rpc_port_proxy_event_reject_N) {
   int ret = rpc_port_stub_listen(stub_handle_);
   ASSERT_EQ(ret, 0);
 
@@ -213,7 +227,13 @@ TEST_F(RpcPortBase, rpc_port_proxy_event_reject) {
   ASSERT_TRUE(touch_proxy_rejected_event_cb_);
 }
 
-TEST_F(RpcPortConnection, rpc_port_proxy_event_receive) {
+/*
+ * @testcase rpc_port_proxy_event_receive_P
+ * @description Writes and reads the data to the port handles.
+ *              And then, checks the data in callback functions.
+ * @apicovered rpc_port_write, rpc_port_read
+ */
+TEST_F(RpcPortConnection, rpc_port_proxy_event_receive_p) {
   char res[] = "OK";
   char r_buf[256];
 
@@ -247,6 +267,11 @@ TEST_F(RpcPortConnection, rpc_port_proxy_event_receive) {
   ASSERT_STREQ(res, r_buf);
 }
 
+/*
+ * @testcase rpc_port_read_write_P
+ * @description Writes and reads the data to the port handles.
+ * @apicovered rpc_port_write, rpc_port_read
+ */
 TEST_F(RpcPortConnection, rpc_port_read_write) {
   char buf[] = "test message";
   char res[] = "OK";
@@ -271,14 +296,26 @@ TEST_F(RpcPortConnection, rpc_port_read_write) {
   ASSERT_STREQ("OK", r_buf);
 }
 
-TEST_F(RpcPortConnection, rpc_port_proxy_disconnected) {
+/*
+ * @testcase rpc_port_proxy_disconnected_N
+ * @description Kills the stub port.
+ *              And then, checks whether the disconnected event callback is invoked or not.
+ * @apicovered rpc_port_stub_add_disconnected_event_cb
+ */
+TEST_F(RpcPortConnection, rpc_port_proxy_disconnected_N) {
   KillStub();
   RunMainLoop();
 
   ASSERT_TRUE(touch_proxy_disconnected_event_cb_);
 }
 
-TEST_F(RpcPortConnection, rpc_port_stub_disconnected) {
+/*
+ * @testcase rpc_port_stub_disconnected_N
+ * @description Kills the proxy port.
+ *              And then, checks whether the disconnected event callback is invoked or not.
+ * @apicovered rpc_port_proxy_add_disconnected_event_cb
+ */
+TEST_F(RpcPortConnection, rpc_port_stub_disconnected_N) {
   KillProxy();
   RunMainLoop();