Skip to content

Instantly share code, notes, and snippets.

@suzuken
Created May 14, 2012 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suzuken/2691689 to your computer and use it in GitHub Desktop.
Save suzuken/2691689 to your computer and use it in GitHub Desktop.
<?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