MCPcopy Create free account
hub / github.com/aria2/aria2 / testCreateMessage

Method testCreateMessage

test/BtCancelMessageTest.cc:87–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87void BtCancelMessageTest::testCreateMessage()
88{
89 BtCancelMessage msg;
90 msg.setIndex(12345);
91 msg.setBegin(256);
92 msg.setLength(1_k);
93 unsigned char data[17];
94 bittorrent::createPeerMessageString(data, sizeof(data), 13, 8);
95 bittorrent::setIntParam(&data[5], 12345);
96 bittorrent::setIntParam(&data[9], 256);
97 bittorrent::setIntParam(&data[13], 1_k);
98 auto rawmsg = msg.createMessage();
99 CPPUNIT_ASSERT_EQUAL((size_t)17, rawmsg.size());
100 CPPUNIT_ASSERT(std::equal(std::begin(rawmsg), std::end(rawmsg), data));
101}
102
103void BtCancelMessageTest::testDoReceivedAction()
104{

Callers

nothing calls this directly

Calls 7

createPeerMessageStringFunction · 0.85
setIntParamFunction · 0.85
setIndexMethod · 0.45
setBeginMethod · 0.45
setLengthMethod · 0.45
createMessageMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected