60 lines
1.6 KiB
Kotlin
60 lines
1.6 KiB
Kotlin
package space.dezentrale.prgrnd
|
|
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertContentEquals
|
|
|
|
class SumOfTwoTest {
|
|
@Test
|
|
fun `simpleSolution returns an array with 0 and 1 for 2_7_11_15 and 9`() {
|
|
val sumOfTwo = SumOfTwo()
|
|
|
|
val twoSum = sumOfTwo.simpleSolution(intArrayOf(2, 7, 11, 15), 9)
|
|
|
|
assertContentEquals(intArrayOf(0, 1), twoSum)
|
|
}
|
|
|
|
@Test
|
|
fun `simpleSolution returns an array with 1 and 2 for 3_2_4 and 6`() {
|
|
val sumOfTwo = SumOfTwo()
|
|
|
|
val twoSum = sumOfTwo.simpleSolution(intArrayOf(3, 2, 4), 6)
|
|
|
|
assertContentEquals(intArrayOf(1, 2), twoSum)
|
|
}
|
|
|
|
@Test
|
|
fun `simpleSolution returns an array with 0 and 1 for 3_3 and 6`() {
|
|
val sumOfTwo = SumOfTwo()
|
|
|
|
val twoSum = sumOfTwo.simpleSolution(intArrayOf(3, 3), 6)
|
|
|
|
assertContentEquals(intArrayOf(0, 1), twoSum)
|
|
}
|
|
|
|
@Test
|
|
fun `optimalSolution returns an array with 0 and 1 for 2_7_11_15 and 9`() {
|
|
val sumOfTwo = SumOfTwo()
|
|
|
|
val twoSum = sumOfTwo.optimalSolution(intArrayOf(2, 7, 11, 15), 9)
|
|
|
|
assertContentEquals(intArrayOf(0, 1), twoSum)
|
|
}
|
|
|
|
@Test
|
|
fun `optimalSolution returns an array with 1 and 2 for 3_2_4 and 6`() {
|
|
val sumOfTwo = SumOfTwo()
|
|
|
|
val twoSum = sumOfTwo.optimalSolution(intArrayOf(3, 2, 4), 6)
|
|
|
|
assertContentEquals(intArrayOf(1, 2), twoSum)
|
|
}
|
|
|
|
@Test
|
|
fun `optimalSolution returns an array with 0 and 1 for 3_3 and 6`() {
|
|
val sumOfTwo = SumOfTwo()
|
|
|
|
val twoSum = sumOfTwo.optimalSolution(intArrayOf(3, 3), 6)
|
|
|
|
assertContentEquals(intArrayOf(0, 1), twoSum)
|
|
}
|
|
} |