split up test_tracker unit tests

This commit is contained in:
arvidn 2015-09-08 23:47:36 -04:00
parent abe994c191
commit 9f4cfb6ac3
1 changed files with 31 additions and 31 deletions

View File

@ -273,41 +273,41 @@ peer_entry extract_peer(char const* peer_field, error_code expected_ec, bool exp
TORRENT_TEST(extract_peer) TORRENT_TEST(extract_peer)
{ {
{
peer_entry result = extract_peer("d7:peer id20:abababababababababab2:ip4:abcd4:porti1337ee" peer_entry result = extract_peer("d7:peer id20:abababababababababab2:ip4:abcd4:porti1337ee"
, error_code(), true); , error_code(), true);
TEST_EQUAL(result.hostname, "abcd"); TEST_EQUAL(result.hostname, "abcd");
TEST_EQUAL(result.pid, peer_id("abababababababababab")); TEST_EQUAL(result.pid, peer_id("abababababababababab"));
TEST_EQUAL(result.port, 1337); TEST_EQUAL(result.port, 1337);
}
} TORRENT_TEST(extract_peer_hostname)
{
{
peer_entry result = extract_peer("d2:ip11:example.com4:porti1ee" peer_entry result = extract_peer("d2:ip11:example.com4:porti1ee"
, error_code(), true); , error_code(), true);
TEST_EQUAL(result.hostname, "example.com"); TEST_EQUAL(result.hostname, "example.com");
TEST_EQUAL(result.pid, (peer_id::min)()); TEST_EQUAL(result.pid, (peer_id::min)());
TEST_EQUAL(result.port, 1); TEST_EQUAL(result.port, 1);
}
} TORRENT_TEST(extract_peer_not_a_dictionary)
{
{
// not a dictionary // not a dictionary
peer_entry result = extract_peer("2:ip11:example.com" peer_entry result = extract_peer("2:ip11:example.com"
, error_code(errors::invalid_peer_dict, get_libtorrent_category()), false); , error_code(errors::invalid_peer_dict, get_libtorrent_category()), false);
} }
{ TORRENT_TEST(extract_peer_missing_ip)
{
// missing IP // missing IP
peer_entry result = extract_peer("d7:peer id20:abababababababababab4:porti1337ee" peer_entry result = extract_peer("d7:peer id20:abababababababababab4:porti1337ee"
, error_code(errors::invalid_tracker_response, get_libtorrent_category()), false); , error_code(errors::invalid_tracker_response, get_libtorrent_category()), false);
} }
{ TORRENT_TEST(extract_peer_missing_port)
{
// missing port // missing port
peer_entry result = extract_peer("d7:peer id20:abababababababababab2:ip4:abcde" peer_entry result = extract_peer("d7:peer id20:abababababababababab2:ip4:abcde"
, error_code(errors::invalid_tracker_response, get_libtorrent_category()), false); , error_code(errors::invalid_tracker_response, get_libtorrent_category()), false);
}
} }
TORRENT_TEST(udp_tracker) TORRENT_TEST(udp_tracker)