MCPcopy Create free account
hub / github.com/ReversecLabs/C3 / TestChannelOrder

Method TestChannelOrder

Src/ChannelLinter/ChannelLinter.cpp:187–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 7

GenerateRandomDataFunction · 0.85
resizeMethod · 0.80
exceptionClass · 0.50
push_backMethod · 0.45
SendMethod · 0.45
ReceiveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected