@@ -174,18 +174,38 @@ public function testBytesToHuman()
174
174
$ this ->assertSame ('0 B ' , Number::fileSize (0 ));
175
175
$ this ->assertSame ('0.00 B ' , Number::fileSize (0 , precision: 2 ));
176
176
$ this ->assertSame ('1 B ' , Number::fileSize (1 ));
177
- $ this ->assertSame ('1 KB ' , Number::fileSize (1024 ));
178
- $ this ->assertSame ('2 KB ' , Number::fileSize (2048 ));
179
- $ this ->assertSame ('2.00 KB ' , Number::fileSize (2048 , precision: 2 ));
180
- $ this ->assertSame ('1.23 KB ' , Number::fileSize (1264 , precision: 2 ));
181
- $ this ->assertSame ('1.234 KB ' , Number::fileSize (1264.12345 , maxPrecision: 3 ));
182
- $ this ->assertSame ('1.234 KB ' , Number::fileSize (1264 , 3 ));
183
- $ this ->assertSame ('5 GB ' , Number::fileSize (1024 * 1024 * 1024 * 5 ));
184
- $ this ->assertSame ('10 TB ' , Number::fileSize ((1024 ** 4 ) * 10 ));
185
- $ this ->assertSame ('10 PB ' , Number::fileSize ((1024 ** 5 ) * 10 ));
186
- $ this ->assertSame ('1 ZB ' , Number::fileSize (1024 ** 7 ));
187
- $ this ->assertSame ('1 YB ' , Number::fileSize (1024 ** 8 ));
188
- $ this ->assertSame ('1,024 YB ' , Number::fileSize (1024 ** 9 ));
177
+ $ this ->assertSame ('1 KB ' , Number::fileSize (1000 ));
178
+ $ this ->assertSame ('2 KB ' , Number::fileSize (2000 ));
179
+ $ this ->assertSame ('2.00 KB ' , Number::fileSize (2000 , precision: 2 ));
180
+ $ this ->assertSame ('1.23 KB ' , Number::fileSize (1234 , precision: 2 ));
181
+ $ this ->assertSame ('1.234 KB ' , Number::fileSize (1234 , maxPrecision: 3 ));
182
+ $ this ->assertSame ('1.234 KB ' , Number::fileSize (1234 , 3 ));
183
+ $ this ->assertSame ('5 GB ' , Number::fileSize (1000 * 1000 * 1000 * 5 ));
184
+ $ this ->assertSame ('10 TB ' , Number::fileSize ((1000 ** 4 ) * 10 ));
185
+ $ this ->assertSame ('10 PB ' , Number::fileSize ((1000 ** 5 ) * 10 ));
186
+ $ this ->assertSame ('1 ZB ' , Number::fileSize (1000 ** 7 ));
187
+ $ this ->assertSame ('1 YB ' , Number::fileSize (1000 ** 8 ));
188
+ $ this ->assertSame ('1 RB ' , Number::fileSize (1000 ** 9 ));
189
+ $ this ->assertSame ('1 QB ' , Number::fileSize (1000 ** 10 ));
190
+ $ this ->assertSame ('1,000 QB ' , Number::fileSize (1000 ** 11 ));
191
+
192
+ $ this ->assertSame ('0 B ' , Number::fileSize (0 , useBinaryPrefix: true ));
193
+ $ this ->assertSame ('0.00 B ' , Number::fileSize (0 , precision: 2 , useBinaryPrefix: true ));
194
+ $ this ->assertSame ('1 B ' , Number::fileSize (1 , useBinaryPrefix: true ));
195
+ $ this ->assertSame ('1 KiB ' , Number::fileSize (1024 , useBinaryPrefix: true ));
196
+ $ this ->assertSame ('2 KiB ' , Number::fileSize (2048 , useBinaryPrefix: true ));
197
+ $ this ->assertSame ('2.00 KiB ' , Number::fileSize (2048 , precision: 2 , useBinaryPrefix: true ));
198
+ $ this ->assertSame ('1.23 KiB ' , Number::fileSize (1264 , precision: 2 , useBinaryPrefix: true ));
199
+ $ this ->assertSame ('1.234 KiB ' , Number::fileSize (1264.12345 , maxPrecision: 3 , useBinaryPrefix: true ));
200
+ $ this ->assertSame ('1.234 KiB ' , Number::fileSize (1264 , 3 , useBinaryPrefix: true ));
201
+ $ this ->assertSame ('5 GiB ' , Number::fileSize (1024 * 1024 * 1024 * 5 , useBinaryPrefix: true ));
202
+ $ this ->assertSame ('10 TiB ' , Number::fileSize ((1024 ** 4 ) * 10 , useBinaryPrefix: true ));
203
+ $ this ->assertSame ('10 PiB ' , Number::fileSize ((1024 ** 5 ) * 10 , useBinaryPrefix: true ));
204
+ $ this ->assertSame ('1 ZiB ' , Number::fileSize (1024 ** 7 , useBinaryPrefix: true ));
205
+ $ this ->assertSame ('1 YiB ' , Number::fileSize (1024 ** 8 , useBinaryPrefix: true ));
206
+ $ this ->assertSame ('1 RiB ' , Number::fileSize (1024 ** 9 , useBinaryPrefix: true ));
207
+ $ this ->assertSame ('1 QiB ' , Number::fileSize (1024 ** 10 , useBinaryPrefix: true ));
208
+ $ this ->assertSame ('1,024 QiB ' , Number::fileSize (1024 ** 11 , useBinaryPrefix: true ));
189
209
}
190
210
191
211
public function testClamp ()
0 commit comments