From d1b9751e1f9a07395f778ac55d14b3e9d33543af Mon Sep 17 00:00:00 2001 From: ThanhNIT Date: Sat, 29 Nov 2025 09:47:37 +0700 Subject: [PATCH] Added tests for tasks 852-2549 --- .../SolutionTest.kt | 40 +++++++++++++++++++ .../SolutionTest.kt | 35 ++++++++++++++++ .../SolutionTest.kt | 20 ++++++++++ .../SolutionTest.kt | 30 ++++++++++++++ .../SolutionTest.kt | 15 +++++++ 5 files changed, 140 insertions(+) diff --git a/src/test/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/SolutionTest.kt b/src/test/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/SolutionTest.kt index 1e925d514..957da49a9 100644 --- a/src/test/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/SolutionTest.kt +++ b/src/test/kotlin/g0801_0900/s0852_peak_index_in_a_mountain_array/SolutionTest.kt @@ -19,4 +19,44 @@ internal class SolutionTest { fun peakIndexInMountainArray3() { assertThat(Solution().peakIndexInMountainArray(intArrayOf(0, 10, 5, 2)), equalTo(1)) } + + @Test + fun peakIndexInMountainArray4() { + assertThat( + Solution().peakIndexInMountainArray(intArrayOf(0, 1, 2, 3, 2, 1)), + equalTo(3), + ) + } + + @Test + fun peakIndexInMountainArray5() { + assertThat( + Solution().peakIndexInMountainArray(intArrayOf(5, 10, 7)), + equalTo(1), + ) + } + + @Test + fun peakIndexInMountainArray6() { + assertThat( + Solution().peakIndexInMountainArray(intArrayOf(5, 4, 3, 2, 1)), + equalTo(1), + ) + } + + @Test + fun peakIndexInMountainArray7() { + assertThat( + Solution().peakIndexInMountainArray(intArrayOf(1, 2, 3, 4, 5)), + equalTo(-1), + ) + } + + @Test + fun peakIndexInMountainArray8() { + assertThat( + Solution().peakIndexInMountainArray(intArrayOf(3, 3, 3, 3)), + equalTo(-1), + ) + } } diff --git a/src/test/kotlin/g1701_1800/s1736_latest_time_by_replacing_hidden_digits/SolutionTest.kt b/src/test/kotlin/g1701_1800/s1736_latest_time_by_replacing_hidden_digits/SolutionTest.kt index 2312f44b2..1c52eceab 100644 --- a/src/test/kotlin/g1701_1800/s1736_latest_time_by_replacing_hidden_digits/SolutionTest.kt +++ b/src/test/kotlin/g1701_1800/s1736_latest_time_by_replacing_hidden_digits/SolutionTest.kt @@ -19,4 +19,39 @@ internal class SolutionTest { fun maximumTime3() { assertThat(Solution().maximumTime("1?:22"), equalTo("19:22")) } + + @Test + fun maximumTime4() { + assertThat(Solution().maximumTime("?4:00"), equalTo("14:00")) + } + + @Test + fun maximumTime5() { + assertThat(Solution().maximumTime("??:??"), equalTo("23:59")) + } + + @Test + fun maximumTime6() { + assertThat(Solution().maximumTime("?3:15"), equalTo("23:15")) + } + + @Test + fun maximumTime7() { + assertThat(Solution().maximumTime("2?:45"), equalTo("23:45")) + } + + @Test + fun maximumTime8() { + assertThat(Solution().maximumTime("1?:??"), equalTo("19:59")) + } + + @Test + fun maximumTime9() { + assertThat(Solution().maximumTime("10:?7"), equalTo("10:57")) + } + + @Test + fun maximumTime10() { + assertThat(Solution().maximumTime("22:4?"), equalTo("22:49")) + } } diff --git a/src/test/kotlin/g2301_2400/s2396_strictly_palindromic_number/SolutionTest.kt b/src/test/kotlin/g2301_2400/s2396_strictly_palindromic_number/SolutionTest.kt index 015b613ff..9026a561a 100644 --- a/src/test/kotlin/g2301_2400/s2396_strictly_palindromic_number/SolutionTest.kt +++ b/src/test/kotlin/g2301_2400/s2396_strictly_palindromic_number/SolutionTest.kt @@ -19,4 +19,24 @@ internal class SolutionTest { fun isStrictlyPalindromic3() { assertThat(Solution().isStrictlyPalindromic(9779), equalTo(false)) } + + @Test + fun isStrictlyPalindromic4() { + assertThat(Solution().isStrictlyPalindromic(3), equalTo(true)) + } + + @Test + fun isStrictlyPalindromic5() { + assertThat(Solution().isStrictlyPalindromic(2), equalTo(true)) + } + + @Test + fun isStrictlyPalindromic6() { + assertThat(Solution().isStrictlyPalindromic(1), equalTo(true)) + } + + @Test + fun isStrictlyPalindromic7() { + assertThat(Solution().isStrictlyPalindromic(10000), equalTo(false)) + } } diff --git a/src/test/kotlin/g2501_2600/s2525_categorize_box_according_to_criteria/SolutionTest.kt b/src/test/kotlin/g2501_2600/s2525_categorize_box_according_to_criteria/SolutionTest.kt index 9fee36bb5..3205833f6 100644 --- a/src/test/kotlin/g2501_2600/s2525_categorize_box_according_to_criteria/SolutionTest.kt +++ b/src/test/kotlin/g2501_2600/s2525_categorize_box_according_to_criteria/SolutionTest.kt @@ -14,4 +14,34 @@ internal class SolutionTest { fun categorizeBox2() { assertThat(Solution().categorizeBox(200, 50, 800, 50), equalTo("Neither")) } + + @Test + fun categorizeBox3() { + assertThat(Solution().categorizeBox(10000, 1, 1, 10), equalTo("Bulky")) + } + + @Test + fun categorizeBox4() { + assertThat(Solution().categorizeBox(1000, 1000, 1000, 10), equalTo("Bulky")) + } + + @Test + fun categorizeBox5() { + assertThat(Solution().categorizeBox(10000, 10000, 1, 200), equalTo("Both")) + } + + @Test + fun categorizeBox6() { + assertThat(Solution().categorizeBox(9999, 9999, 1, 99), equalTo("Neither")) + } + + @Test + fun categorizeBox7() { + assertThat(Solution().categorizeBox(10000, 10000, 1, 100), equalTo("Both")) + } + + @Test + fun categorizeBox8() { + assertThat(Solution().categorizeBox(1000, 1000, 1000, 1), equalTo("Bulky")) + } } diff --git a/src/test/kotlin/g2501_2600/s2549_count_distinct_numbers_on_board/SolutionTest.kt b/src/test/kotlin/g2501_2600/s2549_count_distinct_numbers_on_board/SolutionTest.kt index e145585b6..56029c4bd 100644 --- a/src/test/kotlin/g2501_2600/s2549_count_distinct_numbers_on_board/SolutionTest.kt +++ b/src/test/kotlin/g2501_2600/s2549_count_distinct_numbers_on_board/SolutionTest.kt @@ -20,4 +20,19 @@ internal class SolutionTest { equalTo(2), ) } + + @Test + fun distinctIntegers3() { + assertThat(Solution().distinctIntegers(1), equalTo(1)) + } + + @Test + fun distinctIntegers4() { + assertThat(Solution().distinctIntegers(2), equalTo(1)) + } + + @Test + fun distinctIntegers5() { + assertThat(Solution().distinctIntegers(1000), equalTo(999)) + } }