mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-23 16:48:07 +02:00
Restored the test cases using pointer based interfaces.
It assures that we can use the same interfaces as the original version(0.5.6). To support both C++03 and C++11, I introduced msgpack::unique_ptr and msgpack::move() in test codes.
This commit is contained in:
@@ -31,7 +31,7 @@ void test_map_pack_unpack() {
|
||||
std::cout << "Start unpacking..." << std::endl;
|
||||
{
|
||||
boost::timer::cpu_timer timer;
|
||||
msgpack::unpack(str.data(), str.size(), NULL, mempool, deserialized);
|
||||
msgpack::unpack(str.data(), str.size(), NULL, &mempool, &deserialized);
|
||||
std::string result = timer.format();
|
||||
std::cout << result << std::endl;
|
||||
}
|
||||
@@ -41,11 +41,20 @@ void test_map_pack_unpack() {
|
||||
std::cout << "Start unpacking...by void unpack(unpacked* result, const char* data, size_t len, size_t* offset = NULL)" << std::endl;
|
||||
{
|
||||
boost::timer::cpu_timer timer;
|
||||
msgpack::unpack(unpacked, str.data(), str.size());
|
||||
msgpack::unpack(&unpacked, str.data(), str.size());
|
||||
std::string result = timer.format();
|
||||
std::cout << result << std::endl;
|
||||
}
|
||||
std::cout << "Unpack finished..." << std::endl;
|
||||
std::map<int, int> m2;
|
||||
std::cout << "Start converting..." << std::endl;
|
||||
{
|
||||
boost::timer::cpu_timer timer;
|
||||
deserialized.convert(&m2);
|
||||
std::string result = timer.format();
|
||||
std::cout << result << std::endl;
|
||||
}
|
||||
std::cout << "Convert finished..." << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user