From c8b38dcacdee2d81e854b3270a4ac6af05110562 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 1 Mar 2014 09:04:23 +0000 Subject: [PATCH] fix dht unit test --- test/test_dht.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test_dht.cpp b/test/test_dht.cpp index bfa2afa57..f2573bad2 100644 --- a/test/test_dht.cpp +++ b/test/test_dht.cpp @@ -1537,13 +1537,23 @@ int test_main() g_sent_packets.clear(); send_dht_response(node, response, next_node, nodes_t(), "11", 1234, peers[1]); - TEST_CHECK(g_sent_packets.empty()); + for (std::list >::iterator i = g_sent_packets.begin() + , end(g_sent_packets.end()); i != end; ++i) + { +// fprintf(stderr, " %s:%d: %s\n", i->first.address().to_string(ec).c_str() +// , i->first.port(), i->second.to_string().c_str()); + TEST_EQUAL(i->second["q"].string(), "announce_peer"); + } + + g_sent_packets.clear(); for (int i = 0; i < 2; ++i) + { for (std::set::iterator peer = peers[i].begin(); peer != peers[i].end(); ++peer) { TEST_CHECK(std::find(g_got_peers.begin(), g_got_peers.end(), *peer) != g_got_peers.end()); } + } g_got_peers.clear(); } while (false);