Test failure without Metalink and BitTorrent support

pull/89/head
Tatsuhiro Tsujikawa 2013-05-15 23:31:49 +09:00
parent 8e8fb9ee36
commit be4c9aa95e
1 changed files with 9 additions and 0 deletions

View File

@ -63,6 +63,7 @@ void Aria2ApiTest::testAddMetalink()
std::string metalinkPath = A2_TEST_DIR"/metalink4.xml"; std::string metalinkPath = A2_TEST_DIR"/metalink4.xml";
std::vector<A2Gid> gids; std::vector<A2Gid> gids;
KeyVals options; KeyVals options;
#ifdef ENABLE_METALINK
CPPUNIT_ASSERT_EQUAL(0, addMetalink(session_, &gids, metalinkPath, options)); CPPUNIT_ASSERT_EQUAL(0, addMetalink(session_, &gids, metalinkPath, options));
CPPUNIT_ASSERT_EQUAL((size_t)2, gids.size()); CPPUNIT_ASSERT_EQUAL((size_t)2, gids.size());
@ -70,6 +71,10 @@ void Aria2ApiTest::testAddMetalink()
options.push_back(KeyVals::value_type("file-allocation", "foo")); options.push_back(KeyVals::value_type("file-allocation", "foo"));
CPPUNIT_ASSERT_EQUAL(-1, addMetalink(session_, &gids, metalinkPath, CPPUNIT_ASSERT_EQUAL(-1, addMetalink(session_, &gids, metalinkPath,
options)); options));
#else // !ENABLE_METALINK
CPPUNIT_ASSERT_EQUAL(-1, addMetalink(session_, &gids, metalinkPath,
options));
#endif // !ENABLE_METALINK
} }
void Aria2ApiTest::testAddTorrent() void Aria2ApiTest::testAddTorrent()
@ -77,11 +82,15 @@ void Aria2ApiTest::testAddTorrent()
std::string torrentPath = A2_TEST_DIR"/test.torrent"; std::string torrentPath = A2_TEST_DIR"/test.torrent";
A2Gid gid; A2Gid gid;
KeyVals options; KeyVals options;
#ifdef ENABLE_BITTORRENT
CPPUNIT_ASSERT_EQUAL(0, addTorrent(session_, &gid, torrentPath, options)); CPPUNIT_ASSERT_EQUAL(0, addTorrent(session_, &gid, torrentPath, options));
CPPUNIT_ASSERT(!isNull(gid)); CPPUNIT_ASSERT(!isNull(gid));
options.push_back(KeyVals::value_type("file-allocation", "foo")); options.push_back(KeyVals::value_type("file-allocation", "foo"));
CPPUNIT_ASSERT_EQUAL(-1, addTorrent(session_, &gid, torrentPath, options)); CPPUNIT_ASSERT_EQUAL(-1, addTorrent(session_, &gid, torrentPath, options));
#else // !ENABLE_BITTORRENT
CPPUNIT_ASSERT_EQUAL(-1, addTorrent(session_, &gid, torrentPath, options));
#endif // !ENABLE_BITTORRENT
} }
void Aria2ApiTest::testRemovePause() void Aria2ApiTest::testRemovePause()