-
-
Notifications
You must be signed in to change notification settings - Fork 568
Expand file tree
/
Copy pathRemoveDuplicateCharactersTest.php
More file actions
71 lines (61 loc) · 1.79 KB
/
RemoveDuplicateCharactersTest.php
File metadata and controls
71 lines (61 loc) · 1.79 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
<?php
declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . '/../../Strings/RemoveDuplicateCharacters.php';
use PHPUnit\Framework\TestCase;
/**
* Unit tests for the removeDuplicateCharacters function.
* To run test: ./vendor/bin/phpunit tests/strings/removeDuplicateCharactersTest.php
*/
final class removeDuplicateCharactersTest extends TestCase
{
/**
* Test with a string that has multiple duplicates.
*/
public function testStringWithDuplicates(): void
{
$this->assertSame('progamin', removeDuplicateCharacters('programming'));
}
/**
* Test with a string that has no duplicates.
*/
public function testStringWithoutDuplicates(): void
{
$this->assertSame('abc', removeDuplicateCharacters('abc'));
}
/**
* Test with an empty string.
*/
public function testEmptyString(): void
{
$this->assertSame('', removeDuplicateCharacters(''));
}
/**
* Test with a string containing only one character repeated.
*/
public function testSingleCharacterRepeated(): void
{
$this->assertSame('a', removeDuplicateCharacters('aaaaa'));
}
/**
* Test with special characters.
*/
public function testStringWithSpecialCharacters(): void
{
$this->assertSame('ab!@', removeDuplicateCharacters('aabb!!@@'));
}
/**
* Test with a string containing spaces.
*/
public function testStringWithSpaces(): void
{
$this->assertSame('a b', removeDuplicateCharacters('a a a b b'));
}
/**
* Test with a string containing mixed case characters.
*/
public function testStringWithMixedCase(): void
{
$this->assertSame('aAbB', removeDuplicateCharacters('aAaAaAbBbB'));
}
}