Skip to content

Commit

Permalink
Add explicit tests for helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
yilinwei committed Jun 25, 2020
1 parent d696164 commit 5ea21c1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/src/main/scala/cats/kernel/Enumerable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ object BoundedEnumerable {
cats.kernel.instances.long.catsKernelStdOrderForLong
implicit def catsKernelBoundedEnumerableForChar: BoundedEnumerable[Char] =
cats.kernel.instances.char.catsKernelStdOrderForChar

@inline def apply[A](implicit e: BoundedEnumerable[A]): BoundedEnumerable[A] = e
}

trait LowerBoundedEnumerable[@sp A] extends PartialNextLowerBounded[A] with Next[A] {
Expand Down
24 changes: 24 additions & 0 deletions tests/src/test/scala/cats/tests/BoundedEnumerableSuite.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cats.tests

import cats.kernel.BoundedEnumerable


class BoundedEnumerableSuite extends CatsSuite {

test("membersAscending") {
BoundedEnumerable[Boolean].membersAscending.toList should ===(List(false, true))
}

test("membersDescending") {
BoundedEnumerable[Boolean].membersDescending.toList should ===(List(true, false))
}

test("cycleNext") {
BoundedEnumerable[Boolean].cycleNext(false) should === (true)
}

test("cyclePrevious") {
BoundedEnumerable[Boolean].cyclePrevious(false) should === (true)
}

}

0 comments on commit 5ea21c1

Please sign in to comment.