mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 13:37:40 +03:00
* src/Option.h (getAsBool): New function. * src/Option.cc (prefs.h): Included. (defined): 0-length value is now recognized as undefined. (getAsInt): Rewritten. (getAsLLInt): Rewritten. (getAsBool): New function. * src/FeatureConfig.h: Rewritten. * src/FeatureConfig.cc: Rewritten. * src/prefs.h (PREF_STDOUT_LOG): New definition. (PREF_LOG): New definition. (PREF_DIR): New definition. (PREF_OUT): New definition. (PREF_SPLIT): New definition. (PREF_DAEMON): New definition. (PREF_REFERER): New definition. (PREF_TORRENT_FILE): New definition. (PREF_LISTEN_PORT): New definition. (PREF_METALINK_FILE): New definition. (PREF_METALINK_VERSION): New definition. (PREF_METALINK_LANGUAGE): New definition. (PREF_METALINK_OS): New definition. (PREF_METALINK_SERVERS): New definition. * src/main.cc (main): Following command-line parameters are now put into Option class: stdoutLog, logfile, dir, ufilename, split, daemonMode, referer, torrentFile, metalinkFile, listenPort, metalinkVersion, metalinkLanguage, metalinkOs, metalinkServers To fix the bug that aria2 can not handle http response header properly. * src/HttpHeader.cc (put): Made name lowercased. (defined): Made name lowercased. (getFirst): Made name lowercased. (get): Made name lowercased. (getFirstAsInt): Rewritten. (getFirstAsLLInt): Rewritten.
50 lines
1.5 KiB
C++
50 lines
1.5 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::getInstance()->getDefaultPort("http"));
|
|
CPPUNIT_ASSERT_EQUAL(443,
|
|
FeatureConfig::getInstance()->getDefaultPort("https"));
|
|
CPPUNIT_ASSERT_EQUAL(21,
|
|
FeatureConfig::getInstance()->getDefaultPort("ftp"));
|
|
}
|
|
|
|
void FeatureConfigTest::testIsSupported() {
|
|
CPPUNIT_ASSERT_EQUAL(true,
|
|
FeatureConfig::getInstance()->isSupported("http"));
|
|
CPPUNIT_ASSERT_EQUAL(true,
|
|
FeatureConfig::getInstance()->isSupported("https"));
|
|
CPPUNIT_ASSERT_EQUAL(true,
|
|
FeatureConfig::getInstance()->isSupported("ftp"));
|
|
CPPUNIT_ASSERT_EQUAL(false,
|
|
FeatureConfig::getInstance()->isSupported("ftps"));
|
|
}
|
|
|
|
void FeatureConfigTest::testGetConfigurationSummary() {
|
|
CPPUNIT_ASSERT_EQUAL(string("http: yes\n")
|
|
+"https: yes\n"
|
|
+"ftp: yes\n"
|
|
+"bittorrent: yes\n"
|
|
+"metalink: yes\n"
|
|
+"message digest: yes\n",
|
|
FeatureConfig::getInstance()->getConfigurationSummary());
|
|
}
|