@@ -22,21 +22,64 @@ internal class SolutionTest {
2222
2323 @Test
2424 fun countSubstrings4 () {
25- assertThat<Long >(Solution ().countSubstrings(" 4 " ), equalTo<Long >(1L ))
25+ assertThat<Long >(Solution ().countSubstrings(" 28 " ), equalTo<Long >(2L ))
2626 }
2727
2828 @Test
2929 fun countSubstrings5 () {
30- assertThat<Long >(Solution ().countSubstrings(" 28 " ), equalTo<Long >(2L ))
30+ assertThat<Long >(Solution ().countSubstrings(" 04 " ), equalTo<Long >(2L ))
3131 }
3232
3333 @Test
34- fun countSubstrings6 () {
35- assertThat<Long >(Solution ().countSubstrings(" 04" ), equalTo<Long >(2L ))
34+ fun testSingleDigitNumbers () {
35+ val solution = Solution ()
36+ assertThat(solution.countSubstrings(" 1" ), equalTo<Long >(1L ))
37+ assertThat(solution.countSubstrings(" 2" ), equalTo<Long >(1L ))
38+ assertThat(solution.countSubstrings(" 3" ), equalTo<Long >(1L ))
39+ assertThat(solution.countSubstrings(" 4" ), equalTo<Long >(1L ))
40+ assertThat(solution.countSubstrings(" 5" ), equalTo<Long >(1L ))
41+ assertThat(solution.countSubstrings(" 6" ), equalTo<Long >(1L ))
42+ assertThat(solution.countSubstrings(" 7" ), equalTo<Long >(1L ))
43+ assertThat(solution.countSubstrings(" 8" ), equalTo<Long >(1L ))
44+ assertThat(solution.countSubstrings(" 9" ), equalTo<Long >(1L ))
45+ }
46+
47+ @Test
48+ fun testDivisibilityBy4 () {
49+ val solution = Solution ()
50+ assertThat(solution.countSubstrings(" 44" ), equalTo<Long >(3L ))
51+ assertThat(solution.countSubstrings(" 48" ), equalTo<Long >(3L ))
52+ assertThat(solution.countSubstrings(" 24" ), equalTo<Long >(3L ))
53+ }
54+
55+ @Test
56+ fun testDivisibilityBy8 () {
57+ val solution = Solution ()
58+ assertThat(solution.countSubstrings(" 888" ), equalTo<Long >(6L ))
59+ assertThat(solution.countSubstrings(" 808" ), equalTo<Long >(4L ))
60+ assertThat(solution.countSubstrings(" 8888" ), equalTo<Long >(10L ))
61+ }
62+
63+ @Test
64+ fun testDivisibilityBy7 () {
65+ val solution = Solution ()
66+ assertThat(solution.countSubstrings(" 777" ), equalTo<Long >(6L ))
67+ assertThat(solution.countSubstrings(" 70" ), equalTo<Long >(1L ))
68+ }
69+
70+ @Test
71+ fun testMixedCases () {
72+ val solution = Solution ()
73+ assertThat(solution.countSubstrings(" 1234" ), equalTo<Long >(6L ))
74+ assertThat(solution.countSubstrings(" 456" ), equalTo<Long >(5L ))
75+ assertThat(solution.countSubstrings(" 987" ), equalTo<Long >(4L ))
3676 }
3777
3878 @Test
39- fun countSubstrings7 () {
40- assertThat<Long >(Solution ().countSubstrings(" 8" ), equalTo<Long >(1L ))
79+ fun testEdgeCases () {
80+ val solution = Solution ()
81+ assertThat(solution.countSubstrings(" 0" ), equalTo<Long >(0L ))
82+ assertThat(solution.countSubstrings(" 10" ), equalTo<Long >(1L ))
83+ assertThat(solution.countSubstrings(" 100" ), equalTo<Long >(1L ))
4184 }
4285}
0 commit comments