1234567891011121314151617181920212223 |
- <?php
- use PHPUnit\Framework\TestCase;
- require_once __DIR__ . "/countthedivisors.php";
- class TestDivisorsCase extends TestCase {
- public function testCountTheDivisors() {
- $checks = [
- [1, 1],
- [4, 3],
- [12, 6],
- [30, 8],
- [500000, 42],
- ];
- foreach ($checks as $check) {
- $expected = $check[1];
- $actual = divisors($check[0]);
- $this->assertEquals($expected, $actual, $check[0]);
- }
- }
- }
|