From f2455c86898a6d6ffd6f221d6a76c84ed0351578 Mon Sep 17 00:00:00 2001 From: arvidn Date: Mon, 10 Aug 2015 10:02:01 -0400 Subject: [PATCH] made test_metadata_extension a bit more reliable --- simulation/test_metadata_extension.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/simulation/test_metadata_extension.cpp b/simulation/test_metadata_extension.cpp index d7fb5828f..ebe8b48b5 100644 --- a/simulation/test_metadata_extension.cpp +++ b/simulation/test_metadata_extension.cpp @@ -77,6 +77,7 @@ struct test_swarm_config : swarm_config : swarm_config() , m_flags(flags) , m_plugin(plugin) + , m_metadata_alerts(0) {} // called for every session that's added @@ -146,6 +147,11 @@ struct test_swarm_config : swarm_config , std::vector const& handles , libtorrent::session& ses) override { + if (alert_cast(alert)) + { + m_metadata_alerts += 1; + } + // make sure this function can be called on // torrents without metadata if ((m_flags & disconnect) == 0) @@ -175,6 +181,7 @@ struct test_swarm_config : swarm_config virtual void on_exit(std::vector const& torrents) override { + TEST_EQUAL(m_metadata_alerts, 1); // in this case we should have completed without downloading anything // because the downloader had upload only set if (m_flags & upload_only) return; @@ -185,6 +192,7 @@ struct test_swarm_config : swarm_config private: int m_flags; boost::shared_ptr (*m_plugin)(torrent_handle const&, void*); + int m_metadata_alerts; }; TORRENT_TEST(ut_metadata_encryption_reverse)