Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support "Mebibytes" which is the full name of the MiB unit.
  • Loading branch information
GrahamDennis committed Nov 24, 2019
commit e4f85e49e170b546da60b14489b6a19e7f5ec9e9
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ private static Map<String, ByteUnit> createSuffixes() {
suffixes.put("kibibyte", ByteUnit.KiB);
suffixes.put("m", ByteUnit.MiB);
suffixes.put("mb", ByteUnit.MiB);
// Required for backwards compatibility. "mibibyte" isn't a real unit
suffixes.put("mibibyte", ByteUnit.MiB);
suffixes.put("mebibyte", ByteUnit.MiB);
suffixes.put("g", ByteUnit.GiB);
suffixes.put("gb", ByteUnit.GiB);
suffixes.put("gibibyte", ByteUnit.GiB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public void testParseMibiBytes() {
assetStringsEqualToBytes((long) Math.pow(1024L, 2L) * 10L, "10m", "10mb", "10 mibibyte", "10 mibibytes");
}

@Test
public void testParseMebiBytes() {
assetStringsEqualToBytes((long) Math.pow(1024L, 2L) * 10L, "10m", "10mb", "10 mebibyte", "10 mebibytes");
}

@Test
public void testParseGibiBytes() {
assetStringsEqualToBytes((long) Math.pow(1024L, 3L) * 10L, "10g", "10gb", "10 gibibyte", "10 gibibytes");
Expand Down