aria2/test/FeatureConfigTest.cc
Tatsuhiro Tsujikawa 3cc1ed5e09 2007-08-10 Ross Smith II <aria2spam at smithii dot com>
gcc 3.4.4 support:
	* src/DefaultBtContext.cc: int32_t -> int
	* src/main.cc: int -> int32_t, int32_t -> int
	* src/messageDigest.h: uint32_t -> unsigned int
	* src/NameResolver.h: int32_t -> int
	* src/PeerConnection.cc: int -> int32_t
	* src/SpeedCalc.cc: int32_t -> int
	* src/TrackerUpdateCommand.h: int -> int32_t
	* src/Util.cc: int32_t -> int
	* src/Util.h: int32_t -> int
	* src/Xml2MetalinkProcessor.cc: int -> uint32_t, int64_t -> 
uint64_t
	* test/AnnounceListTest.cc: int -> int32_t
	* test/ChunkedEncodingTest.cc: int -> int32_t
	* test/DataTest.cc: int -> int32_t
	* test/DefaultBtRequestFactoryTest.cc: int -> int32_t
	* test/DefaultPeerListProcessorTest.cc: int -> int32_t
	* test/DefaultPieceStorageTest.cc: int -> int32_t
	* test/FeatureConfigTest.cc: int -> int32_t
	* test/MetalinkEntryTest.cc: int -> int32_t
	* test/MockBtRequestFactory.h: int -> int32_t
	* test/MockPieceStorage.h: int -> int32_t
	* test/OptionTest.cc: int -> int32_t
	* test/RequestTest.cc: int -> int32_t
	* test/SegmentManTest.cc: int -> int32_t
	* test/Xml2MetalinkProcessorTest.cc: int -> int32_t
2007-08-15 15:11:01 +00:00

77 lines
2.1 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((int32_t)80,
FeatureConfig::getInstance()->getDefaultPort("http"));
CPPUNIT_ASSERT_EQUAL((int32_t)443,
FeatureConfig::getInstance()->getDefaultPort("https"));
CPPUNIT_ASSERT_EQUAL((int32_t)21,
FeatureConfig::getInstance()->getDefaultPort("ftp"));
}
void FeatureConfigTest::testIsSupported() {
CPPUNIT_ASSERT_EQUAL(true,
FeatureConfig::getInstance()->isSupported("http"));
#ifdef ENABLE_SSL
CPPUNIT_ASSERT_EQUAL(true,
FeatureConfig::getInstance()->isSupported("https"));
#else
CPPUNIT_ASSERT_EQUAL(false,
FeatureConfig::getInstance()->isSupported("https"));
#endif // ENABLE_SSL
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")
#ifdef ENABLE_SSL
+"https: yes\n"
#else
+"https: no\n"
#endif // ENABLE_SSL
+"ftp: yes\n"
#ifdef ENABLE_BITTORRENT
+"bittorrent: yes\n"
#else
+"bittorrent: no\n"
#endif // ENABLE_BITTORRENT
#ifdef ENABLE_METALINK
+"metalink: yes\n"
#else
+"metalink: no\n"
#endif // ENABLE_METALINK
#ifdef ENABLE_MESSAGE_DIGEST
+"message digest: yes\n"
#else
+"message digest: no\n"
#endif // ENABLE_MESSAGE_DIGEST
#ifdef ENABLE_ASYNC_DNS
+"async dns: yes\n"
#else
+"async dns: no\n"
#endif // ENABLE_ASYNC_DNS
,
FeatureConfig::getInstance()->getConfigurationSummary());
}