| 141 | } |
| 142 | |
| 143 | void 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 | |
| 159 | void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmNotChoking() |
| 160 | { |
nothing calls this directly
no test coverage detected