import kotlin.test.* class T{@Test fun t()=assertEquals(f(3),3)}
import kotlin.test.Testimport kotlin.test.assertEqualsclass ReturnIntTest {@Testfun `returnInt test`() {assertEquals(returnInt(10), 10);}}- import kotlin.test.*
- class T{@Test fun t()=assertEquals(f(3),3)}
import kotlin.test.Test import kotlin.test.assertEquals class ReturnIntTest { @Test fun `returnInt test`() { assertEquals(returnInt(10), 10); } }
- import kotlin.test.Test
- import kotlin.test.assertEquals
- class ReturnIntTest {
- @Test
- fun `returnInt test`() {
assertEquals(10.returnInt(), 10);- assertEquals(returnInt(10), 10);
- }
- }
fun sum(array: IntArray) = array.reduce { sum, element -> sum + element }
def sum(arr):result = 0for i in arr:result += ireturn result- fun sum(array: IntArray) = array.reduce { sum, element -> sum + element }
import kotlin.test.assertEquals import org.junit.Test class TestExample { @Test fun `Basic test`() { assertEquals(sum(intArrayOf(1)), 1) assertEquals(sum(intArrayOf(1, 2, 3)), 6) } }
import codewars_test as test# TODO Write testsfrom solution import sum- import kotlin.test.assertEquals
- import org.junit.Test
# test.assert_equals(actual, expected, [optional] message)@test.describe("Example tests")def test_group():@test.it("Basic tests")def test_case():test.assert_equals(sum([1]), 1)test.assert_equals(sum([1,2,3]), 6)- class TestExample {
- @Test
- fun `Basic test`() {
- assertEquals(sum(intArrayOf(1)), 1)
- assertEquals(sum(intArrayOf(1, 2, 3)), 6)
- }
- }