-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c012417
commit 9aa695d
Showing
20 changed files
with
227 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cats | ||
package tests | ||
|
||
import cats.kernel.laws.GroupLaws | ||
|
||
class GroupTests extends CatsSuite { | ||
test("combine minValue") { | ||
Group[Int].combineN(1, Int.MinValue) should ===(Int.MinValue) | ||
} | ||
|
||
test("combine negative") { | ||
Group[Int].combineN(1, -1) should ===(-1) | ||
Group[Int].combineN(1, -10) should ===(-10) | ||
} | ||
|
||
test("companion object syntax") { | ||
Group[Int].inverse(1) should ===(-1) | ||
Group[Int].remove(1, 2) should ===(-1) | ||
} | ||
|
||
checkAll("Int", GroupLaws[Int].group) | ||
checkAll("Double", GroupLaws[Double].group) | ||
// float is *not* associative, and scalacheck knows | ||
// checkAll("Float", GroupLaws[Float].group) | ||
checkAll("Long", GroupLaws[Long].group) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cats | ||
package tests | ||
|
||
class IsTests extends CatsSuite { | ||
import evidence._ | ||
|
||
test("syntax") { | ||
trait Bar | ||
|
||
val lifted: Bar Is Bar = Is.refl[Bar] | ||
val andThen: Leibniz[Bar, Bar] = lifted.andThen(lifted) | ||
val compose: Leibniz[Bar, Bar] = lifted.compose(lifted) | ||
val flip: Leibniz[Bar, Bar] = lifted.flip | ||
val lift: Leibniz[List[Bar], List[Bar]] = lifted.lift[List] | ||
val coerce: Bar = lifted.coerce(new Bar {}) | ||
val predefEq: =:=[Bar, Bar] = lifted.predefEq | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
package cats | ||
package tests | ||
|
||
import org.scalatest._ | ||
|
||
import cats.functor._ | ||
|
||
class MonoidTests extends FunSuite { | ||
class MonoidTests extends CatsSuite { | ||
{ | ||
import cats.implicits._ | ||
Invariant[Monoid] | ||
Cartesian[Monoid] | ||
InvariantMonoidal[Monoid] | ||
} | ||
|
||
{ | ||
test("companion object syntax") { | ||
Monoid.empty[Int] should ===(0) | ||
Monoid.isEmpty(1) should ===(false) | ||
Monoid.isEmpty(0) should ===(true) | ||
} | ||
} | ||
|
||
object MonoidTests { | ||
def summonInstance(): Unit = { | ||
import cats.instances.monoid._ | ||
Invariant[Monoid] | ||
Cartesian[Monoid] | ||
InvariantMonoidal[Monoid] | ||
() | ||
} | ||
|
||
} |
Oops, something went wrong.