forked from igorwojda/kotlin-coding-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge.kt
55 lines (44 loc) · 1.14 KB
/
challenge.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.igorwojda.string.issubstring
import org.amshove.kluent.shouldBeEqualTo
import org.junit.jupiter.api.Test
private fun isSubstring(str: String, subStr: String): Boolean {
TODO("not implemented")
}
private class Test {
@Test
fun `abd not in abcd`() {
isSubstring("abcd", "abd") shouldBeEqualTo false
}
@Test
fun `e not in abcd`() {
isSubstring("abcd", "e") shouldBeEqualTo false
}
@Test
fun `ab in abd`() {
isSubstring("abc", "ab") shouldBeEqualTo true
}
@Test
fun `bc in abc`() {
isSubstring("abc", "bc") shouldBeEqualTo true
}
@Test
fun `abc in ababc`() {
isSubstring("ababc", "abc") shouldBeEqualTo true
}
@Test
fun `cd in abcdef`() {
isSubstring("abcdef", "cd") shouldBeEqualTo true
}
@Test
fun `empty sub-string not in abc`() {
isSubstring("abc", "") shouldBeEqualTo false
}
@Test
fun `abc not in empty string`() {
isSubstring("", "abc") shouldBeEqualTo false
}
@Test
fun `empty sub-string not in empt ystring`() {
isSubstring("", "") shouldBeEqualTo false
}
}