Skip to content
Permalink
Browse files

Updated to Scala 2.12.10

  • Loading branch information
kiroco12 committed Nov 26, 2019
1 parent f6b8d8a commit f3fbc281001fa9740445165c884f21b0f41a0135
@@ -1,8 +1,8 @@
language: scala
scala:
- 2.11.11
- 2.12.10
jdk:
- oraclejdk8
- openjdk8
script:
- sbt test

@@ -1,18 +1,21 @@
val scalaExercisesV = "0.4.0-SNAPSHOT"
import ProjectPlugin.autoImport._

val scalaExercisesV = "0.5.0-SNAPSHOT"

def dep(artifactId: String) = "org.scala-exercises" %% artifactId % scalaExercisesV

lazy val scalacheck = (project in file("."))
.enablePlugins(ExerciseCompilerPlugin)
.settings(
name := "exercises-scalacheck",
name := "exercises-scalacheck",
libraryDependencies ++= Seq(
dep("exercise-compiler"),
dep("definitions"),
%%("scalatest"),
%%("scalacheck"),
%%("scheckShapeless"),
"com.fortysevendeg" %% "scalacheck-datetime" % "0.2.0"
%%("scalatest", V.scalatest),
%%("scalacheck", V.scalacheck),
%%("shapeless", V.shapeless),
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless,
"com.47deg" %% "scalacheck-toolbox-datetime" % V.scalacheckDatetime
)
)

@@ -1,5 +1,5 @@
import de.heikoseeberger.sbtheader.HeaderPattern
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
import de.heikoseeberger.sbtheader.License._
import sbt.Keys._
import sbt._
import sbtorgpolicies._
@@ -12,6 +12,20 @@ object ProjectPlugin extends AutoPlugin {

override def requires: Plugins = plugins.JvmPlugin && OrgPoliciesPlugin

object autoImport {

lazy val V = new {
val scala212: String = "2.12.10"
val shapeless: String = "2.3.3"
val scalatest: String = "3.0.8"
val scalacheck: String = "1.14.2"
val scalacheckShapeless: String = "1.2.3"
val scalacheckDatetime: String = "0.3.1"
}
}

import autoImport._

override def projectSettings: Seq[Def.Setting[_]] =
Seq(
description := "Scala Exercises: The path to enlightenment",
@@ -25,23 +39,17 @@ object ProjectPlugin extends AutoPlugin {
organizationEmail = "hello@47deg.com"
),
orgLicenseSetting := ApacheLicense,
scalaVersion := "2.11.11",
scalaVersion := V.scala212,
scalaOrganization := "org.scala-lang",
crossScalaVersions := Seq("2.11.11"),
resolvers ++= Seq(
Resolver.mavenLocal,
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases")
),
scalacOptions := sbtorgpolicies.model.scalacCommonOptions,
headers := Map(
"scala" -> (HeaderPattern.cStyleBlockComment,
s"""|/*
| * scala-exercises - ${name.value}
| * Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
| */
|
|""".stripMargin)
)
headerLicense := Some(Custom(s"""| scala-exercises - ${name.value}
| Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
|
|""".stripMargin))
)
}
@@ -1 +1 @@
sbt.version=0.13.13
sbt.version=1.2.8
@@ -2,5 +2,5 @@ resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots")
)

addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.4.0-SNAPSHOT", "0.13", "2.10")
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.5.13")
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.5.0-SNAPSHOT")
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.12.0-M3")
@@ -1,12 +1,13 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib

import org.scalatest.Matchers
import org.scalatest.prop.Checkers
import org.scalatestplus.scalacheck.Checkers

