Skip to content

Commit fe3ac9a

Browse files
committed
Fix checkstyle errors
1 parent ac76cd9 commit fe3ac9a

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/test/java/com/thealgorithms/others/MiniMaxAlgorithmTest.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void testSetScoresWithVariousInvalidLengths() {
7878
// Test multiple invalid lengths to ensure isPowerOfTwo function is fully covered
7979
int[][] invalidScoreArrays = {
8080
{1, 2, 3, 4, 5}, // Length 5
81-
{1, 2, 3, 4, 5, 6}, // Length 6
81+
{1, 2, 3, 4, 5, 6}, // Length 6
8282
{1, 2, 3, 4, 5, 6, 7}, // Length 7
8383
new int[9], // Length 9
8484
new int[10], // Length 10
@@ -92,8 +92,7 @@ void testSetScoresWithVariousInvalidLengths() {
9292

9393
// Should print error message for each invalid length
9494
String output = outputStream.toString();
95-
assertTrue(output.contains("The number of scores must be a power of 2."),
96-
"Failed for array length: " + invalidScores.length);
95+
assertTrue(output.contains("The number of scores must be a power of 2."), "Failed for array length: " + invalidScores.length);
9796
}
9897

9998
// Scores should remain unchanged (original length 8)
@@ -231,12 +230,12 @@ void testSetScoresWithNegativeLength() {
231230
// This test ensures the first condition of isPowerOfTwo (n > 0) is tested
232231
// Although we can't directly create an array with negative length,
233232
// we can test edge cases around zero and ensure proper validation
234-
233+
235234
// Test with array length 0 (edge case for n > 0 condition)
236235
int[] emptyArray = new int[0];
237236
outputStream.reset();
238237
miniMax.setScores(emptyArray);
239-
238+
240239
String output = outputStream.toString();
241240
assertTrue(output.contains("The number of scores must be a power of 2."));
242241
assertEquals(8, miniMax.getScores().length); // Should remain unchanged
@@ -249,32 +248,30 @@ void testSetScoresWithLargePowerOfTwo() {
249248
for (int i = 0; i < largeValidScores.length; i++) {
250249
largeValidScores[i] = i + 1;
251250
}
252-
251+
253252
miniMax.setScores(largeValidScores);
254253
assertArrayEquals(largeValidScores, miniMax.getScores());
255254
assertEquals(5, miniMax.getHeight()); // log2(32) = 5
256255
}
257256

258-
@Test
257+
@Test
259258
void testSetScoresValidEdgeCases() {
260259
// Test valid powers of 2 to ensure isPowerOfTwo returns true correctly
261260
int[][] validPowersOf2 = {
262261
new int[1], // 1 = 2^0
263-
new int[2], // 2 = 2^1
262+
new int[2], // 2 = 2^1
264263
new int[4], // 4 = 2^2
265264
new int[8], // 8 = 2^3
266265
new int[16], // 16 = 2^4
267266
new int[64] // 64 = 2^6
268267
};
269-
268+
270269
int[] expectedHeights = {0, 1, 2, 3, 4, 6};
271-
270+
272271
for (int i = 0; i < validPowersOf2.length; i++) {
273272
miniMax.setScores(validPowersOf2[i]);
274-
assertEquals(validPowersOf2[i].length, miniMax.getScores().length,
275-
"Failed for array length: " + validPowersOf2[i].length);
276-
assertEquals(expectedHeights[i], miniMax.getHeight(),
277-
"Height calculation failed for array length: " + validPowersOf2[i].length);
273+
assertEquals(validPowersOf2[i].length, miniMax.getScores().length, "Failed for array length: " + validPowersOf2[i].length);
274+
assertEquals(expectedHeights[i], miniMax.getHeight(), "Height calculation failed for array length: " + validPowersOf2[i].length);
278275
}
279276
}
280277
}

0 commit comments

Comments
 (0)