|
|
@@ -574,7 +574,9 @@ void XmlRpcMethodTest::testTellWaiting()
|
|
|
addUri("http://3/", _e);
|
|
|
#ifdef ENABLE_BITTORRENT
|
|
|
addTorrent("single.torrent", _e);
|
|
|
-#endif // ENABLE_BITTORRENT
|
|
|
+#else // !ENABLE_BITTORRENT
|
|
|
+ addUri("http://4/", _e);
|
|
|
+#endif // !ENABLE_BITTORRENT
|
|
|
|
|
|
TellWaitingXmlRpcMethod m;
|
|
|
XmlRpcRequest req(TellWaitingXmlRpcMethod::getMethodName(), BDE::list());
|
|
|
@@ -588,29 +590,17 @@ void XmlRpcMethodTest::testTellWaiting()
|
|
|
// waiting.size() == offset+num
|
|
|
req = XmlRpcRequest(TellWaitingXmlRpcMethod::getMethodName(), BDE::list());
|
|
|
req._params << BDE((int64_t)1);
|
|
|
-#ifdef ENABLE_BITTORRENT
|
|
|
req._params << BDE((int64_t)3);
|
|
|
-#else // !ENABLE_BITTORRENT
|
|
|
- req._params << BDE((int64_t)2);
|
|
|
-#endif // !ENABLE_BITTORRENT
|
|
|
res = m.execute(req, _e.get());
|
|
|
CPPUNIT_ASSERT_EQUAL(0, res._code);
|
|
|
-#ifdef ENABLE_BITTORRENT
|
|
|
CPPUNIT_ASSERT_EQUAL((size_t)3, res._param.size());
|
|
|
-#else // !ENABLE_BITTORRENT
|
|
|
- CPPUNIT_ASSERT_EQUAL((size_t)2, res._param.size());
|
|
|
-#endif // !ENABLE_BITTORRENT
|
|
|
// waiting.size() < offset+num
|
|
|
req = XmlRpcRequest(TellWaitingXmlRpcMethod::getMethodName(), BDE::list());
|
|
|
req._params << BDE((int64_t)1);
|
|
|
req._params << BDE((int64_t)4);
|
|
|
res = m.execute(req, _e.get());
|
|
|
CPPUNIT_ASSERT_EQUAL(0, res._code);
|
|
|
-#ifdef ENABLE_BITTORRENT
|
|
|
CPPUNIT_ASSERT_EQUAL((size_t)3, res._param.size());
|
|
|
-#else //!ENABLE_BITTORRENT
|
|
|
- CPPUNIT_ASSERT_EQUAL((size_t)2, res._param.size());
|
|
|
-#endif // !ENABLE_BITTORRENT
|
|
|
// negative offset
|
|
|
req = XmlRpcRequest(TellWaitingXmlRpcMethod::getMethodName(), BDE::list());
|
|
|
req._params << BDE((int64_t)-1);
|
|
|
@@ -618,22 +608,13 @@ void XmlRpcMethodTest::testTellWaiting()
|
|
|
res = m.execute(req, _e.get());
|
|
|
CPPUNIT_ASSERT_EQUAL(0, res._code);
|
|
|
CPPUNIT_ASSERT_EQUAL((size_t)2, res._param.size());
|
|
|
-#ifdef ENABLE_BITTORRENT
|
|
|
CPPUNIT_ASSERT_EQUAL(std::string("4"), res._param[0]["gid"].s());
|
|
|
CPPUNIT_ASSERT_EQUAL(std::string("3"), res._param[1]["gid"].s());
|
|
|
-#else // !ENABLE_BITTORRENT
|
|
|
- CPPUNIT_ASSERT_EQUAL(std::string("3"), res._param[0]["gid"].s());
|
|
|
- CPPUNIT_ASSERT_EQUAL(std::string("2"), res._param[1]["gid"].s());
|
|
|
-#endif // !ENABLE_BITTORRENT
|
|
|
// negative offset and size < num
|
|
|
req._params[1] = BDE((int64_t)100);
|
|
|
res = m.execute(req, _e.get());
|
|
|
CPPUNIT_ASSERT_EQUAL(0, res._code);
|
|
|
-#ifdef ENABLE_BITTORRENT
|
|
|
CPPUNIT_ASSERT_EQUAL((size_t)4, res._param.size());
|
|
|
-#else // !ENABLE_BITTORRENT
|
|
|
- CPPUNIT_ASSERT_EQUAL((size_t)3, res._param.size());
|
|
|
-#endif // !ENABLE_BITTORRENT
|
|
|
// nagative offset and normalized offset < 0
|
|
|
req._params[0] = BDE((int64_t)-5);
|
|
|
res = m.execute(req, _e.get());
|