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