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 OrderTests for SortedSet #2915

Merged
merged 1 commit into from
Jun 27, 2019
Merged
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
4 changes: 3 additions & 1 deletion tests/src/test/scala/cats/tests/SortedSetSuite.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cats
package tests

import cats.kernel.laws.discipline.{BoundedSemilatticeTests, HashTests, PartialOrderTests}
import cats.kernel.laws.discipline.{BoundedSemilatticeTests, HashTests, OrderTests, PartialOrderTests}
import cats.kernel.{BoundedSemilattice, Semilattice}
import cats.laws._
import cats.laws.discipline.SemigroupalTests.Isomorphisms
Expand All @@ -19,6 +19,8 @@ class SortedSetSuite extends CatsSuite {
checkAll("Semigroupal[SortedSet]", SerializableTests.serializable(Semigroupal[SortedSet]))

checkAll("SortedSet[Int]", FoldableTests[SortedSet].foldable[Int, Int])
checkAll("Order[SortedSet[Int]]", OrderTests[SortedSet[Int]].order)
checkAll("Order.reverse(Order[SortedSet[Int]])", OrderTests(Order.reverse(Order[SortedSet[Int]])).order)
checkAll("PartialOrder[SortedSet[Int]]", PartialOrderTests[SortedSet[Int]].partialOrder)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kailuowang Do we still need these?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is redundant, but we are not very consistent when it comes testing laws already covered by the type class laws lower in the hierarchy. That's why I didn't raise an objection here. There is benefit in redundant tests, also sometimes it's hard to track which tests are already covered and remove them. Reducing redundancy to minimum (i.e. always test only the laws lowest in the hierarchy) might have its own problem as well. So right now we are doing it rather arbitrarily. We should probably come up with a principle and add it to the guideline. I created an issue for it #2919

checkAll("PartialOrder.reverse(PartialOrder[SortedSet[Int]])",
PartialOrderTests(PartialOrder.reverse(PartialOrder[SortedSet[Int]])).partialOrder)
Expand Down