/** ==The `arbitrary` Generator==
*
@@ -33,10 +34,7 @@ import org.scalatest.prop.Checkers
*
* @param name arbitrary
*/
object ArbitrarySection
extends Checkers
with Matchers
with org.scalaexercises.definitions.Section {
object ArbitrarySection extends Checkers with Matchers with org.scalaexercises.definitions.Section {

import GeneratorsHelper._

@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib
@@ -1,17 +1,20 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib

import org.scalatest.Matchers
import org.scalatest.prop.Checkers
import org.scalatestplus.scalacheck.Checkers

/** Generators are responsible for generating test data in ScalaCheck, and are represented by the `org.scalacheck.Gen`
* class. In the `Gen` object, there are several methods for creating new and modifying existing generators.
* class. ou need to know how to use this class if you want ScalaCheck to generate data of types that are not supported
* by default, or if you want to use the `forAll` method mentioned above, to state properties about a specific subset of
* a type. In the `Gen` object, there are several methods for creating new and modifying existing generators.
* We will show how to use some of them in this section. For a more complete reference of what is available,
* please see the [[https://www.scalacheck.org/files/scalacheck_2.11-1.13.4-api/index.html API scaladoc]].
* please see the API scaladoc.
*
*
* A generator can be seen simply as a function that takes some generation parameters, and (maybe) returns a
@@ -214,13 +217,15 @@ object GeneratorsSection
* {{{
* val genIntList = Gen.containerOf[List,Int](Gen.oneOf(1, 3, 5))
*
* val genStringStream = Gen.containerOf[Stream,String](Gen.alphaStr)
* val genStringStream = Gen.containerOf[LazyList,String](Gen.alphaStr)
*
* val genBoolArray = Gen.containerOf[Array,Boolean](true)
* }}}
*
* By default, ScalaCheck supports generation of `List`, `Stream`, `Set`, `Array`, and `ArrayList`
* (from `java.util`). You can add support for additional containers by adding implicit `Buildable` instances.
* By default, ScalaCheck supports generation of `List`, `Stream` (Scala 2.10 -
* 2.12, deprecated in 2.13), `LazyList` (Scala 2.13), `Set`, `Array`, and
* `ArrayList` (from `java.util`). You can add support for additional containers
* by adding implicit `Buildable` instances. See `Buildable.scala` for examples.
*
* There is also `Gen.nonEmptyContainerOf` for generating non-empty containers, and `Gen.containerOfN` for
* generating containers of a given size.
@@ -1,12 +1,13 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib

import org.scalatest._
import org.scalatest.prop.Checkers
import org.scalatestplus.scalacheck.Checkers

/** A ''property'' is the testable unit in ScalaCheck, and is represented by the `org.scalacheck.Prop` class.
* There are several ways to create properties in ScalaCheck, one of them is to use the `org.scalacheck.Prop.forAll`
@@ -119,7 +120,7 @@ object PropertiesSection
* all cases where `n` is non-zero will be thrown away:
*
* {{{
* scala> import org.scalacheck.Prop.{forAll, BooleanOperators}
* scala> import org.scalacheck.Prop.{forAll, propBoolean}
* scala> val propTrivial = forAll { n: Int =>
* | (n == 0) ==> n + 10 == 10
* | }
@@ -138,7 +139,7 @@ object PropertiesSection
*/
def conditionalProperties(res0: Int) = {

import org.scalacheck.Prop.{forAll, BooleanOperators}
import org.scalacheck.Prop.{forAll, propBoolean}

check {
forAll { n: Int =>
@@ -201,7 +202,7 @@ object PropertiesSection

class ZeroSpecification extends Properties("Zero") {

import org.scalacheck.Prop.{forAll, BooleanOperators}
import org.scalacheck.Prop.{forAll, propBoolean}

property("addition property") = forAll { n: Int =>
(n != 0) ==> (n + res0 == n)
@@ -1,12 +1,13 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib

import org.scalatest.Matchers
import org.scalatest.prop.Checkers
import org.scalatestplus.scalacheck.Checkers

/** scalacheck-datetime is a library for helping use datetime libraries with ScalaCheck
*
@@ -18,12 +19,12 @@ import org.scalatest.prop.Checkers
* {{{
* resolvers += Resolver.sonatypeRepo("releases")
*
* "com.fortysevendeg" %% "scalacheck-datetime" % "0.2.0" % "test"
* "com.47deg" %% "scalacheck-toolbox-datetime" % "0.3.1" % "test"
* }}}
*
* Please, visit the [[https://47deg.github.io/scalacheck-datetime homepage]] for more information
* Please, visit the [[https://47deg.github.io/scalacheck-toolbox homepage]] for more information
*
* @param name scalacheck-datetime
* @param name scalacheck-toolbox-datetime
*/
object ScalacheckDatetimeSection
extends Checkers
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib
@@ -18,6 +19,7 @@ object ScalacheckLibrary extends org.scalaexercises.definitions.Library {
override def sections = List(
PropertiesSection,
GeneratorsSection,
ArbitrarySection,
ScalacheckDatetimeSection
)

@@ -1,13 +1,15 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib

import org.scalacheck.Shapeless._
import org.scalacheck.ScalacheckShapeless._
import org.scalaexercises.Test
import org.scalatest.FunSuite
import org.scalatest.prop.Checkers
import org.scalatestplus.scalacheck.Checkers
import shapeless.HNil

class ArbitrarySpec extends FunSuite with Checkers {
@@ -1,13 +1,15 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib

import org.scalacheck.Shapeless._
import org.scalacheck.ScalacheckShapeless._
import org.scalaexercises.Test
import org.scalatest.FunSuite
import org.scalatest.prop.Checkers
import org.scalatestplus.scalacheck.Checkers
import shapeless.HNil

class GeneratorsSpec extends FunSuite with Checkers {
@@ -1,13 +1,15 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib

import org.scalacheck.Shapeless._
import org.scalacheck.ScalacheckShapeless._
import org.scalaexercises.Test
import org.scalatest.FunSuite
import org.scalatest.prop.Checkers
import org.scalatestplus.scalacheck.Checkers
import shapeless.HNil

class PropertiesSpec extends FunSuite with Checkers {
@@ -1,13 +1,15 @@
/*
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalacheck
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalachecklib

import org.scalacheck.Shapeless._
import org.scalacheck.ScalacheckShapeless._
import org.scalaexercises.Test
import org.scalatest.FunSuite
import org.scalatest.prop.Checkers
import org.scalatestplus.scalacheck.Checkers
import shapeless.HNil

class ScalacheckDatetimeSpec extends FunSuite with Checkers {

0 comments on commit f3fbc28

Please sign in to comment.
You can’t perform that action at this time.