mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-04-18 21:48:24 -04:00
Switch from binary bytes to SI-units
This commit is contained in:
+31
-31
@@ -23,36 +23,36 @@ class FilterTest extends TestCase
|
||||
public function testFilterMakesSizesHumanlyReadable()
|
||||
{
|
||||
$this->assertEquals('1 B', Filter::formatHumanReadableSize(1));
|
||||
$this->assertEquals('1 000 B', Filter::formatHumanReadableSize(1000));
|
||||
$this->assertEquals('1.00 KiB', Filter::formatHumanReadableSize(1024));
|
||||
$this->assertEquals('1.21 KiB', Filter::formatHumanReadableSize(1234));
|
||||
$exponent = 1024;
|
||||
$this->assertEquals('1 000.00 KiB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.00 MiB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.21 MiB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1024;
|
||||
$this->assertEquals('1 000.00 MiB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.00 GiB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.21 GiB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1024;
|
||||
$this->assertEquals('1 000.00 GiB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.00 TiB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.21 TiB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1024;
|
||||
$this->assertEquals('1 000.00 TiB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.00 PiB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.21 PiB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1024;
|
||||
$this->assertEquals('1 000.00 PiB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.00 EiB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.21 EiB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1024;
|
||||
$this->assertEquals('1 000.00 EiB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.00 ZiB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.21 ZiB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1024;
|
||||
$this->assertEquals('1 000.00 ZiB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.00 YiB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.21 YiB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$this->assertEquals('1.00 kB', Filter::formatHumanReadableSize(1000));
|
||||
$this->assertEquals('1.02 kB', Filter::formatHumanReadableSize(1024));
|
||||
$this->assertEquals('1.23 kB', Filter::formatHumanReadableSize(1234));
|
||||
$exponent = 1000;
|
||||
$this->assertEquals('1.00 MB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.02 MB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.23 MB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1000;
|
||||
$this->assertEquals('1.00 GB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.02 GB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.23 GB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1000;
|
||||
$this->assertEquals('1.00 TB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.02 TB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.23 TB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1000;
|
||||
$this->assertEquals('1.00 PB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.02 PB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.23 PB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1000;
|
||||
$this->assertEquals('1.00 EB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.02 EB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.23 EB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1000;
|
||||
$this->assertEquals('1.00 ZB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.02 ZB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.23 ZB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
$exponent *= 1000;
|
||||
$this->assertEquals('1.00 YB', Filter::formatHumanReadableSize(1000 * $exponent));
|
||||
$this->assertEquals('1.02 YB', Filter::formatHumanReadableSize(1024 * $exponent));
|
||||
$this->assertEquals('1.23 YB', Filter::formatHumanReadableSize(1234 * $exponent));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user