예제 #1
0
파일: Math.php 프로젝트: philipbrown/math
 /**
  * Find the modulus of two numbers
  *
  * @param mixed $operant
  * @param mixed $modulus
  * @return Number
  */
 public static function modulus($operand, $modulus)
 {
     $operand = new AnyNumber($operand);
     $modulus = new AnyNumber($modulus);
     $command = new ModulusCommand($operand, $modulus);
     return $command->run();
 }
예제 #2
0
 /** @test */
 public function should_find_the_modulus_of_two_numbers()
 {
     $command = new ModulusCommand(new AnyNumber(242342.4532), new AnyNumber(44.6643));
     $total = $command->run();
     $this->assertInstanceOf('PhilipBrown\\Math\\Number', $total);
     $this->assertEquals(34, $total->value());
 }