#include #include template void check_size(size_t size) { T v(0); msgpack::sbuffer sbuf; msgpack::pack(sbuf, v); EXPECT_EQ(size, sbuf.size()); } TEST(fixint, size) { check_size(2); check_size(3); check_size(5); check_size(9); check_size(2); check_size(3); check_size(5); check_size(9); } template void check_convert() { T v1(-11); msgpack::sbuffer sbuf; msgpack::pack(sbuf, v1); msgpack::unpacked msg; msgpack::unpack(&msg, sbuf.data(), sbuf.size()); T v2; msg.get().convert(&v2); EXPECT_EQ(v1.get(), v2.get()); EXPECT_EQ(msg.get(), msgpack::object(T(v1.get()))); } TEST(fixint, convert) { check_convert(); check_convert(); check_convert(); check_convert(); check_convert(); check_convert(); check_convert(); check_convert(); }