mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-14 15:05:37 +02:00
Replaced msgpack::unpacked with msgpack::object_handle.
msgpack::unpacked is a typedef of the msgpack::object_handle. I recommend using msgpack::object_handle. It can be used not only holding unpacked msgpack objects but also msgpack::objects that are created by any types. Replaced unpack() APIs in test codes and examples. They used to use old APIs.
This commit is contained in:
@@ -20,12 +20,12 @@ TEST(MSGPACK_ARRAY_REF, pack_unpack_convert_vector_char)
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, ar1);
|
||||
|
||||
msgpack::unpacked upd;
|
||||
msgpack::unpack(upd, ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(upd.get().type, msgpack::type::ARRAY);
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(oh.get().type, msgpack::type::ARRAY);
|
||||
std::vector<char> v2;
|
||||
msgpack::type::array_ref<std::vector<char> > ar2(v2);
|
||||
upd.get().convert(ar2);
|
||||
oh.get().convert(ar2);
|
||||
EXPECT_TRUE(ar1 == ar2);
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ TEST(MSGPACK_ARRAY_REF, pack_unpack_convert_vector_char_const)
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, ar1);
|
||||
|
||||
msgpack::unpacked upd;
|
||||
msgpack::unpack(upd, ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(upd.get().type, msgpack::type::ARRAY);
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(oh.get().type, msgpack::type::ARRAY);
|
||||
std::vector<char> v2;
|
||||
msgpack::type::array_ref<std::vector<char> > ar2(v2);
|
||||
upd.get().convert(ar2);
|
||||
oh.get().convert(ar2);
|
||||
EXPECT_TRUE(ar1 == ar2);
|
||||
}
|
||||
|
||||
@@ -62,12 +62,12 @@ TEST(MSGPACK_ARRAY_REF, pack_unpack_convert_vector_unsigned_char)
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, ar1);
|
||||
|
||||
msgpack::unpacked upd;
|
||||
msgpack::unpack(upd, ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(upd.get().type, msgpack::type::ARRAY);
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(oh.get().type, msgpack::type::ARRAY);
|
||||
std::vector<unsigned char> v2;
|
||||
msgpack::type::array_ref<std::vector<unsigned char> > ar2(v2);
|
||||
upd.get().convert(ar2);
|
||||
oh.get().convert(ar2);
|
||||
EXPECT_TRUE(ar1 == ar2);
|
||||
}
|
||||
|
||||
@@ -84,12 +84,12 @@ TEST(MSGPACK_ARRAY_REF, pack_unpack_convert_vector_unsigned_char_const)
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, ar1);
|
||||
|
||||
msgpack::unpacked upd;
|
||||
msgpack::unpack(upd, ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(upd.get().type, msgpack::type::ARRAY);
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(oh.get().type, msgpack::type::ARRAY);
|
||||
std::vector<unsigned char> v2;
|
||||
msgpack::type::array_ref<std::vector<unsigned char> > ar2(v2);
|
||||
upd.get().convert(ar2);
|
||||
oh.get().convert(ar2);
|
||||
EXPECT_TRUE(ar1 == ar2);
|
||||
}
|
||||
|
||||
@@ -179,12 +179,12 @@ TEST(MSGPACK_ARRAY_REF, pack_unpack_convert_array_char)
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, ar1);
|
||||
|
||||
msgpack::unpacked upd;
|
||||
msgpack::unpack(upd, ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(upd.get().type, msgpack::type::ARRAY);
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(oh.get().type, msgpack::type::ARRAY);
|
||||
std::array<char, 3> v2;
|
||||
msgpack::type::array_ref<std::array<char, 3> > ar2(v2);
|
||||
upd.get().convert(ar2);
|
||||
oh.get().convert(ar2);
|
||||
EXPECT_TRUE(ar1 == ar2);
|
||||
}
|
||||
|
||||
@@ -198,12 +198,12 @@ TEST(MSGPACK_ARRAY_REF, pack_unpack_convert_array_char_const)
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, ar1);
|
||||
|
||||
msgpack::unpacked upd;
|
||||
msgpack::unpack(upd, ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(upd.get().type, msgpack::type::ARRAY);
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(oh.get().type, msgpack::type::ARRAY);
|
||||
std::array<char, 3> v2;
|
||||
msgpack::type::array_ref<std::array<char, 3> > ar2(v2);
|
||||
upd.get().convert(ar2);
|
||||
oh.get().convert(ar2);
|
||||
EXPECT_TRUE(ar1 == ar2);
|
||||
}
|
||||
|
||||
@@ -215,12 +215,12 @@ TEST(MSGPACK_ARRAY_REF, pack_unpack_convert_array_unsigned_char)
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, ar1);
|
||||
|
||||
msgpack::unpacked upd;
|
||||
msgpack::unpack(upd, ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(upd.get().type, msgpack::type::ARRAY);
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(oh.get().type, msgpack::type::ARRAY);
|
||||
std::array<unsigned char, 3> v2;
|
||||
msgpack::type::array_ref<std::array<unsigned char, 3> > ar2(v2);
|
||||
upd.get().convert(ar2);
|
||||
oh.get().convert(ar2);
|
||||
EXPECT_TRUE(ar1 == ar2);
|
||||
}
|
||||
|
||||
@@ -234,12 +234,12 @@ TEST(MSGPACK_ARRAY_REF, pack_unpack_convert_array_unsigned_char_const)
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, ar1);
|
||||
|
||||
msgpack::unpacked upd;
|
||||
msgpack::unpack(upd, ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(upd.get().type, msgpack::type::ARRAY);
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
EXPECT_EQ(oh.get().type, msgpack::type::ARRAY);
|
||||
std::array<unsigned char, 3> v2;
|
||||
msgpack::type::array_ref<std::array<unsigned char, 3> > ar2(v2);
|
||||
upd.get().convert(ar2);
|
||||
oh.get().convert(ar2);
|
||||
EXPECT_TRUE(ar1 == ar2);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user