Created
May 14, 2012 03:52
-
-
Save suzuken/2691689 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* | |
*/ | |
class testTriangle extends PHPUnitTestCase | |
{ | |
public function set_up() | |
{ | |
} | |
public function testCreateTriangle($a, $b, $c) | |
{ | |
$this->assertTrue($a); | |
$this->assertTrue($b); | |
$this->assertTrue($c); | |
$this->assertTrue(triangle($a, $b, $c); | |
$this->assertTrue(triangle($b, $c, $a); | |
$this->assertTrue(triangle($c, $a, $b); | |
if (is正三角形) { | |
$this->assertEquals(createTriangle($a, $b, $c), "正三角形"); | |
} | |
if (isに) { | |
<`0:# code...`> | |
} | |
$this->assertEquals(createTriangle($a, $b, $c), "不等辺三角形"); | |
$this->assertEquals(createTriangle($a, $b, $c), "二等辺三角形"); | |
} | |
public function validate($t) | |
{ | |
if (!is_int($t)) { | |
return false; | |
} | |
if ($t >= 1 && $t <= 100) { | |
return true; | |
} | |
else { | |
return false; | |
} | |
} | |
public function triangle($a, $b, $c) | |
{ | |
if ($a + $b <= $c) { | |
return false; | |
} | |
else { | |
return true; | |
} | |
} | |
public function is不等辺三角形($a, $b, $c) | |
{ | |
if ($a != $b && $b != $c && $c!=$a) { | |
return true; | |
} | |
else { | |
return false; | |
} | |
} | |
public function is二等辺三角形($a, $b, $c) | |
{ | |
if (($a == $b && $a!=$c) | |
&& ($b == $c && $a!=$b) | |
&& ($c==$a && $c!=$b)) { | |
return true; | |
} | |
else { | |
return false; | |
} | |
} | |
public function is正三角形($a, $b, $c) | |
{ | |
if ($a = $b && $b==$c && $c==$a) { | |
return true; | |
} | |
else { | |
return false; | |
} | |
} | |
public function tearDown() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment