VectorUtiilsSubtractTest::testSubtract()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace PHP\Math\VectorTest;
4
5
use PHP\Math\Vector\Vector;
6
use PHP\Math\Vector\VectorUtils;
7
use PHPUnit_Framework_TestCase;
8
9
class VectorUtiilsSubtractTest extends PHPUnit_Framework_TestCase
10
{
11
    public function testSubtract()
12
    {
13
        // Arrange
14
        $lft = new Vector(array(10, 20, 30));
15
        $rgt = new Vector(array(5, 5, 5));
16
17
        // Act
18
        $result = VectorUtils::subtract($lft, $rgt);
19
20
        // Assert
21
        $this->assertInstanceOf('PHP\Math\Vector\Vector', $result);
22
        $this->assertEquals('[5.0000000000, 15.0000000000, 25.0000000000]', (string)$result);
23
        $this->assertEquals('[10.0000000000, 20.0000000000, 30.0000000000]', (string)$lft);
24
        $this->assertEquals('[5.0000000000, 5.0000000000, 5.0000000000]', (string)$rgt);
25
    }
26
27
    /**
28
     * @expectedException InvalidArgumentException
29
     */
30
    public function testSubtractInvalid()
31
    {
32
        // Arrange
33
        $lft = new Vector(array(10, 20, 30));
34
        $rgt = new Vector(array(5, 5, 5, 5));
35
36
        // Act
37
        VectorUtils::subtract($lft, $rgt);
38
39
        // Assert
40
        // ...
41
    }
42
}
43