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

Method testCreateMessage

test/BtRequestMessageTest.cc:143–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143void BtRequestMessageTest::testCreateMessage()
144{
145 BtRequestMessage msg;
146 msg.setIndex(12345);
147 msg.setBegin(256);
148 msg.setLength(1_k);
149 unsigned char data[17];
150 bittorrent::createPeerMessageString(data, sizeof(data), 13, 6);
151 bittorrent::setIntParam(&data[5], 12345);
152 bittorrent::setIntParam(&data[9], 256);
153 bittorrent::setIntParam(&data[13], 1_k);
154 auto rawmsg = msg.createMessage();
155 CPPUNIT_ASSERT_EQUAL((size_t)17, rawmsg.size());
156 CPPUNIT_ASSERT(std::equal(std::begin(rawmsg), std::end(rawmsg), data));
157}
158
159void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmNotChoking()
160{

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