forked from igorwojda/kotlin-coding-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge.kt
executable file
·39 lines (33 loc) · 1.07 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
package com.igorwojda.string.caesarcipher
import org.amshove.kluent.shouldBeEqualTo
import org.junit.jupiter.api.Test
private fun encodeCaesarCipher(str: String, shift: Int): String {
TODO("not implemented")
}
private class Test {
@Test
fun `'abc' with shift 1 return 'bcd'`() {
encodeCaesarCipher("abc", 1) shouldBeEqualTo "bcd"
}
@Test
fun `'abcdefghijklmnopqrstuvwxyz' shift 1 returns 'bcdefghijklmnopqrstuvwxyza'`() {
encodeCaesarCipher(
"abcdefghijklmnopqrstuvwxyz",
1
) shouldBeEqualTo "bcdefghijklmnopqrstuvwxyza"
}
@Test
fun `'abcdefghijklmnopqrstuvwxyz' shift 7 returns 'hijklmnopqrstuvwxyzabcdefg'`() {
encodeCaesarCipher(
"abcdefghijklmnopqrstuvwxyz",
7
) shouldBeEqualTo "hijklmnopqrstuvwxyzabcdefg"
}
@Test
fun `'abcdefghijklmnopqrstuvwxyz' shift 50 returns 'yzabcdefghijklmnopqrstuvwx'`() {
encodeCaesarCipher(
"abcdefghijklmnopqrstuvwxyz",
50
) shouldBeEqualTo "yzabcdefghijklmnopqrstuvwx"
}
}