forked from igorwojda/kotlin-coding-challenges
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchallenge.kt
33 lines (28 loc) · 875 Bytes
/
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
package com.igorwojda.integer.reverse
import org.amshove.kluent.shouldBeEqualTo
import org.junit.jupiter.api.Test
private fun reverseInt(i: Int): Int {
TODO("not implemented")
}
private class Test {
@Test
fun `ReverseInt handles 0 as an input`() {
reverseInt(0) shouldBeEqualTo 0
}
@Test
fun `ReverseInt flips a positive number`() {
reverseInt(5) shouldBeEqualTo 5
reverseInt(15) shouldBeEqualTo 51
reverseInt(90) shouldBeEqualTo 9
reverseInt(700) shouldBeEqualTo 7
reverseInt(2359) shouldBeEqualTo 9532
}
@Test
fun `ReverseInt flips a negative number`() {
reverseInt(-5) shouldBeEqualTo -5
reverseInt(-15) shouldBeEqualTo -51
reverseInt(-90) shouldBeEqualTo -9
reverseInt(-700) shouldBeEqualTo -7
reverseInt(-2359) shouldBeEqualTo -9532
}
}