-
Notifications
You must be signed in to change notification settings - Fork 0
/
CalculatorTest.php
35 lines (27 loc) · 1.01 KB
/
CalculatorTest.php
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
<?php
class CalculatorTest extends PHPUnit_Framework_TestCase {
public function setUp() {
require_once 'Calculator.php';
}
public function testAdd() {
$this->assertEquals(4, Calculator::add(2, 2));
$this->assertEquals(100, Calculator::add(81, 19));
$this->assertEquals(23, Calculator::add(20, 3));
}
public function testSubtract() {
$this->assertEquals(-3, Calculator::subtract(4, 7));
$this->assertEquals(0, Calculator::subtract(6, 6));
$this->assertEquals(7, Calculator::subtract(4, -3));
}
public function testMultiply() {
$this->assertEquals(63, Calculator::multiply(9, 7));
$this->assertEquals(-14, Calculator::multiply(2, -7));
$this->assertEquals(35, Calculator::multiply(-5, -7));
}
public function testDivide() {
$this->assertEquals(1, Calculator::divide(9, 9));
$this->assertEquals(3, Calculator::divide(-9, -3));
$this->assertEquals(-5, Calculator::divide(-10, 2));
}
}
?>