Skip to content

Commit

Permalink
Add some tests for Coproduct and WriterT
Browse files Browse the repository at this point in the history
  • Loading branch information
adelbertc committed Feb 6, 2016
1 parent 2e9c100 commit 3b67fad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/src/test/scala/cats/tests/CoproductTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,9 @@ class CoproductTests extends CatsSuite {
}
}

test("toValidated + toXor is identity") {
forAll { (x: Coproduct[Option, List, Int]) =>
x.toValidated.toXor should === (x.run)
}
}
}
18 changes: 18 additions & 0 deletions tests/src/test/scala/cats/tests/WriterTTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ class WriterTTests extends CatsSuite {
}
}

test("tell + written is identity") {
forAll { (i: Int) =>
WriterT.tell[Id, Int](i).written should === (i)
}
}

test("value + value is identity") {
forAll { (i: Int) =>
WriterT.value[Id, Int, Int](i).value should === (i)
}
}

test("valueT + value is identity") {
forAll { (i: Int) =>
WriterT.valueT[Id, Int, Int](i).value should === (i)
}
}

{
// F has a SemigroupK
implicit val F: SemigroupK[ListWrapper] = ListWrapper.semigroupK
Expand Down

0 comments on commit 3b67fad

Please sign in to comment.