Skip to content

Commit

Permalink
add additional unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akitson-fu committed Jul 27, 2014
1 parent 35107ac commit cefa227
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/src/chippyash/Type/Number/Complex/ComplexTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ public function testIsGaussianForOnePartNotBeingIntegerValuesReturnsFalse()
$this->assertFalse($c2->isGaussian());
}

public function testConjugateReturnsCorrectComplexType()
{
$c = new ComplexType(new FloatType(2), new FloatType(3));
$conj = $c->conjugate();
$this->assertInstanceOf(
'chippyash\Type\Number\Complex\ComplexType',
$conj);
$this->assertEquals(2, $conj->r());
$this->assertEquals(-3, $conj->i());
}

public function testModulusForZeroComplexNumberIsZero()
{
$c = new ComplexType(new FloatType(0), new FloatType(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,11 @@ public function testFromFloatUsesAcceptsFloatTypeToleranceValue()
'78256779/245850922',
(string) RationalTypeFactory::fromFloat(M_1_PI, new FloatType(1e-17)));
}

public function testFromFloatWithZeroValueReturnsFloatType()
{
$this->assertEquals(
'0/1',
(string) RationalTypeFactory::fromFloat(0.0));
}
}

0 comments on commit cefa227

Please sign in to comment.