Skip to content

Commit b1a8d89

Browse files
authored
Added tests for tasks 852-2549
1 parent e603cc5 commit b1a8d89

File tree

5 files changed

+140
-0
lines changed

5 files changed

+140
-0
lines changed

src/test/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/SolutionTest.kt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,44 @@ internal class SolutionTest {
1919
fun peakIndexInMountainArray3() {
2020
assertThat(Solution().peakIndexInMountainArray(intArrayOf(0, 10, 5, 2)), equalTo(1))
2121
}
22+
23+
@Test
24+
fun peakIndexInMountainArray4() {
25+
assertThat(
26+
Solution().peakIndexInMountainArray(intArrayOf(0, 1, 2, 3, 2, 1)),
27+
equalTo(3),
28+
)
29+
}
30+
31+
@Test
32+
fun peakIndexInMountainArray5() {
33+
assertThat(
34+
Solution().peakIndexInMountainArray(intArrayOf(5, 10, 7)),
35+
equalTo(1),
36+
)
37+
}
38+
39+
@Test
40+
fun peakIndexInMountainArray6() {
41+
assertThat(
42+
Solution().peakIndexInMountainArray(intArrayOf(5, 4, 3, 2, 1)),
43+
equalTo(1),
44+
)
45+
}
46+
47+
@Test
48+
fun peakIndexInMountainArray7() {
49+
assertThat(
50+
Solution().peakIndexInMountainArray(intArrayOf(1, 2, 3, 4, 5)),
51+
equalTo(-1),
52+
)
53+
}
54+
55+
@Test
56+
fun peakIndexInMountainArray8() {
57+
assertThat(
58+
Solution().peakIndexInMountainArray(intArrayOf(3, 3, 3, 3)),
59+
equalTo(-1),
60+
)
61+
}
2262
}

src/test/kotlin/g1701_1800/s1736_latest_time_by_replacing_hidden_digits/SolutionTest.kt

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

src/test/kotlin/g2301_2400/s2396_strictly_palindromic_number/SolutionTest.kt

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

src/test/kotlin/g2501_2600/s2525_categorize_box_according_to_criteria/SolutionTest.kt

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

src/test/kotlin/g2501_2600/s2549_count_distinct_numbers_on_board/SolutionTest.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,19 @@ internal class SolutionTest {
2020
equalTo(2),
2121
)
2222
}
23+
24+
@Test
25+
fun distinctIntegers3() {
26+
assertThat(Solution().distinctIntegers(1), equalTo(1))
27+
}
28+
29+
@Test
30+
fun distinctIntegers4() {
31+
assertThat(Solution().distinctIntegers(2), equalTo(1))
32+
}
33+
34+
@Test
35+
fun distinctIntegers5() {
36+
assertThat(Solution().distinctIntegers(1000), equalTo(999))
37+
}
2338
}

0 commit comments

Comments
 (0)