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

@ -611,8 +611,7 @@ void RpcMethodTest::testChangeOption()
auto option = group->getOption();
CPPUNIT_ASSERT_EQUAL(0, res.code);
CPPUNIT_ASSERT_EQUAL(100*1024,
group->getMaxDownloadSpeedLimit());
CPPUNIT_ASSERT_EQUAL((int)100_k, group->getMaxDownloadSpeedLimit());
CPPUNIT_ASSERT_EQUAL(std::string("102400"),
option->get(PREF_MAX_DOWNLOAD_LIMIT));
#ifdef ENABLE_BITTORRENT
@ -624,8 +623,7 @@ void RpcMethodTest::testChangeOption()
e_->getBtRegistry()->get(group->getGID())
->btRuntime->getMaxPeers());
CPPUNIT_ASSERT_EQUAL(50*1024,
group->getMaxUploadSpeedLimit());
CPPUNIT_ASSERT_EQUAL((int)50_k, group->getMaxUploadSpeedLimit());
CPPUNIT_ASSERT_EQUAL(std::string("51200"),
option->get(PREF_MAX_UPLOAD_LIMIT));
#endif // ENABLE_BITTORRENT
@ -683,15 +681,13 @@ void RpcMethodTest::testChangeGlobalOption()
auto res = m.execute(std::move(req), e_.get());
CPPUNIT_ASSERT_EQUAL(0, res.code);
CPPUNIT_ASSERT_EQUAL
(100*1024,
e_->getRequestGroupMan()->getMaxOverallDownloadSpeedLimit());
CPPUNIT_ASSERT_EQUAL(
(int)100_k, e_->getRequestGroupMan()->getMaxOverallDownloadSpeedLimit());
CPPUNIT_ASSERT_EQUAL(std::string("102400"),
e_->getOption()->get(PREF_MAX_OVERALL_DOWNLOAD_LIMIT));
#ifdef ENABLE_BITTORRENT
CPPUNIT_ASSERT_EQUAL
(50*1024,
e_->getRequestGroupMan()->getMaxOverallUploadSpeedLimit());
CPPUNIT_ASSERT_EQUAL(
(int)50_k, e_->getRequestGroupMan()->getMaxOverallUploadSpeedLimit());
CPPUNIT_ASSERT_EQUAL(std::string("51200"),
e_->getOption()->get(PREF_MAX_OVERALL_UPLOAD_LIMIT));
#endif // ENABLE_BITTORRENT