added sample comparator code and tidied up some test cases & converted them to the cleaner JUnit 4 style

This commit is contained in:
James Strachan
2012-03-26 11:43:25 +01:00
parent dcae0277f1
commit 5b252aaf39
6 changed files with 57 additions and 69 deletions
+5 -11
View File
@@ -2,18 +2,12 @@ package test.collections
import kotlin.test.*
// TODO can we avoid importing all this stuff by default I wonder?
// e.g. making println and the collection builder methods public by default?
import kotlin.*
import kotlin.io.*
import kotlin.util.*
import java.util.*
import junit.framework.TestCase
import org.junit.Test
class ListTest() : TestCase() {
class ListTest {
val data = arrayList("foo", "bar")
fun testHeadAndTail() {
Test fun headAndTail() {
val h = data.head
assertEquals("foo", h)
@@ -21,7 +15,7 @@ class ListTest() : TestCase() {
assertEquals("bar", t)
}
fun testFirstAndLast() {
Test fun firstAndLast() {
val h = data.first
assertEquals("foo", h)
@@ -29,7 +23,7 @@ class ListTest() : TestCase() {
assertEquals("bar", t)
}
fun testWithIndices() {
Test fun withIndices() {
val withIndices = data.withIndices()
var index = 0
for (withIndex in withIndices) {