Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object IterableExtSpec : Spek({
- val list = (0 until 100).toList()
- describe("splitAt") {
- it("asserts when n < 0") {
- assertFailsWith<IllegalArgumentException> {
- list.splitAt(-2)
- }
- }
- it("returns <empty, original> when n = 0") {
- assertEquals(listOf<Int>() to list, list.splitAt(0))
- }
- it("returns <original, empty> when n = size") {
- assertEquals(list to listOf(), list.splitAt(list.size))
- }
- it("returns <original, empty> when n > size") {
- assertEquals(list to listOf(), list.splitAt(list.size + 10))
- }
- it("otherwise splits the list as desired") {
- assertEquals(list.take(20) to list.takeLast(list.size - 20), list.splitAt(20))
- }
- }
- })
Add Comment
Please, Sign In to add comment