@@ -15,7 +15,7 @@ public static function setUpBeforeClass(): void
15
15
*/
16
16
public function testNoMatches (): void
17
17
{
18
- $ this ->assertEquals ([], detectAnagrams ('diaper ' , ['hello ' , 'world ' , 'zombies ' , 'pants ' ]));
18
+ $ this ->assertEqualsCanonicalizing ([], array_values ( detectAnagrams ('diaper ' , ['hello ' , 'world ' , 'zombies ' , 'pants ' ]) ));
19
19
}
20
20
21
21
/**
@@ -24,9 +24,9 @@ public function testNoMatches(): void
24
24
*/
25
25
public function testDetectsTwoAnagrams (): void
26
26
{
27
- $ this ->assertEquals (
27
+ $ this ->assertEqualsCanonicalizing (
28
28
['lemons ' , 'melons ' ],
29
- detectAnagrams ('solemn ' , ['lemons ' , 'cherry ' , 'melons ' ])
29
+ array_values ( detectAnagrams ('solemn ' , ['lemons ' , 'cherry ' , 'melons ' ]) )
30
30
);
31
31
}
32
32
@@ -36,7 +36,7 @@ public function testDetectsTwoAnagrams(): void
36
36
*/
37
37
public function testDoesNotDetectAnagramSubsets (): void
38
38
{
39
- $ this ->assertEquals ([], detectAnagrams ('good ' , ['dog ' , 'goody ' ]));
39
+ $ this ->assertEqualsCanonicalizing ([], array_values ( detectAnagrams ('good ' , ['dog ' , 'goody ' ]) ));
40
40
}
41
41
42
42
/**
@@ -45,7 +45,7 @@ public function testDoesNotDetectAnagramSubsets(): void
45
45
*/
46
46
public function testDetectsAnagram (): void
47
47
{
48
- $ this ->assertEquals (['inlets ' ], detectAnagrams ('listen ' , ['enlists ' , 'google ' , 'inlets ' , 'banana ' ]));
48
+ $ this ->assertEqualsCanonicalizing (['inlets ' ], array_values ( detectAnagrams ('listen ' , ['enlists ' , 'google ' , 'inlets ' , 'banana ' ]) ));
49
49
}
50
50
51
51
/**
@@ -54,9 +54,9 @@ public function testDetectsAnagram(): void
54
54
*/
55
55
public function testDetectsThreeAnagrams (): void
56
56
{
57
- $ this ->assertEquals (
57
+ $ this ->assertEqualsCanonicalizing (
58
58
['gallery ' , 'regally ' , 'largely ' ],
59
- detectAnagrams ('allergy ' , ['gallery ' , 'ballerina ' , 'regally ' , 'clergy ' , 'largely ' , 'leading ' ])
59
+ array_values ( detectAnagrams ('allergy ' , ['gallery ' , 'ballerina ' , 'regally ' , 'clergy ' , 'largely ' , 'leading ' ]) )
60
60
);
61
61
}
62
62
@@ -66,7 +66,7 @@ public function testDetectsThreeAnagrams(): void
66
66
*/
67
67
public function testDetectsMultipleAnagramsWithDifferentCase (): void
68
68
{
69
- $ this ->assertEquals (['Eons ' , 'ONES ' ], detectAnagrams ('nose ' , ['Eons ' , 'ONES ' ]));
69
+ $ this ->assertEqualsCanonicalizing (['Eons ' , 'ONES ' ], array_values ( detectAnagrams ('nose ' , ['Eons ' , 'ONES ' ]) ));
70
70
}
71
71
72
72
/**
@@ -75,7 +75,7 @@ public function testDetectsMultipleAnagramsWithDifferentCase(): void
75
75
*/
76
76
public function testDoesNotDetectNonAnagramsWithIdenticalChecksum (): void
77
77
{
78
- $ this ->assertEquals ([], detectAnagrams ('mass ' , ['last ' ]));
78
+ $ this ->assertEqualsCanonicalizing ([], array_values ( detectAnagrams ('mass ' , ['last ' ]) ));
79
79
}
80
80
81
81
/**
@@ -84,7 +84,7 @@ public function testDoesNotDetectNonAnagramsWithIdenticalChecksum(): void
84
84
*/
85
85
public function testDetectsAnagramsCaseInsensitively (): void
86
86
{
87
- $ this ->assertEquals (['Carthorse ' ], detectAnagrams ('Orchestra ' , ['cashregister ' , 'Carthorse ' , 'radishes ' ]));
87
+ $ this ->assertEqualsCanonicalizing (['Carthorse ' ], array_values ( detectAnagrams ('Orchestra ' , ['cashregister ' , 'Carthorse ' , 'radishes ' ]) ));
88
88
}
89
89
90
90
/**
@@ -93,7 +93,7 @@ public function testDetectsAnagramsCaseInsensitively(): void
93
93
*/
94
94
public function testDetectsAnagramsUsingCaseInsensitiveSubject (): void
95
95
{
96
- $ this ->assertEquals (['carthorse ' ], detectAnagrams ('Orchestra ' , ['cashregister ' , 'carthorse ' , 'radishes ' ]));
96
+ $ this ->assertEqualsCanonicalizing (['carthorse ' ], array_values ( detectAnagrams ('Orchestra ' , ['cashregister ' , 'carthorse ' , 'radishes ' ]) ));
97
97
}
98
98
99
99
/**
@@ -102,7 +102,7 @@ public function testDetectsAnagramsUsingCaseInsensitiveSubject(): void
102
102
*/
103
103
public function testDetectsAnagramsUsingCaseInsensitvePossibleMatches (): void
104
104
{
105
- $ this ->assertEquals (['Carthorse ' ], detectAnagrams ('orchestra ' , ['cashregister ' , 'Carthorse ' , 'radishes ' ]));
105
+ $ this ->assertEqualsCanonicalizing (['Carthorse ' ], array_values ( detectAnagrams ('orchestra ' , ['cashregister ' , 'Carthorse ' , 'radishes ' ]) ));
106
106
}
107
107
108
108
/**
@@ -111,7 +111,7 @@ public function testDetectsAnagramsUsingCaseInsensitvePossibleMatches(): void
111
111
*/
112
112
public function testDoesNotDetectAAnagramIfTheOriginalWordIsRepeated (): void
113
113
{
114
- $ this ->assertEquals ([], detectAnagrams ('go ' , ['goGoGO ' ]));
114
+ $ this ->assertEqualsCanonicalizing ([], array_values ( detectAnagrams ('go ' , ['goGoGO ' ]) ));
115
115
}
116
116
117
117
/**
@@ -120,7 +120,7 @@ public function testDoesNotDetectAAnagramIfTheOriginalWordIsRepeated(): void
120
120
*/
121
121
public function testAnagramsMustUseAllLettersExactlyOnce (): void
122
122
{
123
- $ this ->assertEquals ([], detectAnagrams ('tapper ' , ['patter ' ]));
123
+ $ this ->assertEqualsCanonicalizing ([], array_values ( detectAnagrams ('tapper ' , ['patter ' ]) ));
124
124
}
125
125
126
126
/**
@@ -129,7 +129,7 @@ public function testAnagramsMustUseAllLettersExactlyOnce(): void
129
129
*/
130
130
public function testWordsAreNotAnagramsOfThemselves (): void
131
131
{
132
- $ this ->assertEquals ([], detectAnagrams ('BANANA ' , ['BANANA ' ]));
132
+ $ this ->assertEqualsCanonicalizing ([], array_values ( detectAnagrams ('BANANA ' , ['BANANA ' ]) ));
133
133
}
134
134
135
135
/**
@@ -138,7 +138,7 @@ public function testWordsAreNotAnagramsOfThemselves(): void
138
138
*/
139
139
public function testWordsAreNotAnagramsOfThemselvesEvenIfLetterCaseIsPartiallyDifferent (): void
140
140
{
141
- $ this ->assertEquals ([], detectAnagrams ('BANANA ' , ['Banana ' ]));
141
+ $ this ->assertEqualsCanonicalizing ([], array_values ( detectAnagrams ('BANANA ' , ['Banana ' ]) ));
142
142
}
143
143
144
144
/**
@@ -147,7 +147,7 @@ public function testWordsAreNotAnagramsOfThemselvesEvenIfLetterCaseIsPartiallyDi
147
147
*/
148
148
public function testWordsAreNotAnagramsOfThemselvesEvenIfLetterCaseIsCompletelyDifferent (): void
149
149
{
150
- $ this ->assertEquals ([], detectAnagrams ('BANANA ' , ['banana ' ]));
150
+ $ this ->assertEqualsCanonicalizing ([], array_values ( detectAnagrams ('BANANA ' , ['banana ' ]) ));
151
151
}
152
152
153
153
/**
@@ -156,7 +156,7 @@ public function testWordsAreNotAnagramsOfThemselvesEvenIfLetterCaseIsCompletelyD
156
156
*/
157
157
public function testWordsOtherThanThemselvesCanBeAnagrams (): void
158
158
{
159
- $ this ->assertEquals (['Silent ' ], detectAnagrams ('LISTEN ' , ['LISTEN ' , 'Silent ' ]));
159
+ $ this ->assertEqualsCanonicalizing (['Silent ' ], array_values ( detectAnagrams ('LISTEN ' , ['LISTEN ' , 'Silent ' ]) ));
160
160
}
161
161
162
162
/**
0 commit comments