Skip to content

Commit 2ffe3f2

Browse files
committed
Fix
1 parent fc7a85b commit 2ffe3f2

File tree

1 file changed

+10
-34
lines changed

1 file changed

+10
-34
lines changed

src/test/java/com/thealgorithms/searches/SaddlebackSearchTest.java

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,67 +12,43 @@ class SaddlebackSearchTest {
1212
*/
1313
@Test
1414
void testFindElementExists() {
15-
int[][] arr = {
16-
{-10, -5, -3, 4, 9},
17-
{-6, -2, 0, 5, 10},
18-
{-4, -1, 1, 6, 12},
19-
{2, 3, 7, 8, 13},
20-
{100, 120, 130, 140, 150}
21-
};
15+
int[][] arr = {{-10, -5, -3, 4, 9}, {-6, -2, 0, 5, 10}, {-4, -1, 1, 6, 12}, {2, 3, 7, 8, 13}, {100, 120, 130, 140, 150}};
2216

2317
int[] result = SaddlebackSearch.find(arr, arr.length - 1, 0, 4);
24-
assertArrayEquals(new int[]{0, 3}, result, "Element 4 should be found at (0, 3)");
18+
assertArrayEquals(new int[] {0, 3}, result, "Element 4 should be found at (0, 3)");
2519
}
2620

2721
/**
2822
* Test searching for an element that does not exist in the array.
2923
*/
3024
@Test
3125
void testFindElementNotExists() {
32-
int[][] arr = {
33-
{-10, -5, -3, 4, 9},
34-
{-6, -2, 0, 5, 10},
35-
{-4, -1, 1, 6, 12},
36-
{2, 3, 7, 8, 13},
37-
{100, 120, 130, 140, 150}
38-
};
26+
int[][] arr = {{-10, -5, -3, 4, 9}, {-6, -2, 0, 5, 10}, {-4, -1, 1, 6, 12}, {2, 3, 7, 8, 13}, {100, 120, 130, 140, 150}};
3927

4028
int[] result = SaddlebackSearch.find(arr, arr.length - 1, 0, 1000);
41-
assertArrayEquals(new int[]{-1, -1}, result, "Element 1000 should not be found");
29+
assertArrayEquals(new int[] {-1, -1}, result, "Element 1000 should not be found");
4230
}
4331

4432
/**
4533
* Test searching for the smallest element in the array.
4634
*/
4735
@Test
4836
void testFindSmallestElement() {
49-
int[][] arr = {
50-
{-10, -5, -3, 4, 9},
51-
{-6, -2, 0, 5, 10},
52-
{-4, -1, 1, 6, 12},
53-
{2, 3, 7, 8, 13},
54-
{100, 120, 130, 140, 150}
55-
};
37+
int[][] arr = {{-10, -5, -3, 4, 9}, {-6, -2, 0, 5, 10}, {-4, -1, 1, 6, 12}, {2, 3, 7, 8, 13}, {100, 120, 130, 140, 150}};
5638

5739
int[] result = SaddlebackSearch.find(arr, arr.length - 1, 0, -10);
58-
assertArrayEquals(new int[]{0, 0}, result, "Element -10 should be found at (0, 0)");
40+
assertArrayEquals(new int[] {0, 0}, result, "Element -10 should be found at (0, 0)");
5941
}
6042

6143
/**
6244
* Test searching for the largest element in the array.
6345
*/
6446
@Test
6547
void testFindLargestElement() {
66-
int[][] arr = {
67-
{-10, -5, -3, 4, 9},
68-
{-6, -2, 0, 5, 10},
69-
{-4, -1, 1, 6, 12},
70-
{2, 3, 7, 8, 13},
71-
{100, 120, 130, 140, 150}
72-
};
48+
int[][] arr = {{-10, -5, -3, 4, 9}, {-6, -2, 0, 5, 10}, {-4, -1, 1, 6, 12}, {2, 3, 7, 8, 13}, {100, 120, 130, 140, 150}};
7349

7450
int[] result = SaddlebackSearch.find(arr, arr.length - 1, 0, 150);
75-
assertArrayEquals(new int[]{4, 4}, result, "Element 150 should be found at (4, 4)");
51+
assertArrayEquals(new int[] {4, 4}, result, "Element 150 should be found at (4, 4)");
7652
}
7753

7854
/**
@@ -93,7 +69,7 @@ void testFindSingleElementExists() {
9369
int[][] arr = {{5}};
9470

9571
int[] result = SaddlebackSearch.find(arr, 0, 0, 5);
96-
assertArrayEquals(new int[]{0, 0}, result, "Element 5 should be found at (0, 0)");
72+
assertArrayEquals(new int[] {0, 0}, result, "Element 5 should be found at (0, 0)");
9773
}
9874

9975
/**
@@ -104,6 +80,6 @@ void testFindSingleElementNotExists() {
10480
int[][] arr = {{5}};
10581

10682
int[] result = SaddlebackSearch.find(arr, 0, 0, 10);
107-
assertArrayEquals(new int[]{-1, -1}, result, "Element 10 should not be found in single element array");
83+
assertArrayEquals(new int[] {-1, -1}, result, "Element 10 should not be found in single element array");
10884
}
10985
}

0 commit comments

Comments
 (0)