unittest polishing

This commit is contained in:
Arvid Norberg 2013-10-14 07:09:57 +00:00
parent bb72af6bbe
commit e515dd5c25
3 changed files with 15 additions and 8 deletions

View File

@ -95,7 +95,7 @@ void test_swarm()
boost::tie(tor1, tor2, tor3) = setup_transfer(&ses1, &ses2, &ses3, true, false, true, "_unchoke");
session_status st = ses1.status();
TEST_CHECK(st.allowed_upload_slots == 1);
TEST_EQUAL(st.allowed_upload_slots, 1);
for (int i = 0; i < 100; ++i)
{
print_alerts(ses1, "ses1");

View File

@ -106,7 +106,7 @@ void test_transfer(int flags
TEST_CHECK(tor2.status().has_metadata);
std::cerr << "waiting for transfer to complete\n";
for (int i = 0; i < 20; ++i)
for (int i = 0; i < timeout * 10; ++i)
{
torrent_status st1 = tor1.status();
torrent_status st2 = tor2.status();
@ -137,11 +137,18 @@ int test_main()
{
using namespace libtorrent;
for (int f = 0; f <= (clear_files | disconnect | full_encryption); ++f)
test_transfer(f, &create_metadata_plugin, 5);
#ifdef TORRENT_USE_VALGRIND
const int timeout = 8;
#else
const int timeout = 3;
#endif
for (int f = 0; f <= (clear_files | disconnect | full_encryption); ++f)
test_transfer(f, &create_ut_metadata_plugin, 2);
test_transfer(f, &create_metadata_plugin, timeout * 2);
for (int f = 0; f <= (clear_files | disconnect | full_encryption); ++f)
test_transfer(f, &create_ut_metadata_plugin, timeout);
error_code ec;
remove_all("tmp1", ec);

View File

@ -285,12 +285,12 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe
for (int i = 0; i < 200; ++i)
{
print_alerts(ses1, "ses1", true, true, true, &on_alert);
print_alerts(ses2, "ses2", true, true, true, &on_alert);
torrent_status st1 = tor1.status();
torrent_status st2 = tor2.status();
print_alerts(ses1, "ses1", true, true, true, &on_alert);
print_alerts(ses2, "ses2", true, true, true, &on_alert);
if (i % 10 == 0)
{
print_ses_rate(i / 10.f, &st1, &st2);