Added support for std::map/std::unordered_map to fr::Packet

This commit is contained in:
Fred Nicolson
2018-06-22 09:22:27 +01:00
parent 20a3bd97d8
commit 4dec5318f7
2 changed files with 102 additions and 0 deletions
+20
View File
@@ -66,6 +66,26 @@ TEST(PacketTest, pack_and_unpack_stl)
ASSERT_EQ(c1, c2);
}
TEST(PacketTest, pack_and_unpack_map)
{
std::map<std::string, std::string> base = {{"a", "b"}, {"bob", "lob"}};
std::map<std::string, std::string> copy;
fr::Packet packet;
packet << base;
packet >> copy;
ASSERT_EQ(base, copy);
}
TEST(PacketTest, pack_and_unpack_unordered_map)
{
std::unordered_map<std::string, std::string> base = {{"a", "b"}, {"bob", "lob"}};
std::unordered_map<std::string, std::string> copy;
fr::Packet packet;
packet << base;
packet >> copy;
ASSERT_EQ(base, copy);
}
TEST(PacketTest, variadic_packet_constructor)
{
int a1 = 10, a2;