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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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
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);
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) {
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);
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];
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";
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();