コード例 #1
0
ファイル: RealTest.php プロジェクト: cermat/valueobjects
 public function testToNatural()
 {
     $real = new Real(3.14);
     $nativeNatural = new Natural(3);
     $natural = $real->toNatural();
     $this->assertTrue($natural->sameValueAs($nativeNatural));
 }
コード例 #2
0
ファイル: RealTest.php プロジェクト: valueobjects/number
 public function testNegativeToNaturalHalfUp()
 {
     $real = new Real(-0.5);
     $natural = $real->toNatural(RoundingMode::HALF_UP());
     $this->assertInstanceOf(Natural::class, $natural);
     $this->assertSame(1, $natural->value());
 }