22 #include <gtest/gtest.h> 30 const char data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
31 SourceBuffer = std::vector<char>(data, data +
sizeof(data));
55 std::vector<char> targetBuf{9, 8, 7};
56 std::vector<char> expectedBuf{9, 8, 7};
57 const size_t sizeToRead = 0;
59 ASSERT_EQ(input.Receive(&targetBuf[0], sizeToRead), 0);
67 std::vector<char> targetBuf{9, 8, 7};
68 const std::vector<char> expectedBuf{0, 1, 2};
69 size_t revceivedSize = 0;
79 const std::vector<char> expectedBuf{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11};
80 std::vector<char> targetBuf(11, 11);
81 size_t revceivedSize = 0;
82 ASSERT_NO_THROW(revceivedSize = input.Receive(&targetBuf[0], targetBuf.size()));
90 size_t revceivedSize = 0;
93 std::vector<char> targetBuf1(3, 11);
94 ASSERT_NO_THROW(revceivedSize = input.Receive(&targetBuf1[0], targetBuf1.size()));
96 const std::vector<char> expectedBuf1{0, 1, 2};
101 std::vector<char> targetBuf2(3, 11);
102 ASSERT_NO_THROW(revceivedSize = input.Receive(&targetBuf2[0], targetBuf2.size()));
104 const std::vector<char> expectedBuf2{3, 4, 5};
108 std::vector<char> targetBuf3(3, 11);
109 ASSERT_NO_THROW(revceivedSize = input.Receive(&targetBuf3[0], targetBuf3.size()));
111 const std::vector<char> expectedBuf3{6, 7, 8};
115 std::vector<char> targetBuf4(3, 11);
116 ASSERT_NO_THROW(revceivedSize = input.Receive(&targetBuf4[0], targetBuf4.size()));
118 const std::vector<char> expectedBuf4{9, 11, 11};
122 std::vector<char> targetBuf5(3, 11);
123 ASSERT_NO_THROW(revceivedSize = input.Receive(&targetBuf5[0], targetBuf5.size()));
125 const std::vector<char> expectedBuf5{11, 11, 11};
#define ASSERT_THROW(statement, expected_exception)
#define ASSERT_NO_THROW(statement)
#define ASSERT_EQ(val1, val2)