diff --git a/DIRECTORY.md b/DIRECTORY.md index c1ece342..68b24658 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -43,8 +43,10 @@ * [Absolutemin](./Maths/AbsoluteMin.php) * [Armstrongnumber](./Maths/ArmstrongNumber.php) * [Basex](./Maths/BaseX.php) + * [CheckEven](./Maths/CheckEven.php) * [Checkpalindrome](./Maths/CheckPalindrome.php) * [Checkprime](./Maths/CheckPrime.php) + * [CheckOdd](./Maths/CheckOdd.php) * [Eratosthenessieve](./Maths/EratosthenesSieve.php) * [Factorial](./Maths/Factorial.php) * [Fastexponentiation](./Maths/FastExponentiation.php) diff --git a/Maths/CheckEven.php b/Maths/CheckEven.php new file mode 100644 index 00000000..a53b8861 --- /dev/null +++ b/Maths/CheckEven.php @@ -0,0 +1,13 @@ +assertTrue(isEven(2)); + $this->assertTrue(isEven(0)); + $this->assertFalse(isEven(3)); + $this->assertFalse(isEven(17)); + $this->assertTrue(isEven(-4)); + } + public function testIsNumberArmstrong() { $this->assertTrue(isNumberArmstrong(153)); @@ -56,6 +67,15 @@ public function testIsNumberPalindromic() $this->assertFalse(isNumberPalindromic(2468)); } + public function testIsOdd() + { + $this->assertTrue(isOdd(3)); + $this->assertTrue(isOdd(17)); + $this->assertFalse(isOdd(4)); + $this->assertFalse(isOdd(0)); + $this->assertTrue(isOdd(-5)); + } + public function testIsPrime() { $this->assertTrue(isPrime(73));