mirror of
https://github.com/aria2/aria2.git
synced 2025-04-06 05:57:36 +03:00
make clang-format using clang-format-3.6
This commit is contained in:
parent
4abad2f64c
commit
b1132d6b10
1095 changed files with 30423 additions and 33770 deletions
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace aria2 {
|
||||
|
||||
class PieceTest:public CppUnit::TestFixture {
|
||||
class PieceTest : public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(PieceTest);
|
||||
CPPUNIT_TEST(testCompleteBlock);
|
||||
|
@ -23,9 +23,11 @@ class PieceTest:public CppUnit::TestFixture {
|
|||
CPPUNIT_TEST(testUpdateHash);
|
||||
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
std::shared_ptr<DirectDiskAdaptor> adaptor_;
|
||||
ByteArrayDiskWriter* writer_;
|
||||
|
||||
public:
|
||||
void setUp()
|
||||
{
|
||||
|
@ -44,13 +46,12 @@ public:
|
|||
void testUpdateHash();
|
||||
};
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION( PieceTest );
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(PieceTest);
|
||||
|
||||
void PieceTest::testCompleteBlock()
|
||||
{
|
||||
size_t blockLength = 32_k;
|
||||
Piece p(0, blockLength*10, blockLength);
|
||||
Piece p(0, blockLength * 10, blockLength);
|
||||
|
||||
p.completeBlock(5);
|
||||
|
||||
|
@ -60,14 +61,15 @@ void PieceTest::testCompleteBlock()
|
|||
void PieceTest::testGetCompletedLength()
|
||||
{
|
||||
int32_t blockLength = 16_k;
|
||||
Piece p(0, blockLength*10+100, blockLength);
|
||||
Piece p(0, blockLength * 10 + 100, blockLength);
|
||||
|
||||
p.completeBlock(1);
|
||||
p.completeBlock(2);
|
||||
p.completeBlock(9);
|
||||
p.completeBlock(10); // <-- 100 bytes
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL((int64_t)(blockLength*3+100), p.getCompletedLength());
|
||||
CPPUNIT_ASSERT_EQUAL((int64_t)(blockLength * 3 + 100),
|
||||
p.getCompletedLength());
|
||||
}
|
||||
|
||||
void PieceTest::testFlushWrCache()
|
||||
|
@ -106,8 +108,8 @@ void PieceTest::testAppendWrCache()
|
|||
data = new unsigned char[capacity];
|
||||
memcpy(data, "foo", 3);
|
||||
p.updateWrCache(&dc, data, 0, 3, capacity, 0);
|
||||
size_t alen = p.appendWrCache
|
||||
(&dc, 3, reinterpret_cast<const unsigned char*>("barbaz"), 6);
|
||||
size_t alen = p.appendWrCache(
|
||||
&dc, 3, reinterpret_cast<const unsigned char*>("barbaz"), 6);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)3, alen);
|
||||
p.flushWrCache(&dc);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("foobar"), writer_->getString());
|
||||
|
@ -132,9 +134,9 @@ void PieceTest::testGetDigestWithWrCache()
|
|||
memcpy(data, "y", 1);
|
||||
p.updateWrCache(&dc, data, 0, 1, 24);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
(std::string("32d10c7b8cf96570ca04ce37f2a19d84240d3a89"),
|
||||
util::toHex(p.getDigestWithWrCache(p.getLength(), adaptor_)));
|
||||
CPPUNIT_ASSERT_EQUAL(
|
||||
std::string("32d10c7b8cf96570ca04ce37f2a19d84240d3a89"),
|
||||
util::toHex(p.getDigestWithWrCache(p.getLength(), adaptor_)));
|
||||
}
|
||||
|
||||
void PieceTest::testUpdateHash()
|
||||
|
@ -143,16 +145,14 @@ void PieceTest::testUpdateHash()
|
|||
p.setHashType("sha-1");
|
||||
|
||||
std::string spam("SPAM!");
|
||||
CPPUNIT_ASSERT(p.updateHash
|
||||
(0, reinterpret_cast<const unsigned char*>(spam.c_str()),
|
||||
spam.size()));
|
||||
CPPUNIT_ASSERT(p.updateHash(
|
||||
0, reinterpret_cast<const unsigned char*>(spam.c_str()), spam.size()));
|
||||
CPPUNIT_ASSERT(!p.isHashCalculated());
|
||||
|
||||
std::string spamspam("SPAM!SPAM!!");
|
||||
CPPUNIT_ASSERT(p.updateHash
|
||||
(spam.size(),
|
||||
reinterpret_cast<const unsigned char*>(spamspam.c_str()),
|
||||
spamspam.size()));
|
||||
CPPUNIT_ASSERT(p.updateHash(
|
||||
spam.size(), reinterpret_cast<const unsigned char*>(spamspam.c_str()),
|
||||
spamspam.size()));
|
||||
CPPUNIT_ASSERT(p.isHashCalculated());
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("d9189aff79e075a2e60271b9556a710dc1bc7de7"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue