aria2/test/DefaultDiskWriterTest.cc
Tatsuhiro Tsujikawa 860f4dd06a Use int64_t instead of off_t
Using off_t, at least, in DiskAdaptor layer is problematic because
torrent can contain under 2GiB files but total sum of those files may
exceed 2GiB limit, which makes off_t overflow in 32 bit system without
large file support. So we use int64_t in API. We'll check the file
length before download so that it does not exceed max off_t.
2012-07-23 21:42:47 +09:00

32 lines
595 B
C++

#include "DefaultDiskWriter.h"
#include <cppunit/extensions/HelperMacros.h>
namespace aria2 {
class DefaultDiskWriterTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(DefaultDiskWriterTest);
CPPUNIT_TEST(testSize);
CPPUNIT_TEST_SUITE_END();
private:
public:
void setUp() {
}
void testSize();
};
CPPUNIT_TEST_SUITE_REGISTRATION( DefaultDiskWriterTest );
void DefaultDiskWriterTest::testSize()
{
DefaultDiskWriter dw(A2_TEST_DIR"/4096chunk.txt");
dw.enableReadOnly();
dw.openExistingFile();
CPPUNIT_ASSERT_EQUAL((int64_t)4096LL, dw.size());
}
} // namespace aria2