vd/tests/ExampleTest.php
2019-01-29 17:22:52 +08:00

18 lines
834 B
PHP

<?php
require_once realpath(dirname(__FILE__) . '/TestCase.php');
echo human_filesize(20*pow(1024, 0), 2) . PHP_EOL;
echo human_filesize(20*pow(1024, 1), 2) . PHP_EOL;
echo human_filesize(20*pow(1024, 2), 2) . PHP_EOL;
echo human_filesize(20*pow(1024, 3), 2) . PHP_EOL;
echo human_filesize(20*pow(1024, 4), 2) . PHP_EOL;
echo PHP_EOL;
echo human_filesize(20*pow(1024, 0), 2, ['unit' => 'KB', 'min' => 'MB', 'max' => 'GB']) . PHP_EOL;
echo human_filesize(20*pow(1024, 1), 2, ['unit' => 'KB', 'min' => 'MB', 'max' => 'GB']) . PHP_EOL;
echo human_filesize(20*pow(1024, 2), 2, ['unit' => 'KB', 'min' => 'MB', 'max' => 'GB']) . PHP_EOL;
echo human_filesize(20*pow(1024, 3), 2, ['unit' => 'KB', 'min' => 'MB', 'max' => 'GB']) . PHP_EOL;
echo human_filesize(20*pow(1024, 4), 2, ['unit' => 'KB', 'min' => 'MB', 'max' => 'GB']) . PHP_EOL;