From ab07c8f0410a416b69721ab900d7dd8cf73a9c66 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 17 Jun 2013 07:47:47 +0000 Subject: [PATCH] some test fixes --- test/test_rss.cpp | 2 +- test/test_torrent_parse.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_rss.cpp b/test/test_rss.cpp index a2a4fed18..71d274bf2 100644 --- a/test/test_rss.cpp +++ b/test/test_rss.cpp @@ -85,7 +85,7 @@ void test_feed(std::string const& filename, rss_expect const& expect) } TEST_CHECK(!ec); - char* buf = &buffer[0]; + char* buf = buffer.size() ? &buffer[0] : NULL; int len = buffer.size(); char const header[] = "HTTP/1.1 200 OK\r\n" diff --git a/test/test_torrent_parse.cpp b/test/test_torrent_parse.cpp index 0b73ace0f..15912cb85 100644 --- a/test/test_torrent_parse.cpp +++ b/test/test_torrent_parse.cpp @@ -121,7 +121,9 @@ int test_main() if (std::string(test_torrents[i].file) == "whitespace_url.torrent") { // make sure we trimmed the url - TEST_CHECK(ti->trackers()[0].url == "udp://test.com/announce"); + TEST_CHECK(ti->trackers().size() > 0); + if (ti->trackers().size() > 0) + TEST_CHECK(ti->trackers()[0].url == "udp://test.com/announce"); } else if (std::string(test_torrents[i].file) == "duplicate_files.torrent") {