Skip to content

Commit

Permalink
add tests to AlternativeSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
satorg committed Oct 9, 2021
1 parent d19b1d7 commit 499739b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/src/test/scala/cats/tests/AlternativeSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import cats.Alternative
import cats.syntax.eq._
import org.scalacheck.Prop._

import scala.collection.immutable.Seq

class AlternativeSuite extends CatsSuite {
property("unite") {
forAll { (list: List[Option[String]]) =>
Expand Down Expand Up @@ -37,4 +39,16 @@ class AlternativeSuite extends CatsSuite {
assert(Alternative[Option].guard(true).isDefined)
assert(Alternative[Option].guard(false).isEmpty)
}

property("prependK") {
forAll { (fa: Seq[Int], a: Int) =>
assert(Alternative[Seq].prependK(fa, a) === a +: fa)
}
}

property("appendK") {
forAll { (fa: Seq[Int], a: Int) =>
assert(Alternative[Seq].appendK(fa, a) === fa :+ a)
}
}
}

0 comments on commit 499739b

Please sign in to comment.