Skip to content

Commit

Permalink
Merge pull request #813 from ashawley/update-examples
Browse files Browse the repository at this point in the history
Update examples to 3.0
  • Loading branch information
ashawley authored May 17, 2021
2 parents a5e9c70 + 0acf11a commit 136d21a
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions examples/commands-leveldb/build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name := "commands-leveldb"

scalaVersion := "2.13.5"
scalaVersion := "3.0.0"

libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % "1.15.3" % Test,
"org.scalacheck" %% "scalacheck" % "1.15.4" % Test,
"org.fusesource.leveldbjni" % "leveldbjni-all" % "1.8"
// "org.fusesource.leveldbjni" % "leveldbjni-all" % "1.7"
// "org.fusesource.leveldbjni" % "leveldbjni-all" % "1.6.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ object LevelDBSpec extends Commands {
genGetExisting(state)
)

val genPut: Gen[Put] = Gen.resultOf(Put)
val genPut: Gen[Put] = Gen.resultOf(Put(_,_))

def genPutExisting(state: State): Gen[Put] = for {
key <- Gen.oneOf(state.contents.keys.toSeq)
value <- Gen.oneOf(arbitrary[List[Byte]],
Gen.const(state.contents(key)))
} yield Put(key,value)

val genGet: Gen[Get] = Gen.resultOf(Get)
val genGet: Gen[Get] = Gen.resultOf(Get(_))

def genGetExisting(state: State): Gen[Get] = for {
key <- Gen.oneOf(state.contents.keys.toSeq)
Expand Down
4 changes: 2 additions & 2 deletions examples/commands-nix/build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name := "commands-nix"

scalaVersion := "2.13.5"
scalaVersion := "3.0.0"

libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % "1.15.3" % Test,
"org.scalacheck" %% "scalacheck" % "1.15.4" % Test,
"net.java.dev.jna" % "jna" % "4.5.1"
)
4 changes: 2 additions & 2 deletions examples/commands-nix/src/test/scala/CommandsNix.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ object MachineSpec extends Commands {
} yield Ping(from, to)

def genBoot(state: State): Gen[Boot] = Gen.oneOf(
state.filterNot(_.running).map(Boot)
state.filterNot(_.running).map(Boot.apply)
)

def genShutdown(state: State): Gen[Shutdown] = Gen.oneOf(
state.filter(_.running).map(Shutdown)
state.filter(_.running).map(Shutdown.apply)
)

def genCommand(state: State): Gen[Command] =
Expand Down
8 changes: 4 additions & 4 deletions examples/commands-redis/build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name := "commands-redis"

scalaVersion := "2.13.5"
scalaVersion := "3.0.0"

libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % "1.15.3" % Test,
"org.slf4j" % "slf4j-simple" % "1.7.25",
"net.debasishg" %% "redisclient" % "3.10"
"org.scalacheck" %% "scalacheck" % "1.15.4" % Test,
"org.slf4j" % "slf4j-simple" % "1.7.30",
("net.debasishg" %% "redisclient" % "3.10").cross(CrossVersion.for3Use2_13)
)
6 changes: 3 additions & 3 deletions examples/commands-redis/src/test/scala/CommandsRedis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ object RedisSpec extends Commands {

def genDelExisting(state: State): Gen[Del] =
if(state.contents.isEmpty) genDel
else someOf(state.contents.keys.toSeq).map(Del)
else someOf(state.contents.keys.toSeq).map(Del.apply)

def genSetExisting(state: State): Gen[Set] =
if(state.contents.isEmpty) genSet else for {
key <- oneOf(state.contents.keys.toSeq)
value <- oneOf(genVal, const(state.contents(key)))
} yield Set(key,value)

val genGet: Gen[Get] = genKey.map(Get)
val genGet: Gen[Get] = genKey.map(Get.apply)

val genDel: Gen[Del] = nonEmptyListOf(genKey).map(Del)
val genDel: Gen[Del] = nonEmptyListOf(genKey).map(Del.apply)

def genGetExisting(state: State): Gen[Get] =
if(state.contents.isEmpty) genGet else for {
Expand Down
2 changes: 1 addition & 1 deletion examples/scalajs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The following is what you need to add to your `build.sbt` file to make the
ScalaCheck test runner work:

```
libraryDependencies += "org.scalacheck" %%% "scalacheck" % "1.14.3" % Test
libraryDependencies += "org.scalacheck" %%% "scalacheck" % "1.15.4" % Test
```

## Limitations
Expand Down
4 changes: 2 additions & 2 deletions examples/scalajs/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ name := "ScalaCheck-scalajs-example"

version := "0.1-SNAPSHOT"

scalaVersion := "2.13.5"
scalaVersion := "3.0.0"

libraryDependencies += "org.scalacheck" %%% "scalacheck" % "1.15.3" % Test
libraryDependencies += "org.scalacheck" %%% "scalacheck" % "1.15.4" % Test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import org.scalacheck._

object ScalaJSExampleSpec extends Properties("ScalaCheck-scalajs") {

property("dummy") = Prop.forAll { l: List[String] => l.reverse.reverse == l }
property("dummy") = Prop.forAll { (l: List[String]) => l.reverse.reverse == l }

}
4 changes: 2 additions & 2 deletions examples/simple-sbt/build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name := "scalacheck-demo"

scalaVersion := "2.13.5"
scalaVersion := "3.0.0"

libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.15.3" % Test
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.15.4" % Test

Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-maxSize", "5", "-minSuccessfulTests", "33", "-workers", "1", "-verbosity", "1")
2 changes: 1 addition & 1 deletion examples/simple-sbt/src/test/scala/Demo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.scalacheck.Prop.forAll

object ScalaCheckDemo extends Properties("Demo") {

property("myprop") = forAll { l: List[Int] =>
property("myprop") = forAll { (l: List[Int]) =>
l.reverse.reverse == l
}

Expand Down

0 comments on commit 136d21a

Please sign in to comment.