mirror of
https://github.com/aria2/aria2.git
synced 2025-01-08 11:01:38 +00:00
860f4dd06a
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.
32 lines
595 B
C++
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
|