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

Method testCreateMessage

test/BtRejectMessageTest.cc:121–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121void BtRejectMessageTest::testCreateMessage()
122{
123 BtRejectMessage msg;
124 msg.setIndex(12345);
125 msg.setBegin(256);
126 msg.setLength(1_k);
127 unsigned char data[17];
128 bittorrent::createPeerMessageString(data, sizeof(data), 13, 16);
129 bittorrent::setIntParam(&data[5], 12345);
130 bittorrent::setIntParam(&data[9], 256);
131 bittorrent::setIntParam(&data[13], 1_k);
132 auto rawmsg = msg.createMessage();
133 CPPUNIT_ASSERT_EQUAL((size_t)17, rawmsg.size());
134 CPPUNIT_ASSERT(std::equal(std::begin(rawmsg), std::end(rawmsg), data));
135}
136
137void BtRejectMessageTest::testDoReceivedAction()
138{

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