public function test_size_format() { $size = util::size_format(512, 0); $this->assertEquals('512 B', $size); $size = util::size_format(2048, 1); $this->assertEquals('2.0 KiB', $size); $size = util::size_format(25151251, 2); $this->assertEquals('23.99 MiB', $size); $size = util::size_format(19971597926.0, 2); $this->assertEquals('18.60 GiB', $size); $size = util::size_format(2748779069440.0, 1); $this->assertEquals('2.5 TiB', $size); $size = util::size_format(2814750000000000.0, 1); $this->assertEquals('2.5 PiB', $size); $size = util::size_format(2.81475E+19, 1); $this->assertEquals('25000.0 PiB', $size); }