mirror of
https://github.com/akuker/RASCSI.git
synced 2024-05-31 13:41:30 +00:00
For HD Product name, use GiB unit from 10,000 Mib and higher. (#1147)
* For HD Product name, use GiB unit from 10,000 Mib and higher. * Update unit test
This commit is contained in:
parent
8dd5071122
commit
3cceb515cd
|
@ -36,9 +36,9 @@ string SCSIHD::GetProductData() const
|
|||
uint64_t capacity = GetBlockCount() * GetSectorSizeInBytes();
|
||||
string unit;
|
||||
|
||||
// 10 GiB and more
|
||||
if (capacity >= 1'099'511'627'776) {
|
||||
capacity /= 1'099'511'627'776;
|
||||
// 10,000 MiB and more
|
||||
if (capacity >= 10'485'760'000) {
|
||||
capacity /= 1'073'741'824;
|
||||
unit = "GiB";
|
||||
}
|
||||
// 1 MiB and more
|
||||
|
|
|
@ -69,10 +69,10 @@ TEST(ScsiHdTest, GetProductData)
|
|||
|
||||
hd_gb.SetFilename(string(filename));
|
||||
hd_gb.SetSectorSizeInBytes(1024);
|
||||
hd_gb.SetBlockCount(1'099'511'627'776 / 1024);
|
||||
hd_gb.SetBlockCount(10'737'418'240 / 1024);
|
||||
hd_gb.FinalizeSetup(0);
|
||||
s = hd_gb.GetProduct();
|
||||
EXPECT_NE(string::npos, s.find("1 GiB"));
|
||||
EXPECT_NE(string::npos, s.find("10 GiB"));
|
||||
remove(filename);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user