refactor the DHT test (#921)

refactor the DHT test. enable some tests on windows
This commit is contained in:
Arvid Norberg 2016-07-20 07:53:33 -07:00 committed by GitHub
parent 47d7c92fd4
commit 12cb3cc60e
4 changed files with 1043 additions and 854 deletions

View File

@ -131,8 +131,6 @@ test-suite libtorrent :
test_xml.cpp
test_ip_filter.cpp
test_hasher.cpp
test_dht_storage.cpp
test_dht.cpp
test_block_cache.cpp
test_peer_classes.cpp
test_settings_pack.cpp
@ -143,6 +141,10 @@ test-suite libtorrent :
test_linked_list.cpp
test_file_progress.cpp ]
[ run test_dht.cpp
test_dht_storage.cpp
]
[ run test_string.cpp
test_utf8.cpp
]
@ -199,6 +201,10 @@ test-suite libtorrent :
# transitioned into simulations
alias win-tests :
test_primitives
test_dht
test_sha1_hash
test_bitfield
test_crc32
test_pe_crypto
test_remap_files
test_auto_unchoke

View File

@ -322,7 +322,7 @@ EXPORT int main(int argc, char const* argv[])
if (_g_num_unit_tests == 0)
{
std::fprintf(stderr, "\x1b[31mERROR: no unit tests registered\x1b[0m\n");
std::fprintf(stderr, "\x1b[31mTEST_ERROR: no unit tests registered\x1b[0m\n");
return 1;
}
@ -387,7 +387,7 @@ EXPORT int main(int argc, char const* argv[])
catch (boost::system::system_error const& e)
{
char buf[200];
std::snprintf(buf, sizeof(buf), "Terminated with system_error: (%d) [%s] \"%s\""
std::snprintf(buf, sizeof(buf), "TEST_ERROR: Terminated with system_error: (%d) [%s] \"%s\""
, e.code().value()
, e.code().category().name()
, e.code().message().c_str());
@ -396,12 +396,12 @@ EXPORT int main(int argc, char const* argv[])
catch (std::exception const& e)
{
char buf[200];
std::snprintf(buf, sizeof(buf), "Terminated with exception: \"%s\"", e.what());
std::snprintf(buf, sizeof(buf), "TEST_ERROR: Terminated with exception: \"%s\"", e.what());
report_failure(buf, __FILE__, __LINE__);
}
catch (...)
{
report_failure("Terminated with unknown exception", __FILE__, __LINE__);
report_failure("TEST_ERROR: Terminated with unknown exception", __FILE__, __LINE__);
}
#endif
@ -441,7 +441,7 @@ EXPORT int main(int argc, char const* argv[])
if (num_run == 0)
{
std::fprintf(stderr, "\x1b[31mERROR: no unit tests run\x1b[0m\n");
std::fprintf(stderr, "\x1b[31mTEST_ERROR: no unit tests run\x1b[0m\n");
return 1;
}

View File

@ -213,7 +213,7 @@ TORRENT_TEST(test_assign2)
TORRENT_TEST(test_resize_val)
{
std::array<char, 8> b;
b.fill(0xcc);
b.fill(-52);
bitfield test1(b.data(), 8 * 8);
print_bitfield(test1);
@ -231,7 +231,7 @@ TORRENT_TEST(test_resize_val)
TORRENT_TEST(test_resize_up)
{
std::array<char, 8> b;
b.fill(0xcc);
b.fill(-52);
bitfield test1(b.data(), 8 * 8);
print_bitfield(test1);

File diff suppressed because it is too large Load Diff