mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 13:37:40 +03:00
* src/TorrentMan.h: (advertisePiece): Updated doc. (getAdvertisedPieceIndexes): Updated doc. (removeAdvertisedPiece); New function. * src/TorrentMan.cc (FindElapsedHave): New function object. (removeAdvertisedPiece): New function. * src/HaveEraseCommand.h: New class. * src/HaveEraseCommand.cc: New class. * src/FeatureConfig.h: New class. * src/FeatureConfig.cc: New class. * src/Request.h (defaultPorts): Removed. * src/Request.cc (FeatureConfig.h): Included. (Request): Removed the statements related to defaultPorts. (parseUrl): Removed metalinkEnabled. Use FeatureConfig instead. A default port number is now retrieved from FeatureConfig. * src/main.cc (HaveEraseCommand.h): Included. (showVersion): Added the output of feature list. (main): Added HaveEraseCommand to command queue in BitTorrent downloading. * src/PeerInteractionCommand.h (chokeCheckPoint): Commented out. (periodicExecPoint): New variable. * src/PeerInteractionCommand.cc (executeInternal): Following methods are now called in at least every 0.5 seconds to reduce CPU usage: detectMessageFlooding(), peerInteraction->checkRequestSlot(), checkHave(), sendKeepAlive(). (checkLongTimePeerChoking): Commented out. * src/BitfieldMan.h (getNthBitIndex): Changed the method signature. (getMissingIndexRandomly): Changed the method signature. * src/BitfieldMan.cc (getNthBitIndex): Rewritten (getMissingIndexRandomly): Rewritten. (hasMissingPiece): Rewritten. (getMissingIndex): Refactored. (getMissingUnusedIndex); Refactored. (getMissingIndex): Refactored.
42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
#include "FeatureConfig.h"
|
|
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
class FeatureConfigTest:public CppUnit::TestFixture {
|
|
|
|
CPPUNIT_TEST_SUITE(FeatureConfigTest);
|
|
CPPUNIT_TEST(testGetDefaultPort);
|
|
CPPUNIT_TEST(testIsSupported);
|
|
CPPUNIT_TEST(testGetConfigurationSummary);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
public:
|
|
void testGetDefaultPort();
|
|
void testIsSupported();
|
|
void testGetConfigurationSummary();
|
|
};
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION(FeatureConfigTest);
|
|
|
|
void FeatureConfigTest::testGetDefaultPort() {
|
|
CPPUNIT_ASSERT_EQUAL(80, FeatureConfig::getDefaultPort("http"));
|
|
CPPUNIT_ASSERT_EQUAL(443, FeatureConfig::getDefaultPort("https"));
|
|
CPPUNIT_ASSERT_EQUAL(21, FeatureConfig::getDefaultPort("ftp"));
|
|
}
|
|
|
|
void FeatureConfigTest::testIsSupported() {
|
|
CPPUNIT_ASSERT_EQUAL(true, FeatureConfig::isSupported("http"));
|
|
CPPUNIT_ASSERT_EQUAL(true, FeatureConfig::isSupported("https"));
|
|
CPPUNIT_ASSERT_EQUAL(true, FeatureConfig::isSupported("ftp"));
|
|
CPPUNIT_ASSERT_EQUAL(false, FeatureConfig::isSupported("ftps"));
|
|
}
|
|
|
|
void FeatureConfigTest::testGetConfigurationSummary() {
|
|
CPPUNIT_ASSERT_EQUAL(string("http: yes\n")
|
|
+"https: yes\n"
|
|
+"ftp: yes\n"
|
|
+"bittorrent: yes\n"
|
|
+"metalink: yes\n",
|
|
FeatureConfig::getConfigurationSummary());
|
|
}
|