Rewritten ExtensionMessageRegistry

This commit is contained in:
Tatsuhiro Tsujikawa 2012-09-26 22:02:48 +09:00
parent f0000a8754
commit c13dc166de
20 changed files with 321 additions and 143 deletions

View file

@ -137,12 +137,17 @@ void PeerSessionResourceTest::testGetExtensionMessageID()
{
PeerSessionResource res(1024, 1024*1024);
res.addExtension("a2", 9);
CPPUNIT_ASSERT_EQUAL((uint8_t)9, res.getExtensionMessageID("a2"));
CPPUNIT_ASSERT_EQUAL((uint8_t)0, res.getExtensionMessageID("non"));
res.addExtension(ExtensionMessageRegistry::UT_PEX, 9);
CPPUNIT_ASSERT_EQUAL((uint8_t)9,
res.getExtensionMessageID
(ExtensionMessageRegistry::UT_PEX));
CPPUNIT_ASSERT_EQUAL((uint8_t)0,
res.getExtensionMessageID
(ExtensionMessageRegistry::UT_METADATA));
CPPUNIT_ASSERT_EQUAL(std::string("a2"), res.getExtensionName(9));
CPPUNIT_ASSERT_EQUAL(std::string(""), res.getExtensionName(10));
CPPUNIT_ASSERT_EQUAL(std::string("ut_pex"),
std::string(res.getExtensionName(9)));
CPPUNIT_ASSERT(!res.getExtensionName(10));
}
void PeerSessionResourceTest::testFastExtensionEnabled()