You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
678 B
20 lines
678 B
package green.thisfieldwas.embracingnondeterminism.stdlib
|
|
|
|
import green.thisfieldwas.embracingnondeterminism.data.{Semigroup, SemigroupLaws}
|
|
import green.thisfieldwas.embracingnondeterminism.util.Laws
|
|
import org.scalacheck.{Arbitrary, Gen}
|
|
|
|
/** Proves that Scala's Int conforms to a Semigroup.
|
|
*/
|
|
class IntegerSpec extends Laws with SemigroupLaws {
|
|
|
|
/** Int's greater than 1 specifically form a Semigroup.
|
|
*/
|
|
implicit val arbitraryNonZeroPositiveInt: Arbitrary[Int] = Arbitrary(Gen.choose(1, Int.MaxValue))
|
|
|
|
/** Positive Int's of 1 or greater form a Semigroup under addition.
|
|
*/
|
|
implicit val intSemigroup: Semigroup[Int] = _ + _
|
|
|
|
checkSemigroupLaws[Int]()
|
|
}
|
|
|