mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-01 04:41:38 +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();
|
uint64_t capacity = GetBlockCount() * GetSectorSizeInBytes();
|
||||||
string unit;
|
string unit;
|
||||||
|
|
||||||
// 10 GiB and more
|
// 10,000 MiB and more
|
||||||
if (capacity >= 1'099'511'627'776) {
|
if (capacity >= 10'485'760'000) {
|
||||||
capacity /= 1'099'511'627'776;
|
capacity /= 1'073'741'824;
|
||||||
unit = "GiB";
|
unit = "GiB";
|
||||||
}
|
}
|
||||||
// 1 MiB and more
|
// 1 MiB and more
|
||||||
|
|
|
@ -69,10 +69,10 @@ TEST(ScsiHdTest, GetProductData)
|
||||||
|
|
||||||
hd_gb.SetFilename(string(filename));
|
hd_gb.SetFilename(string(filename));
|
||||||
hd_gb.SetSectorSizeInBytes(1024);
|
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);
|
hd_gb.FinalizeSetup(0);
|
||||||
s = hd_gb.GetProduct();
|
s = hd_gb.GetProduct();
|
||||||
EXPECT_NE(string::npos, s.find("1 GiB"));
|
EXPECT_NE(string::npos, s.find("10 GiB"));
|
||||||
remove(filename);
|
remove(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user