add test vector from bep40 to test_peer_priority

This commit is contained in:
Arvid Norberg 2014-03-26 16:09:31 +00:00
parent 140ed20c93
commit 09bc76d8ae
1 changed files with 11 additions and 0 deletions

View File

@ -75,6 +75,17 @@ int test_main()
, tcp::endpoint(address::from_string("230.12.123.3"), 0x12c));
TEST_EQUAL(p, hash_buffer("\xe6\x0c\x51\x01\xe6\x78\x15\x01", 8));
// test vectors from BEP 40
TEST_EQUAL(peer_priority(
tcp::endpoint(address::from_string("123.213.32.10"), 0)
, tcp::endpoint(address::from_string("98.76.54.32"), 0))
, 0xec2d7224);
TEST_EQUAL(peer_priority(
tcp::endpoint(address::from_string("123.213.32.10"), 0)
, tcp::endpoint(address::from_string("123.213.32.234"), 0))
, 0x99568189);
if (supports_ipv6())
{
// IPv6 has a twice as wide mask, and we only care about the top 64 bits