forked from phpbb/phpbb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_formatted_filesize_test.php
More file actions
75 lines (64 loc) · 1.74 KB
/
Copy pathget_formatted_filesize_test.php
File metadata and controls
75 lines (64 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_get_formatted_filesize_test extends phpbb_test_case
{
public function get_formatted_filesize_test_data()
{
return array(
// exact powers of 2
array(1, '1 BYTES'),
array(1024, '1 KIB'),
array(1048576, '1 MIB'),
array(1073741824, '1 GIB'),
array(1099511627776, '1 TIB'),
// exact powers of 10
array(1000, '1000 BYTES'),
array(1000000, '976.56 KIB'),
array(1000000000, '953.67 MIB'),
array(1000000000000, '931.32 GIB'),
array(100000000000000, '90.95 TIB'),
array(0, '0 BYTES'),
array(2, '2 BYTES'),
array(1023, '1023 BYTES'),
array(1025, '1 KIB'),
array(1048575, '1024 KIB'),
// String values
// exact powers of 2
array('1', '1 BYTES'),
array('1024', '1 KIB'),
array('1048576', '1 MIB'),
array('1073741824', '1 GIB'),
array('1099511627776', '1 TIB'),
// exact powers of 10
array('1000', '1000 BYTES'),
array('1000000', '976.56 KIB'),
array('1000000000', '953.67 MIB'),
array('1000000000000', '931.32 GIB'),
array('100000000000000', '90.95 TIB'),
array('0', '0 BYTES'),
array('2', '2 BYTES'),
array('1023', '1023 BYTES'),
array('1025', '1 KIB'),
array('1048575', '1024 KIB'),
);
}
/**
* @dataProvider get_formatted_filesize_test_data
*/
public function test_get_formatted_filesize($input, $expected)
{
$output = get_formatted_filesize($input);
$this->assertEquals($expected, $output);
}
}