2008-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Fixed compile error when configured with --disable-metalink.
	Also moved test/DownloadHandlerFactoryTest.cc to SRC in 
Makefile.am.
	* test/FeatureConfigTest.cc
	* test/DownloadHandlerFactoryTest.cc
pull/1/head
Tatsuhiro Tsujikawa 2008-05-20 14:27:58 +00:00
parent a70a747c23
commit bf58b49d87
3 changed files with 42 additions and 17 deletions

View File

@ -1,3 +1,10 @@
2008-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed compile error when configured with --disable-metalink.
Also moved test/DownloadHandlerFactoryTest.cc to SRC in Makefile.am.
* test/FeatureConfigTest.cc
* test/DownloadHandlerFactoryTest.cc
2008-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> 2008-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed compile error when configured with --without-gnutls Fixed compile error when configured with --without-gnutls

View File

@ -11,8 +11,10 @@ namespace aria2 {
class DownloadHandlerFactoryTest:public CppUnit::TestFixture { class DownloadHandlerFactoryTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(DownloadHandlerFactoryTest); CPPUNIT_TEST_SUITE(DownloadHandlerFactoryTest);
#ifdef ENABLE_METALINK
CPPUNIT_TEST(testGetMetalinkPreDownloadHandler_extension); CPPUNIT_TEST(testGetMetalinkPreDownloadHandler_extension);
CPPUNIT_TEST(testGetMetalinkPreDownloadHandler_contentType); CPPUNIT_TEST(testGetMetalinkPreDownloadHandler_contentType);
#endif // ENABLE_METALINK
CPPUNIT_TEST(testGetBtPreDownloadHandler_extension); CPPUNIT_TEST(testGetBtPreDownloadHandler_extension);
CPPUNIT_TEST(testGetBtPreDownloadHandler_contentType); CPPUNIT_TEST(testGetBtPreDownloadHandler_contentType);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
@ -21,8 +23,11 @@ private:
public: public:
void setUp() {} void setUp() {}
#ifdef ENABLE_METALINK
void testGetMetalinkPreDownloadHandler_extension(); void testGetMetalinkPreDownloadHandler_extension();
void testGetMetalinkPreDownloadHandler_contentType(); void testGetMetalinkPreDownloadHandler_contentType();
#endif // ENABLE_METALINK
void testGetBtPreDownloadHandler_extension(); void testGetBtPreDownloadHandler_extension();
void testGetBtPreDownloadHandler_contentType(); void testGetBtPreDownloadHandler_contentType();
}; };
@ -30,6 +35,8 @@ public:
CPPUNIT_TEST_SUITE_REGISTRATION( DownloadHandlerFactoryTest ); CPPUNIT_TEST_SUITE_REGISTRATION( DownloadHandlerFactoryTest );
#ifdef ENABLE_METALINK
void DownloadHandlerFactoryTest::testGetMetalinkPreDownloadHandler_extension() void DownloadHandlerFactoryTest::testGetMetalinkPreDownloadHandler_extension()
{ {
Option op; Option op;
@ -63,6 +70,8 @@ void DownloadHandlerFactoryTest::testGetMetalinkPreDownloadHandler_contentType()
CPPUNIT_ASSERT(!handler->canHandle(&rg)); CPPUNIT_ASSERT(!handler->canHandle(&rg));
} }
#endif // ENABLE_METALINK
void DownloadHandlerFactoryTest::testGetBtPreDownloadHandler_extension() void DownloadHandlerFactoryTest::testGetBtPreDownloadHandler_extension()
{ {
Option op; Option op;

View File

@ -1,4 +1,8 @@
#include "FeatureConfig.h" #include "FeatureConfig.h"
#include "a2functional.h"
#include "array_fun.h"
#include "Util.h"
#include <algorithm>
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
namespace aria2 { namespace aria2 {
@ -44,33 +48,38 @@ void FeatureConfigTest::testIsSupported() {
} }
void FeatureConfigTest::testFeatureSummary() { void FeatureConfigTest::testFeatureSummary() {
CPPUNIT_ASSERT_EQUAL( const std::string features[] = {
#ifdef ENABLE_ASYNC_DNS #ifdef ENABLE_ASYNC_DNS
std::string("Async DNS, ") "Async DNS",
#else
std::string()
#endif // ENABLE_ASYNC_DNS #endif // ENABLE_ASYNC_DNS
#ifdef ENABLE_BITTORRENT #ifdef ENABLE_BITTORRENT
+std::string("BitTorrent, ") "BitTorrent",
#else
+std::string()
#endif // ENABLE_BITTORRENT #endif // ENABLE_BITTORRENT
#ifdef ENABLE_SSL #ifdef ENABLE_SSL
+std::string("HTTPS, ") "HTTPS",
#else
+std::string()
#endif // ENABLE_SSL #endif // ENABLE_SSL
#ifdef ENABLE_MESSAGE_DIGEST #ifdef ENABLE_MESSAGE_DIGEST
+std::string("Message Digest, ") "Message Digest",
#else
+std::string()
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST
#ifdef ENABLE_METALINK #ifdef ENABLE_METALINK
+std::string("Metalink") "Metalink",
#else
+std::string()
#endif // ENABLE_METALINK #endif // ENABLE_METALINK
,
};
std::string featuresString;
const std::string delim(", ");
std::for_each(&features[0], &features[arrayLength(features)],
StringAppend(featuresString, delim));
// USE Util::trimSelf(featureString);
featuresString = Util::trim(featuresString, delim);
CPPUNIT_ASSERT_EQUAL(featuresString,
FeatureConfig::getInstance()->featureSummary()); FeatureConfig::getInstance()->featureSummary());
} }