Skip to content

Commit

Permalink
Add tests for IdT
Browse files Browse the repository at this point in the history
  • Loading branch information
vikraman committed Nov 24, 2015
1 parent ae4e46c commit bc7f3d3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions laws/src/main/scala/cats/laws/discipline/Arbitrary.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ object arbitrary extends ArbitraryInstances0 {
implicit def optionTArbitrary[F[_], A](implicit F: Arbitrary[F[Option[A]]]): Arbitrary[OptionT[F, A]] =
Arbitrary(F.arbitrary.map(OptionT.apply))

implicit def idTArbitrary[F[_], A](implicit F: Arbitrary[F[A]]): Arbitrary[IdT[F, A]] =
Arbitrary(F.arbitrary.map(IdT.apply))

implicit def evalArbitrary[A: Arbitrary]: Arbitrary[Eval[A]] =
Arbitrary(Gen.oneOf(
getArbitrary[A].map(Eval.now(_)),
Expand Down
16 changes: 16 additions & 0 deletions tests/src/test/scala/cats/tests/IdTTests.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cats.tests

import cats.{Monad, Traverse}
import cats.data.IdT
import cats.laws.discipline.{MonadTests, SerializableTests, TraverseTests}
import cats.laws.discipline.arbitrary._

class IdTTests extends CatsSuite {

checkAll("IdT[List, Int]", MonadTests[IdT[List, ?]].monad[Int, Int, Int])
checkAll("Monad[IdT[List, ?]]", SerializableTests.serializable(Monad[IdT[List, ?]]))

checkAll("IdT[List, Int]", TraverseTests[IdT[List, ?]].traverse[Int, Int, Int, Int, List, List])
checkAll("Traverse[IdT[List, ?]]", SerializableTests.serializable(Traverse[IdT[List, ?]]))

}

0 comments on commit bc7f3d3

Please sign in to comment.