Index: test/CommunicationTest.cpp |
diff --git a/test/CommunicationTest.cpp b/test/CommunicationTest.cpp |
index 2cb62e8b4882cf8219bd3d1146927f1f0d9cd001..368cf000f0cc041a04ad1ecc83e8366200bad7ae 100644 |
--- a/test/CommunicationTest.cpp |
+++ b/test/CommunicationTest.cpp |
@@ -112,3 +112,44 @@ TEST(CommunicationTest, SendReceive) |
ASSERT_EQ(7, int32Value); |
ASSERT_FALSE(boolValue); |
} |
+ |
+TEST(InputOutputBuffersTests, EmptyVector) |
+{ |
+ std::vector<std::string> emptySrcVector; |
+ Communication::OutputBuffer outputBuffer; |
Eric
2015/01/13 16:20:45
The core of these tests is the same code. It would
|
+ outputBuffer << emptySrcVector; |
+ Communication::InputBuffer inputBuffer(outputBuffer.Get()); |
+ std::vector<std::string> dstVector; |
+ inputBuffer >> dstVector; |
+ EXPECT_TRUE(dstVector.empty()); |
+} |
+ |
+TEST(InputOutputBuffersTests, NonemptyVectors) |
Eric
2015/01/13 16:20:45
I'd make this two tests.
|
+{ |
+ { |
+ std::vector<std::string> srcVector; |
+ srcVector.emplace_back("string1"); |
+ Communication::OutputBuffer outputBuffer; |
+ outputBuffer << srcVector; |
+ Communication::InputBuffer inputBuffer(outputBuffer.Get()); |
+ std::vector<std::string> dstVector; |
+ inputBuffer >> dstVector; |
+ ASSERT_EQ(1, dstVector.size()); |
+ EXPECT_EQ("string1", dstVector[0]); |
+ } |
+ { |
+ std::vector<std::string> srcVector; |
+ srcVector.emplace_back("string1"); |
+ srcVector.emplace_back("str2"); |
+ srcVector.emplace_back("value"); |
+ Communication::OutputBuffer outputBuffer; |
+ outputBuffer << srcVector; |
+ Communication::InputBuffer inputBuffer(outputBuffer.Get()); |
+ std::vector<std::string> dstVector; |
+ inputBuffer >> dstVector; |
+ ASSERT_EQ(3, dstVector.size()); |
+ EXPECT_EQ("string1", dstVector[0]); |
+ EXPECT_EQ("str2", dstVector[1]); |
+ EXPECT_EQ("value", dstVector[2]); |
+ } |
+} |