Changed threshold of using upper unit for abbrevSize

pull/43/head
Tatsuhiro Tsujikawa 2012-12-19 23:58:24 +09:00
parent 07bb779eb0
commit b017e80438
2 changed files with 2 additions and 3 deletions

View File

@ -1302,7 +1302,7 @@ std::string abbrevSize(int64_t size)
r = d.rem;
++uidx;
}
if(uidx+1 < sizeof(UNITS)/sizeof(UNITS[0]) && t >= 512) {
if(uidx+1 < sizeof(UNITS)/sizeof(UNITS[0]) && t >= 922) {
++uidx;
r = t;
t = 0;

View File

@ -1555,7 +1555,6 @@ void UtilTest::testAbbrevSize()
CPPUNIT_ASSERT_EQUAL(std::string("4.0Gi"), util::abbrevSize(4294967296LL));
CPPUNIT_ASSERT_EQUAL(std::string("1.0Ki"), util::abbrevSize(1024));
CPPUNIT_ASSERT_EQUAL(std::string("0.9Ki"), util::abbrevSize(1023));
CPPUNIT_ASSERT_EQUAL(std::string("0.5Ki"), util::abbrevSize(512));
CPPUNIT_ASSERT_EQUAL(std::string("511"), util::abbrevSize(511));
CPPUNIT_ASSERT_EQUAL(std::string("0"), util::abbrevSize(0));
CPPUNIT_ASSERT_EQUAL(std::string("1.1Ki"), util::abbrevSize(1127));
@ -1582,7 +1581,7 @@ void UtilTest::testToStream()
" |12KiB (12,300)\n"
"---+---------------------------------------------------------------------------\n"
" 2|aria2.txt\n"
" |0.5KiB (556)\n"
" |556B (556)\n"
"---+---------------------------------------------------------------------------\n"),
readFile(filename));
}