Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some tests for Coproduct and WriterT #866

Merged
merged 1 commit into from
Feb 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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