Index: trunk/phase3/tests/phpunit/languages/LanguageTest.php |
— | — | @@ -286,4 +286,46 @@ |
287 | 287 | // How big!? THIS BIG! |
288 | 288 | ); |
289 | 289 | } |
| 290 | + |
| 291 | + /** |
| 292 | + * @dataProvider provideFormatBitrate |
| 293 | + */ |
| 294 | + function testFormatBitrate( $bps, $expected, $msg ) { |
| 295 | + $this->assertEquals( |
| 296 | + $expected, |
| 297 | + $this->lang->formatBitrate( $bps ), |
| 298 | + "formatBitrate('$bps'): $msg" |
| 299 | + ); |
| 300 | + } |
| 301 | + |
| 302 | + function provideFormatBitrate() { |
| 303 | + return array( |
| 304 | + array( |
| 305 | + 0, |
| 306 | + "0bps", |
| 307 | + "0 bytes per second" |
| 308 | + ), |
| 309 | + array( |
| 310 | + 1024, |
| 311 | + "1kbps", |
| 312 | + "1 kilobyte per second" |
| 313 | + ), |
| 314 | + array( |
| 315 | + 1024 * 1024, |
| 316 | + "1Mbps", |
| 317 | + "1 megabyte per second" |
| 318 | + ), |
| 319 | + // Test commented out as currently resulting in 1.1Gbps |
| 320 | +// array( |
| 321 | +// 1024 * 1024 * 1024, |
| 322 | +// "1Gbps", |
| 323 | +// "1 gigabyte per second" |
| 324 | +// ), |
| 325 | + array( |
| 326 | + 1024 * 1024 * 1024 * 1024, |
| 327 | + "1,024Gbps", |
| 328 | + "1,024 gigabytes per second" |
| 329 | + ), |
| 330 | + ); |
| 331 | + } |
290 | 332 | } |