Skip to content

Commit

Permalink
More tests for NonEmptyVector#zipWithIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
durban committed Oct 17, 2017
1 parent 1bf60ee commit d21fa9d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,13 @@ class NonEmptyVectorTests extends CatsSuite {
}
}

test("NonEmptyVector#zipWith is consistent with #zipWithIndex") {
forAll { nev: NonEmptyVector[Int] =>
val zw = nev.zipWith(NonEmptyVector.fromVectorUnsafe((0 until nev.length).toVector))(Tuple2.apply)
nev.zipWithIndex should === (zw)
}
}

test("NonEmptyVector#nonEmptyPartition remains sorted") {
forAll { (nev: NonEmptyVector[Int], f: Int => Either[String, String]) =>

Expand Down Expand Up @@ -370,7 +377,9 @@ class NonEmptyVectorTests extends CatsSuite {

test("NonEmptyVector#zipWithIndex is consistent with Vector#zipWithIndex") {
forAll { nonEmptyVector: NonEmptyVector[Int] =>
nonEmptyVector.zipWithIndex should === (NonEmptyVector.fromVectorUnsafe(nonEmptyVector.toVector.zipWithIndex))
val expected = NonEmptyVector.fromVectorUnsafe(nonEmptyVector.toVector.zipWithIndex)
nonEmptyVector.zipWithIndex should === (expected)
Traverse[NonEmptyVector].zipWithIndex(nonEmptyVector) should === (expected)
}
}

Expand Down

0 comments on commit d21fa9d

Please sign in to comment.