Use user-defined literal for k, m, and g (powers of 1024)

This commit is contained in:
Tatsuhiro Tsujikawa 2015-06-21 18:04:30 +09:00
parent 8ba9b04747
commit 318c804504
99 changed files with 482 additions and 453 deletions

View file

@ -25,9 +25,9 @@ CPPUNIT_TEST_SUITE_REGISTRATION( GrowSegmentTest );
void GrowSegmentTest::testUpdateWrittenLength()
{
GrowSegment segment(std::shared_ptr<Piece>(new Piece()));
segment.updateWrittenLength(32*1024);
segment.updateWrittenLength(32_k);
CPPUNIT_ASSERT_EQUAL((int64_t)32*1024, segment.getPositionToWrite());
CPPUNIT_ASSERT_EQUAL((int64_t)32_k, segment.getPositionToWrite());
CPPUNIT_ASSERT(!segment.complete());
CPPUNIT_ASSERT(segment.getPiece()->pieceComplete());
}
@ -35,8 +35,8 @@ void GrowSegmentTest::testUpdateWrittenLength()
void GrowSegmentTest::testClear()
{
GrowSegment segment(std::shared_ptr<Piece>(new Piece()));
segment.updateWrittenLength(32*1024);
CPPUNIT_ASSERT_EQUAL((int64_t)32*1024, segment.getWrittenLength());
segment.updateWrittenLength(32_k);
CPPUNIT_ASSERT_EQUAL((int64_t)32_k, segment.getWrittenLength());
segment.clear(nullptr);
CPPUNIT_ASSERT_EQUAL((int64_t)0, segment.getWrittenLength());
}