Created
October 9, 2014 12:40
-
-
Save labra/0430c8f00db9f4198421 to your computer and use it in GitHub Desktop.
Ejercicio PHP: factores primos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'primos.php'; | |
class PrimosTest extends PHPUnit_Framework_TestCase | |
{ | |
function test_create_class() { | |
$a = new Primos(); | |
$this->assertTrue(is_a($a, 'Primos')); | |
} | |
// ... | |
/** | |
* @dataProvider factoresProvider | |
*/ | |
public function testFactores($n, $esperados) { | |
$p = new Primos(); | |
$this->assertEquals($esperados, $p->factores($n)); | |
} | |
public function factoresProvider() | |
{ | |
return array( | |
array(1, [1]), | |
array(2, [1,2]), | |
array(3, [1,3]), | |
array(4, [1,2,2]), | |
array(5, [1,5]), | |
array(6, [1,2,3]), | |
array(24, [1,2,2,2,3]), | |
array(25, [1,5,5]), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment