Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii committed Nov 13, 2024
1 parent 6afb261 commit 120dcd9
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
package zio.prelude

import zio.Trace
import zio.prelude.laws._
import zio.prelude.data.Optional
import zio.test._
import zio.test.laws._

object IdentityBothSpec extends ZIOBaseSpec {

val optional: GenF[Any, Optional] =
new GenF[Any, Optional] {
def apply[R1, A](gen: Gen[R1, A])(implicit trace: Trace): Gen[R1, Optional[A]] =
Gen.option(gen)
}

def spec: Spec[Environment, Any] =
suite("IdentityBothSpec")(
suite("laws")(
test("either")(checkAllLaws(IdentityBothLaws)(GenF.either(Gen.int), Gen.int)),
test("list")(checkAllLaws(IdentityBothLaws)(GenF.list, Gen.int)),
test("option")(checkAllLaws(IdentityBothLaws)(GenF.option, Gen.int)),
test("optional")(checkAllLaws(IdentityBothLaws)(optional, Gen.int)),
test("try")(checkAllLaws(IdentityBothLaws)(GenFs.tryScala, Gen.int))
)
)
Expand Down

0 comments on commit 120dcd9

Please sign in to comment.