+
+TEST_F(ParcelCppTest, GetData) {
+ uint8_t* data = GetHandle().GetData();
+ ASSERT_NE(data, nullptr);
+}
+
+TEST_F(ParcelCppTest, GetDataSize) {
+ GetHandle().WriteInt32(1);
+ ASSERT_EQ(GetHandle().GetDataSize(), sizeof(int32_t));
+ GetHandle().WriteInt32(2);
+ ASSERT_EQ(GetHandle().GetDataSize(), sizeof(int32_t) + sizeof(int32_t));
+}
+
+TEST_F(ParcelCppTest, GetDataCapacity) {
+ size_t size = GetHandle().GetDataCapacity();
+ ASSERT_NE(size, 0);
+}
+
+TEST_F(ParcelCppTest, SetDataCapacity) {
+ GetHandle().SetDataCapacity(128);
+ size_t size = GetHandle().GetDataCapacity();
+ ASSERT_EQ(size, 128);
+}
+
+TEST_F(ParcelCppTest, Detach) {
+ GetHandle().WriteInt32(1);
+ size_t data_size = 0;
+ uint8_t* data = GetHandle().Detach(&data_size);
+ std::unique_ptr<uint8_t, decltype(std::free)*> data_auto(data, std::free);
+ ASSERT_NE(data, nullptr);
+ ASSERT_EQ(data_size, sizeof(int32_t));
+}
+
+TEST_F(ParcelCppTest, GetReader) {
+ GetHandle().WriteInt32(1);
+ GetHandle().WriteString("GetReader");
+ int32_t value = 0;
+ GetHandle().ReadInt32(&value);
+ uint32_t reader = GetHandle().GetReader();
+ ASSERT_EQ(reader, sizeof(int32_t));
+}
+
+TEST_F(ParcelCppTest, ToRaw) {
+ GetHandle().WriteInt32(0);
+ auto raw = GetHandle().ToRaw();
+ ASSERT_EQ(raw.size(), sizeof(int32_t));
+}