forked from exercism/php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquareRootTest.php
More file actions
76 lines (65 loc) · 1.8 KB
/
Copy pathSquareRootTest.php
File metadata and controls
76 lines (65 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\TestDox;
class SquareRootTest extends TestCase
{
public static function setUpBeforeClass(): void
{
require_once 'SquareRoot.php';
}
#[TestDox('does not use or mention PHP square root functions')]
public function testDoesNotUseOrMentionPhpSquareRootFunctions(): void
{
$code = file_get_contents(__DIR__ . '/SquareRoot.php');
$this->assertStringNotContainsString('sqrt', $code, 'Please do not use the word "sqrt" anywhere in your code!');
}
/**
* uuid: 9b748478-7b0a-490c-b87a-609dacf631fd
*/
#[TestDox('root of 1')]
public function testRootOfOne(): void
{
$this->assertEquals(1, squareRoot(1));
}
/**
* uuid: 7d3aa9ba-9ac6-4e93-a18b-2e8b477139bb
*/
#[TestDox('root of 4')]
public function testRootOfFour(): void
{
$this->assertEquals(2, squareRoot(4));
}
/**
* uuid: 6624aabf-3659-4ae0-a1c8-25ae7f33c6ef
*/
#[TestDox('root of 25')]
public function testRootOfTwentyFive(): void
{
$this->assertEquals(5, squareRoot(25));
}
/**
* uuid: 93beac69-265e-4429-abb1-94506b431f81
*/
#[TestDox('root of 81')]
public function testRootOfEightyOne(): void
{
$this->assertEquals(9, squareRoot(81));
}
/**
* uuid: fbddfeda-8c4f-4bc4-87ca-6991af35360e
*/
#[TestDox('root of 196')]
public function testRootOfOneHundredNinetySix(): void
{
$this->assertEquals(14, squareRoot(196));
}
/**
* uuid: c03d0532-8368-4734-a8e0-f96a9eb7fc1d
*/
#[TestDox('root of 65025')]
public function testRootOfSixtyFiveThousandTwentyFive(): void
{
$this->assertEquals(255, squareRoot(65025));
}
}