Skip to main content

KotlinTest

Basic Setup

Solution

fun add(a: Int, b: Int) = a + b
fun add(a: Int, b: Int) = a + b

Tests

import io.kotlintest.matchers.shouldBe
import io.kotlintest.specs.StringSpec

class TestAdd : StringSpec() {
    init {
        "add(1, 1) should return 2" {
            add(1, 1) shouldBe 2
        }
    }
}
import io.kotlintest.matchers.shouldBe
import io.kotlintest.specs.StringSpec

class TestAdd : StringSpec() {
    init {
        "add(1, 1) should return 2" {
            add(1, 1) shouldBe 2
        }
    }
}