From 538a8fcfe7d56e2d3bea25599d015df94ab9e7e6 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 15 Mar 2008 04:19:46 +0000 Subject: 2008-03-15 Tatsuhiro Tsujikawa Fixed compilation error with g++-4.3 --- test/BNodeTest.cc | 1 + test/BitfieldManTest.cc | 1 + test/DHTBucketTest.cc | 2 ++ test/DHTIDCloserTest.cc | 1 + test/DHTMessageFactoryImplTest.cc | 1 + test/DHTUtilTest.cc | 1 + test/DefaultBtContextTest.cc | 1 + test/FixedNumberRandomizer.h | 1 + test/MockBtContext.h | 1 + test/MultiDiskAdaptorTest.cc | 6 ++++-- test/UtilTest.cc | 22 ++++++++++++++++++++++ 11 files changed, 36 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/BNodeTest.cc b/test/BNodeTest.cc index 88d88d06..8aafa639 100644 --- a/test/BNodeTest.cc +++ b/test/BNodeTest.cc @@ -4,6 +4,7 @@ #include "DHTUtil.h" #include "Exception.h" #include "Util.h" +#include #include namespace aria2 { diff --git a/test/BitfieldManTest.cc b/test/BitfieldManTest.cc index 3012b1e0..cc46f7c6 100644 --- a/test/BitfieldManTest.cc +++ b/test/BitfieldManTest.cc @@ -1,5 +1,6 @@ #include "BitfieldMan.h" #include "FixedNumberRandomizer.h" +#include #include namespace aria2 { diff --git a/test/DHTBucketTest.cc b/test/DHTBucketTest.cc index f97eb17a..73f54e85 100644 --- a/test/DHTBucketTest.cc +++ b/test/DHTBucketTest.cc @@ -2,6 +2,8 @@ #include "DHTNode.h" #include "Exception.h" #include "Util.h" +#include +#include #include namespace aria2 { diff --git a/test/DHTIDCloserTest.cc b/test/DHTIDCloserTest.cc index f470901b..ebe51a5e 100644 --- a/test/DHTIDCloserTest.cc +++ b/test/DHTIDCloserTest.cc @@ -3,6 +3,7 @@ #include "DHTIDCloser.h" #include "Exception.h" #include "Util.h" +#include #include #include diff --git a/test/DHTMessageFactoryImplTest.cc b/test/DHTMessageFactoryImplTest.cc index 868836ac..7be1de95 100644 --- a/test/DHTMessageFactoryImplTest.cc +++ b/test/DHTMessageFactoryImplTest.cc @@ -17,6 +17,7 @@ #include "DHTGetPeersReplyMessage.h" #include "DHTAnnouncePeerMessage.h" #include "DHTAnnouncePeerReplyMessage.h" +#include #include #include diff --git a/test/DHTUtilTest.cc b/test/DHTUtilTest.cc index 28137735..ee9c0ad0 100644 --- a/test/DHTUtilTest.cc +++ b/test/DHTUtilTest.cc @@ -1,6 +1,7 @@ #include "DHTUtil.h" #include "Exception.h" #include "Util.h" +#include #include namespace aria2 { diff --git a/test/DefaultBtContextTest.cc b/test/DefaultBtContextTest.cc index 983e22e1..fa1f24e6 100644 --- a/test/DefaultBtContextTest.cc +++ b/test/DefaultBtContextTest.cc @@ -4,6 +4,7 @@ #include "AnnounceTier.h" #include "FixedNumberRandomizer.h" #include "FileEntry.h" +#include #include #include diff --git a/test/FixedNumberRandomizer.h b/test/FixedNumberRandomizer.h index c53975c2..dacaad99 100644 --- a/test/FixedNumberRandomizer.h +++ b/test/FixedNumberRandomizer.h @@ -2,6 +2,7 @@ #define _D_FIXED_NUMBER_RANDOMIZER_H_ #include "Randomizer.h" +#include namespace aria2 { diff --git a/test/MockBtContext.h b/test/MockBtContext.h index 9f143dc6..9373e991 100644 --- a/test/MockBtContext.h +++ b/test/MockBtContext.h @@ -4,6 +4,7 @@ #include "BtContext.h" #include "Util.h" #include "AnnounceTier.h" +#include namespace aria2 { diff --git a/test/MultiDiskAdaptorTest.cc b/test/MultiDiskAdaptorTest.cc index fd1d9ed8..63d70e83 100644 --- a/test/MultiDiskAdaptorTest.cc +++ b/test/MultiDiskAdaptorTest.cc @@ -2,6 +2,8 @@ #include "FileEntry.h" #include "Exception.h" #include +#include +#include #include namespace aria2 { @@ -48,12 +50,12 @@ std::deque > createEntries() { void readFile(const std::string& filename, char* buf, int bufLength) { FILE* f = fopen(filename.c_str(), "r"); if(f == NULL) { - abort(); + CPPUNIT_FAIL(strerror(errno)); } int retval = fread(buf, bufLength, 1, f); fclose(f); if(retval != 1) { - abort(); + CPPUNIT_FAIL("return value is not 1"); } } diff --git a/test/UtilTest.cc b/test/UtilTest.cc index 5b38b58c..8e760375 100644 --- a/test/UtilTest.cc +++ b/test/UtilTest.cc @@ -41,6 +41,7 @@ class UtilTest:public CppUnit::TestFixture { CPPUNIT_TEST(testParseInt); CPPUNIT_TEST(testParseUInt); CPPUNIT_TEST(testParseLLInt); + CPPUNIT_TEST(testParseULLInt); CPPUNIT_TEST(testToString_binaryStream); CPPUNIT_TEST(testItos); CPPUNIT_TEST(testUitos); @@ -78,6 +79,7 @@ public: void testParseInt(); void testParseUInt(); void testParseLLInt(); + void testParseULLInt(); void testToString_binaryStream(); void testItos(); void testUitos(); @@ -612,6 +614,26 @@ void UtilTest::testParseLLInt() } } +void UtilTest::testParseULLInt() +{ + CPPUNIT_ASSERT_EQUAL(18446744073709551615ULL, + Util::parseULLInt("18446744073709551615")); + try { + Util::parseUInt("-1"); + CPPUNIT_FAIL("exception must be thrown."); + } catch(Exception* e) { + std::cerr << *e; + delete e; + } + try { + Util::parseLLInt("18446744073709551616"); + CPPUNIT_FAIL("exception must be thrown."); + } catch(Exception* e) { + std::cerr << *e; + delete e; + } +} + void UtilTest::testToString_binaryStream() { SharedHandle dw = new ByteArrayDiskWriter(); -- cgit