| 151 | } |
| 152 | |
| 153 | void ChannelLinter::TestEcho(MockDeviceBridge& channel, MockDeviceBridge& complementary) |
| 154 | { |
| 155 | size_t packetLen = 8; |
| 156 | std::cout << "Testing channel echo with " << packetLen << " bytes of data ... " << std::flush; |
| 157 | auto data = ByteVector(FSecure::Utils::GenerateRandomData(packetLen)); |
| 158 | if (channel.GetDevice()->OnSendToChannelInternal(data) != data.size()) |
| 159 | throw std::runtime_error{ "Failed to send echo packet" }; |
| 160 | auto echo = std::static_pointer_cast<FSecure::C3::AbstractChannel>(channel.GetDevice())->OnReceiveFromChannelInternal(); |
| 161 | if (!echo.empty()) |
| 162 | throw std::runtime_error{ "Channel read it's own message" }; |
| 163 | |
| 164 | // clean channel |
| 165 | auto received = std::static_pointer_cast<FSecure::C3::AbstractChannel>(complementary.GetDevice())->OnReceiveFromChannelInternal(); |
| 166 | if (received.empty() || received.size() > 1 || received[0] != data) |
| 167 | throw std::runtime_error{ "Receive error" }; |
| 168 | |
| 169 | std::cout << "OK" << std::endl; |
| 170 | } |
| 171 | |
| 172 | void ChannelLinter::TestChannelMTU(MockDeviceBridge& channel, MockDeviceBridge& complementary, bool overlapped) |
| 173 | { |
nothing calls this directly
no test coverage detected