| Index: test/CommunicationTest.cpp |
| diff --git a/test/CommunicationTest.cpp b/test/CommunicationTest.cpp |
| index 2cb62e8b4882cf8219bd3d1146927f1f0d9cd001..fb9d4c34f35220fdaab146f480a15be2e9fff40d 100644 |
| --- a/test/CommunicationTest.cpp |
| +++ b/test/CommunicationTest.cpp |
| @@ -112,3 +112,39 @@ TEST(CommunicationTest, SendReceive) |
| ASSERT_EQ(7, int32Value); |
| ASSERT_FALSE(boolValue); |
| } |
| + |
| +void SendReceiveStrings(const std::vector<std::string>& src) |
| +{ |
| + Communication::OutputBuffer outputBuffer; |
| + outputBuffer << src; |
| + Communication::InputBuffer inputBuffer(outputBuffer.Get()); |
|
Eric
2015/02/17 17:18:35
I don't like the use of Get() here, but I'll save
|
| + std::vector<std::string> dst; |
| + inputBuffer >> dst; |
| + auto dstSize = dst.size(); |
| + ASSERT_EQ(dstSize, src.size()); |
| + for (auto i = 0; i < dstSize; ++i) |
| + { |
| + EXPECT_EQ(dst[i], src[i]); |
| + } |
| +} |
| + |
| +TEST(InputOutputBuffersTests, EmptyStrings) |
| +{ |
| + SendReceiveStrings(std::vector<std::string>()); |
| +} |
| + |
| +TEST(InputOutputBuffersTests, StringsWithOneValue) |
| +{ |
| + std::vector<std::string> src; |
| + src.emplace_back("string1"); |
| + SendReceiveStrings(src); |
| +} |
| + |
| +TEST(InputOutputBuffersTests, MultivalueStrings) |
| +{ |
| + std::vector<std::string> src; |
| + src.emplace_back("string1"); |
| + src.emplace_back("str2"); |
| + src.emplace_back("value"); |
| + SendReceiveStrings(src); |
| +} |