Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercises Update and Removed Deprecation Warnings #152

Merged
merged 6 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ lazy val stdlib = (project in file("."))
libraryDependencies ++= Seq(
dep("exercise-compiler"),
dep("definitions"),
%%("shapeless"),
%%("scalatest"),
%%("scalacheck"),
%%("scheckShapeless")
"com.chuusai" %% "shapeless" % "2.3.3",
kiroco12 marked this conversation as resolved.
Show resolved Hide resolved
"org.scalatest" %% "scalatest" % V.scalatest,
"org.scalacheck" %% "scalacheck" % V.scalacheck,
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless
)
)

Expand Down
8 changes: 6 additions & 2 deletions project/ProjectPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ object ProjectPlugin extends AutoPlugin {
object autoImport {

lazy val V = new {
val scala212: String = "2.12.10"
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"
}
}

Expand Down Expand Up @@ -44,7 +48,7 @@ object ProjectPlugin extends AutoPlugin {
),
scalacOptions := sbtorgpolicies.model.scalacCommonOptions,
headerLicense := Some(Custom(s"""| scala-exercises - ${name.value}
| Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
| Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
|
|""".stripMargin))
)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Asserts.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/ByNameParameter.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/CaseClasses.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Classes.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/EmptyValues.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Enumerations.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
18 changes: 9 additions & 9 deletions src/main/scala/stdlib/Extractors.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down Expand Up @@ -71,7 +71,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short)

object ChopShop {
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
}

val ChopShop(a, b, c, d) = new Car("Chevy", "Camaro", 1978, 120)
Expand All @@ -88,7 +88,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short)

object ChopShop {
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
}

val x = new Car("Chevy", "Camaro", 1978, 120) match {
Expand All @@ -106,7 +106,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short)

object ChopShop {
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
}

val x = new Car("Chevy", "Camaro", 1978, 120) match {
Expand All @@ -125,9 +125,9 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
class Employee(val firstName: String, val middleName: Option[String], val lastName: String)

object Tokenizer {
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))

def unapply(x: Employee) = Some(x.firstName, x.lastName)
def unapply(x: Employee) = Some((x.firstName, x.lastName))
}

val result = new Employee("Kurt", None, "Vonnegut") match {
Expand All @@ -142,7 +142,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
*/
def anyObjectExtractors(res0: String) {
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short) {
def unapply(x: Car) = Some(x.make, x.model)
def unapply(x: Car) = Some((x.make, x.model))
}

val camaro = new Car("Chevy", "Camaro", 1978, 122)
Expand All @@ -168,7 +168,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
//factory methods, extractors, apply
//Extractor: Create tokens that represent your object
def unapply(x: Employee) =
Some(x.lastName, x.middleName, x.firstName)
Some((x.lastName, x.middleName, x.firstName))
}

val singri = new Employee("Singri", None, "Keerthi")
Expand All @@ -193,7 +193,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
//factory methods, extractors, apply
//Extractor: Create tokens that represent your object
def unapply(x: Employee) =
Some(x.lastName, x.middleName, x.firstName)
Some((x.lastName, x.middleName, x.firstName))
}

val singri = new Employee("Singri", None, "Keerthi")
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/ForExpressions.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
12 changes: 5 additions & 7 deletions src/main/scala/stdlib/Formatting.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down Expand Up @@ -33,18 +33,16 @@ object Formatting extends FlatSpec with Matchers with org.scalaexercises.definit
"%c".format(b) should be(res1)
}

/** Character Literals can be an escape sequence, including octal or hexidecimal:
/** Character Literals can be an escape sequence, including hexidecimal:
*/
def escapeSequenceFormatting(res0: String, res1: String, res2: String, res3: String) {
def escapeSequenceFormatting(res0: String, res1: String, res2: String) {
val c = '\u0061' //unicode for a
val d = '\141' //octal for a
val e = '\"'
val f = '\\'

"%c".format(c) should be(res0)
"%c".format(d) should be(res1)
"%c".format(e) should be(res2)
"%c".format(f) should be(res3)
"%c".format(e) should be(res1)
"%c".format(f) should be(res2)
}

/** Formatting can also include numbers:
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/HigherOrderFunctions.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Implicits.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/InfixPrefixandPostfixOperators.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/InfixTypes.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Iterables.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Lists.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/LiteralBooleans.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/LiteralNumbers.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
9 changes: 1 addition & 8 deletions src/main/scala/stdlib/LiteralStrings.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down Expand Up @@ -31,13 +31,6 @@ object LiteralStrings extends FlatSpec with Matchers with org.scalaexercises.def
c.toString should be(res0)
}

/** Character literals can use octal as well:
*/
def characterLiteralsOctalLiteralStrings(res0: String) {
val d = '\141' //octal for a
d.toString should be(res0)
}

/** Character literals can use escape sequences:
*/
def escapeSequenceLiteralStrings(res0: String, res1: String) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Maps.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/NamedandDefaultArguments.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/NamedandDefaultArgumentsHelper.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Objects.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Options.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/OptionsHelper.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/ParentClasses.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/PartialFunctions.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/PartiallyAppliedFunctions.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/PatternMatching.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/Ranges.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/RepeatedParameters.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/RepeatedParametersHelper.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/stdlib/SequencesandArrays.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* scala-exercises - exercises-stdlib
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

Expand Down
Loading