From 09f29217ee2f1ce548b3e1f6f8c76c0e462c1fe7 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 1 Aug 2013 04:58:43 +0000 Subject: [PATCH] test fixes --- test/test_primitives.cpp | 25 ++++++++++--------------- test/test_storage.cpp | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/test/test_primitives.cpp b/test/test_primitives.cpp index 56dbffb8b..85909a448 100644 --- a/test/test_primitives.cpp +++ b/test/test_primitives.cpp @@ -61,6 +61,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "test.hpp" #include "setup_transfer.hpp" @@ -831,21 +832,15 @@ int test_main() std::vector trackers = t.trackers(); TEST_EQUAL(trackers.size(), 3); - if (trackers.size() > 0) - { - TEST_EQUAL(trackers[0].url, "http://1"); - fprintf(stderr, "1: %s\n", trackers[0].url.c_str()); - } - if (trackers.size() > 1) - { - TEST_EQUAL(trackers[1].url, "http://2"); - fprintf(stderr, "2: %s\n", trackers[1].url.c_str()); - } - if (trackers.size() > 2) - { - TEST_EQUAL(trackers[2].url, "http://3"); - fprintf(stderr, "3: %s\n", trackers[2].url.c_str()); - } + std::set trackers_set; + for (std::vector::iterator i = trackers.begin() + , end(trackers.end()); i != end; ++i) + trackers_set.insert(i->url); + + + TEST_CHECK(trackers_set.count("http://1") == 1); + TEST_CHECK(trackers_set.count("http://2") == 1); + TEST_CHECK(trackers_set.count("http://3") == 1); p.url = "magnet:" "?tr=http://1" diff --git a/test/test_storage.cpp b/test/test_storage.cpp index b7c714017..93fa14a5e 100644 --- a/test/test_storage.cpp +++ b/test/test_storage.cpp @@ -440,7 +440,7 @@ void run_until(io_service& ios, bool const& done) ios.run_one(ec); if (ec) { - std::cerr << "run_one: " << ec.message() << std::endl; + std::cerr << "run_one: " << ec.message().c_str() << std::endl; return; } std::cerr << time_now_string() << " done: " << done << std::endl;