diff --git a/src/test/kotlin/app/extensions/ArrayExtensionsKtTest.kt b/src/test/kotlin/app/extensions/ArrayExtensionsKtTest.kt new file mode 100644 index 0000000..0af8c1c --- /dev/null +++ b/src/test/kotlin/app/extensions/ArrayExtensionsKtTest.kt @@ -0,0 +1,23 @@ +package app.extensions + +import org.junit.jupiter.api.Test + +import org.junit.jupiter.api.Assertions.* + +internal class ArrayExtensionsTest { + @Test + fun matchingIndexes() { + val array = arrayOf(0, 1, 2, 3, null, 5, 6, null) + val result = array.matchingIndexes { it == null } + assertEquals(result.count(), 2) + assertEquals(result[0], 4) + assertEquals(result[1], 7) + } + + @Test + fun matchingIndexes_empty_array() { + val array = arrayOf() + val result = array.matchingIndexes { it > 0 } + assertEquals(result.count(), 0) + } +} \ No newline at end of file