3 include_once dirname(__FILE__).
'/Complex.php';
12 if ($expected{0} ===
'#') {
14 if ($expected === $actual) {
17 $this->_errorMessage =
'Expected Error: ' .
18 $actual .
' !== ' . $expected;
22 $expectedComplex =
new Complex($expected);
23 $actualComplex =
new Complex($actual);
25 if (!is_numeric($actualComplex->getReal()) || !is_numeric($expectedComplex->getReal())) {
26 if ($actualComplex->getReal() !== $expectedComplex->getReal()) {
27 $this->_errorMessage =
'Mismatched String: ' .
28 $actualComplex->getReal() .
' !== ' . $expectedComplex->getReal();
34 if ($actualComplex->getReal() < ($expectedComplex->getReal() - $delta) ||
35 $actualComplex->getReal() > ($expectedComplex->getReal() + $delta)) {
36 $this->_errorMessage =
'Mismatched Real part: ' .
37 $actualComplex->getReal() .
' != ' . $expectedComplex->getReal();
41 if ($actualComplex->getImaginary() < ($expectedComplex->getImaginary() - $delta) ||
42 $actualComplex->getImaginary() > ($expectedComplex->getImaginary() + $delta)) {
43 $this->_errorMessage =
'Mismatched Imaginary part: ' .
44 $actualComplex->getImaginary() .
' != ' . $expectedComplex->getImaginary();
48 if ($actualComplex->getSuffix() !== $actualComplex->getSuffix()) {
49 $this->_errorMessage =
'Mismatched Suffix: ' .
50 $actualComplex->getSuffix() .
' != ' . $expectedComplex->getSuffix();
assertComplexEquals($expected, $actual, $delta=0)