| 72 | } |
| 73 | |
| 74 | void BtHandshakeMessageTest::testCreateMessage() |
| 75 | { |
| 76 | constexpr unsigned char infoHash[] = { |
| 77 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| 78 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 79 | constexpr unsigned char peerId[] = {0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, |
| 80 | 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, |
| 81 | 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0}; |
| 82 | |
| 83 | auto msg = std::make_shared<BtHandshakeMessage>(); |
| 84 | msg->setInfoHash(infoHash); |
| 85 | msg->setPeerId(peerId); |
| 86 | |
| 87 | unsigned char data[68]; |
| 88 | createHandshakeMessageData(data); |
| 89 | auto rawmsg = msg->createMessage(); |
| 90 | CPPUNIT_ASSERT_EQUAL((size_t)68, rawmsg.size()); |
| 91 | CPPUNIT_ASSERT_EQUAL(util::toHex((const unsigned char*)data, 68), |
| 92 | util::toHex(rawmsg.data(), 68)); |
| 93 | } |
| 94 | |
| 95 | void BtHandshakeMessageTest::testToString() |
| 96 | { |
nothing calls this directly
no test coverage detected