Completed
Push — master ( 932683...ea80b7 )
by Jacob
04:03
created

DisplayTest::testGetReadableMemory()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 12
rs 9.4286
cc 2
eloc 7
nc 2
nop 0
1
<?php
2
3
namespace Particletree\Pqp;
4
5
use PHPUnit_Framework_TestCase;
6
7
class DisplayTest extends PHPUnit_Framework_TestCase
8
{
9
10
    public function testGetReadableTime()
11
    {
12
        $test_input = array(
13
            '.032432' => '32.432 ms',
14
            '24.3781' => '24.378 s',
15
            '145.123' => '2.419 m'
16
        );
17
18
        foreach ($test_input as $input => $expected_return) {
19
            $this->assertEquals($expected_return, Display::getReadableTime($input));
20
        }
21
    }
22
23
    public function testGetReadableMemory()
24
    {
25
        $test_input = array(
26
            '314'     => '314 b',
27
            '7403'    => '7.23 k',
28
            '2589983' => '2.47 M'
29
        );
30
31
        foreach ($test_input as $input => $expected_return) {
32
            $this->assertEquals($expected_return, Display::getReadableMemory($input));
33
        }
34
    }
35
}
36