eg.ArithmeticColumnFixture | |||||
x | y | plus() | times() | divide() | floating() |
2 | 3 | 5 | 6 | 0 | 0.666666666667 |
0 | 0 | 0 | 0 | error | error |
0 | 0 | 0 | 0 | 0 | 0 |
200 | 300 | 500 | 60000 | 0 | 0.666666666667 |
2 | 3 | 10 | 10 | 10 | |
200 | 3 | 5 | 6 | 0 | 66.6666667 |
2 | -3 | -1 | -6 | 0 | -0.666666666667 |
public function plus() {
return intval($this->x + $this->y);
}
public function times() {
return intval($this->x * $this->y);
}
public function divide() {
if ($this->y == 0)
throw new Exception( "ArithmeticException: / by zero" );
return intval($this->x / $this->y);
}
public function floating() {
if ($this->y == 0)
throw new Exception( "ArithmeticException: / by zero" );
return floatval($this->x / $this->y);
}
Document prepaired by Ward Cunningham
First Version July 11, 2002
Last Update August 17, 2002