summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-03-15 04:19:46 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-03-15 04:19:46 +0000
commit538a8fcfe7d56e2d3bea25599d015df94ab9e7e6 (patch)
tree174aba60cd077961b78b937b1ad1904c4c8c4857 /test
parent8dacfe45b86f262da482e41441db49363b41acb9 (diff)
2008-03-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed compilation error with g++-4.3
Diffstat (limited to 'test')
-rw-r--r--test/BNodeTest.cc1
-rw-r--r--test/BitfieldManTest.cc1
-rw-r--r--test/DHTBucketTest.cc2
-rw-r--r--test/DHTIDCloserTest.cc1
-rw-r--r--test/DHTMessageFactoryImplTest.cc1
-rw-r--r--test/DHTUtilTest.cc1
-rw-r--r--test/DefaultBtContextTest.cc1
-rw-r--r--test/FixedNumberRandomizer.h1
-rw-r--r--test/MockBtContext.h1
-rw-r--r--test/MultiDiskAdaptorTest.cc6
-rw-r--r--test/UtilTest.cc22
11 files changed, 36 insertions, 2 deletions
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 <cstring>
#include <cppunit/extensions/HelperMacros.h>
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 <cstring>
#include <cppunit/extensions/HelperMacros.h>
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 <cstring>
+#include <algorithm>
#include <cppunit/extensions/HelperMacros.h>
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 <cstring>
#include <algorithm>
#include <cppunit/extensions/HelperMacros.h>
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 <cstring>
#include <iostream>
#include <cppunit/extensions/HelperMacros.h>
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 <cstring>
#include <cppunit/extensions/HelperMacros.h>
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 <cstring>
#include <iostream>
#include <cppunit/extensions/HelperMacros.h>
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 <cstdlib>
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 <cstring>
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 <string>
+#include <cerrno>
+#include <cstring>
#include <cppunit/extensions/HelperMacros.h>
namespace aria2 {
@@ -48,12 +50,12 @@ std::deque<SharedHandle<FileEntry> > 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<DiskWriter> dw = new ByteArrayDiskWriter();