| 185 | } |
| 186 | |
| 187 | void ChannelLinter::TestChannelOrder(MockDeviceBridge& channel, MockDeviceBridge& complementary) |
| 188 | { |
| 189 | constexpr auto numberOfTests = 10; |
| 190 | constexpr auto packetSize = 64; |
| 191 | std::vector<ByteVector> sent; |
| 192 | |
| 193 | std::cout << "Testing channel order with " << numberOfTests << " packets of " << packetSize << " bytes of data ... " << std::flush; |
| 194 | |
| 195 | for (auto i = 0; i < numberOfTests; ++i) |
| 196 | { |
| 197 | sent.push_back(FSecure::Utils::GenerateRandomData(packetSize)); |
| 198 | channel.Send(sent[i]); |
| 199 | } |
| 200 | |
| 201 | auto received = complementary.Receive(sent.size()); |
| 202 | received.resize(sent.size()); |
| 203 | |
| 204 | if (sent != received) |
| 205 | throw std::exception("Data sent and received mismatch"); |
| 206 | |
| 207 | std::cout << "OK" << std::endl; |
| 208 | } |
| 209 | |
| 210 | |
| 211 | bool ChannelLinter::TestOverlapped(MockDeviceBridge& channel, MockDeviceBridge& complementary, ByteView data) |