Skip to content

Commit e83cf38

Browse files
committed
Add test case for #26
1 parent cb77498 commit e83cf38

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ mod tests {
450450
assert_to_string("301.0 KB", ByteSize::kb(301), false);
451451

452452
assert_to_string("1.0 MiB", ByteSize::mib(1), true);
453-
assert_to_string("1048.6 KB", ByteSize::mib(1), false);
453+
assert_to_string("1.0 MB", ByteSize::mib(1), false);
454454

455455
// a bug case: https://github.com/flang-project/bytesize/issues/8
456456
assert_to_string("1.9 GiB", ByteSize::mib(1907), true);
@@ -467,6 +467,12 @@ mod tests {
467467

468468
assert_to_string("540.9 PiB", ByteSize::pb(609), true);
469469
assert_to_string("609.0 PB", ByteSize::pb(609), false);
470+
471+
// a bug case: https://github.com/hyunsik/bytesize/issues/26
472+
assert_to_string("940.0 GiB", ByteSize::gib(940), true);
473+
assert_to_string("940.0 GB", ByteSize::gb(940), false);
474+
assert_to_string("1.1 TiB", ByteSize::gib(1090), true);
475+
assert_to_string("1.1 TB", ByteSize::gb(1090), false);
470476
}
471477

472478
#[test]

0 commit comments

Comments
 (0)