diff options
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/collection/immutable/VectorTest.scala | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/junit/scala/collection/immutable/VectorTest.scala b/test/junit/scala/collection/immutable/VectorTest.scala new file mode 100644 index 0000000000..69f74872d0 --- /dev/null +++ b/test/junit/scala/collection/immutable/VectorTest.scala @@ -0,0 +1,30 @@ +package scala.collection.immutable + +import org.junit.Assert._ +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Test + +@RunWith(classOf[JUnit4]) +class VectorTest { + + @Test + def hasCorrectDropAndTakeMethods() { + val v = Vector(0) ++ Vector(1 to 64: _*) + + assertEquals(Vector(0, 1), v take 2) + assertEquals(Vector(63, 64), v takeRight 2) + assertEquals(Vector(2 to 64: _*), v drop 2) + assertEquals(Vector(0 to 62: _*), v dropRight 2) + + assertEquals(v, v take Int.MaxValue) + assertEquals(v, v takeRight Int.MaxValue) + assertEquals(Vector.empty[Int], v drop Int.MaxValue) + assertEquals(Vector.empty[Int], v dropRight Int.MaxValue) + + assertEquals(Vector.empty[Int], v take Int.MinValue) + assertEquals(Vector.empty[Int], v takeRight Int.MinValue) + assertEquals(v, v drop Int.MinValue) + assertEquals(v, v dropRight Int.MinValue) + } +} |