Created
October 9, 2014 13:43
-
-
Save labra/507059826c2bd2e9b694 to your computer and use it in GitHub Desktop.
Ejercicio PHP figuras
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 'figuras.php'; | |
class FigurasTest extends PHPUnit_Framework_TestCase | |
{ | |
function test_create_class() { | |
$f = new Rect(1,2,3,4); | |
$this->assertTrue(is_a($f, 'Rect')); | |
} | |
// ... | |
function test_pos() { | |
$rect = new Rect(1,2,3,4); | |
$this->assertEquals([1,2],$rect->pos()); | |
} | |
// ... | |
function test_area_rect() { | |
$rect = new Rect(1,2,3,4); | |
$this->assertEquals(12,$rect->area()); | |
} | |
// ... | |
function test_area_circulo() { | |
$circ = new Circulo(1,2,3); | |
$this->assertEquals(28.27,$circ->area(),'',0.1); | |
} | |
// ... | |
function test_mover_circulo() { | |
$circ = new Circulo(1,2,3); | |
$circ->mover(3,2); | |
$this->assertEquals([4,4],$circ->pos()); | |
} | |
function test_suma_areas() { | |
$figuras = [ new Rect(1,2,3,4), | |
new Circulo(0,0,3), | |
new Rect(2,2,4,4)] ; | |
$this->assertEquals(56.27,areaFiguras($figuras),'',0.1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment