Skip to content

Commit

Permalink
Merge pull request #866 from adelbertc/some-tests
Browse files Browse the repository at this point in the history
Add some tests for Coproduct and WriterT
  • Loading branch information
stew committed Feb 24, 2016
2 parents fa20a49 + 3b67fad commit 32557cd
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 32557cd

Please sign in to comment.