Skip to content

Commit 8c72161

Browse files
committed
Test known values as ints not floats to avoid exact floatpoint comparisons which may vary depending on php compiling settings and platform
1 parent 102d11b commit 8c72161

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/Matchers/SpatialTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ public function testGuessesBasic()
146146
]);
147147

148148
$this->assertEquals(
149-
$this->getBaseGuessCount($token),
150-
$match->getGuesses(),
149+
(int)$this->getBaseGuessCount($token),
150+
(int)$match->getGuesses(),
151151
"with no turns or shifts, guesses is starts * degree * (len-1)"
152152
);
153153
}
@@ -162,8 +162,8 @@ public function testGuessesShifted()
162162
]);
163163

164164
$this->assertEquals(
165-
$this->getBaseGuessCount($token) * (BaseMatch::binom(6, 2) + BaseMatch::binom(6, 1)),
166-
$match->getGuesses(),
165+
(int)$this->getBaseGuessCount($token) * (BaseMatch::binom(6, 2) + BaseMatch::binom(6, 1)),
166+
(int)$match->getGuesses(),
167167
"guesses is added for shifted keys, similar to capitals in dictionary matching"
168168
);
169169
}
@@ -178,8 +178,8 @@ public function testGuessesEverythingShifted()
178178
]);
179179

180180
$this->assertEquals(
181-
$this->getBaseGuessCount($token) * 2,
182-
$match->getGuesses(),
181+
(int)$this->getBaseGuessCount($token) * 2,
182+
(int)$match->getGuesses(),
183183
"when everything is shifted, guesses are double"
184184
);
185185
}

0 commit comments

Comments
 (0)