Update PeakElementFinderUnitTest.java

This commit is contained in:
Imran Alam 2024-03-06 12:02:28 +05:30 committed by GitHub
parent 2f18d71810
commit dd251d2d33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -14,6 +14,8 @@ public class PeakElementFinderUnitTest {
int[] array = {5, 8, 7, 6, 12}; int[] array = {5, 8, 7, 6, 12};
List<Integer> peaks = finder.findPeakElements(array); List<Integer> peaks = finder.findPeakElements(array);
assertEquals(2, peaks.size()); assertEquals(2, peaks.size());
assertTrue(peaks.contains(8));
assertTrue(peaks.contains(12));
} }
@Test @Test
@ -22,6 +24,8 @@ public class PeakElementFinderUnitTest {
int[] array = {5, 2, 1, 3, 4}; int[] array = {5, 2, 1, 3, 4};
List<Integer> peaks = finder.findPeakElements(array); List<Integer> peaks = finder.findPeakElements(array);
assertEquals(2, peaks.size()); assertEquals(2, peaks.size());
assertTrue(peaks.contains(5));
assertTrue(peaks.contains(4));
} }
@Test @Test
@ -30,5 +34,6 @@ public class PeakElementFinderUnitTest {
int[] array = {1, 2, 2, 2, 3, 4, 5}; int[] array = {1, 2, 2, 2, 3, 4, 5};
List<Integer> peaks = finder.findPeakElements(array); List<Integer> peaks = finder.findPeakElements(array);
assertEquals(1, peaks.size()); assertEquals(1, peaks.size());
assertTrue(peaks.contains(5));
} }
} }