Skip to content

Commit 0c847b5

Browse files
authored
Added tests for tasks 852-2549
1 parent 8d7030b commit 0c847b5

File tree

5 files changed

+126
-0
lines changed

5 files changed

+126
-0
lines changed

src/test/java/g0801_0900/s0852_peak_index_in_a_mountain_array/SolutionTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,30 @@ void peakIndexInMountainArray2() {
2020
void peakIndexInMountainArray3() {
2121
assertThat(new Solution().peakIndexInMountainArray(new int[] {0, 10, 5, 2}), equalTo(1));
2222
}
23+
24+
@Test
25+
void peakIndexInMountainArray4() {
26+
assertThat(
27+
new Solution().peakIndexInMountainArray(new int[] {0, 1, 2, 3, 2, 1}), equalTo(3));
28+
}
29+
30+
@Test
31+
void peakIndexInMountainArray5() {
32+
assertThat(new Solution().peakIndexInMountainArray(new int[] {5, 10, 7}), equalTo(1));
33+
}
34+
35+
@Test
36+
void peakIndexInMountainArray6() {
37+
assertThat(new Solution().peakIndexInMountainArray(new int[] {5, 4, 3, 2, 1}), equalTo(1));
38+
}
39+
40+
@Test
41+
void peakIndexInMountainArray7() {
42+
assertThat(new Solution().peakIndexInMountainArray(new int[] {1, 2, 3, 4, 5}), equalTo(-1));
43+
}
44+
45+
@Test
46+
void peakIndexInMountainArray8() {
47+
assertThat(new Solution().peakIndexInMountainArray(new int[] {3, 3, 3, 3}), equalTo(-1));
48+
}
2349
}

src/test/java/g1701_1800/s1736_latest_time_by_replacing_hidden_digits/SolutionTest.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,39 @@ void maximumTime2() {
2020
void maximumTime3() {
2121
assertThat(new Solution().maximumTime("1?:22"), equalTo("19:22"));
2222
}
23+
24+
@Test
25+
void maximumTime4() {
26+
assertThat(new Solution().maximumTime("?4:00"), equalTo("14:00"));
27+
}
28+
29+
@Test
30+
void maximumTime5() {
31+
assertThat(new Solution().maximumTime("??:??"), equalTo("23:59"));
32+
}
33+
34+
@Test
35+
void maximumTime6() {
36+
assertThat(new Solution().maximumTime("?3:15"), equalTo("23:15"));
37+
}
38+
39+
@Test
40+
void maximumTime7() {
41+
assertThat(new Solution().maximumTime("2?:45"), equalTo("23:45"));
42+
}
43+
44+
@Test
45+
void maximumTime8() {
46+
assertThat(new Solution().maximumTime("1?:??"), equalTo("19:59"));
47+
}
48+
49+
@Test
50+
void maximumTime9() {
51+
assertThat(new Solution().maximumTime("10:?7"), equalTo("10:57"));
52+
}
53+
54+
@Test
55+
void maximumTime10() {
56+
assertThat(new Solution().maximumTime("22:4?"), equalTo("22:49"));
57+
}
2358
}

src/test/java/g2301_2400/s2396_strictly_palindromic_number/SolutionTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,24 @@ void isStrictlyPalindromic2() {
2020
void isStrictlyPalindromic3() {
2121
assertThat(new Solution().isStrictlyPalindromic(9779), equalTo(false));
2222
}
23+
24+
@Test
25+
void isStrictlyPalindromic4() {
26+
assertThat(new Solution().isStrictlyPalindromic(3), equalTo(true));
27+
}
28+
29+
@Test
30+
void isStrictlyPalindromic5() {
31+
assertThat(new Solution().isStrictlyPalindromic(2), equalTo(true));
32+
}
33+
34+
@Test
35+
void isStrictlyPalindromic6() {
36+
assertThat(new Solution().isStrictlyPalindromic(1), equalTo(true));
37+
}
38+
39+
@Test
40+
void isStrictlyPalindromic7() {
41+
assertThat(new Solution().isStrictlyPalindromic(10000), equalTo(false));
42+
}
2343
}

src/test/java/g2501_2600/s2525_categorize_box_according_to_criteria/SolutionTest.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,34 @@ void categorizeBox() {
1515
void categorizeBox2() {
1616
assertThat(new Solution().categorizeBox(200, 50, 800, 50), equalTo("Neither"));
1717
}
18+
19+
@Test
20+
void categorizeBox3() {
21+
assertThat(new Solution().categorizeBox(10000, 1, 1, 10), equalTo("Bulky"));
22+
}
23+
24+
@Test
25+
void categorizeBox4() {
26+
assertThat(new Solution().categorizeBox(1000, 1000, 1000, 10), equalTo("Bulky"));
27+
}
28+
29+
@Test
30+
void categorizeBox5() {
31+
assertThat(new Solution().categorizeBox(10000, 10000, 1, 200), equalTo("Both"));
32+
}
33+
34+
@Test
35+
void categorizeBox6() {
36+
assertThat(new Solution().categorizeBox(9999, 9999, 1, 99), equalTo("Neither"));
37+
}
38+
39+
@Test
40+
void categorizeBox7() {
41+
assertThat(new Solution().categorizeBox(10000, 10000, 1, 100), equalTo("Both"));
42+
}
43+
44+
@Test
45+
void categorizeBox8() {
46+
assertThat(new Solution().categorizeBox(1000, 1000, 1000, 1), equalTo("Bulky"));
47+
}
1848
}

src/test/java/g2501_2600/s2549_count_distinct_numbers_on_board/SolutionTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,19 @@ void distinctIntegers() {
1515
void distinctIntegers2() {
1616
assertThat(new Solution().distinctIntegers(3), equalTo(2));
1717
}
18+
19+
@Test
20+
void distinctIntegers3() {
21+
assertThat(new Solution().distinctIntegers(1), equalTo(1));
22+
}
23+
24+
@Test
25+
void distinctIntegers4() {
26+
assertThat(new Solution().distinctIntegers(2), equalTo(1));
27+
}
28+
29+
@Test
30+
void distinctIntegers5() {
31+
assertThat(new Solution().distinctIntegers(1000), equalTo(999));
32+
}
1833
}

0 commit comments

Comments
 (0)