Skip to content

Commit 1b55f95

Browse files
fix sgf, sieve and linked list exercise
1 parent f231d05 commit 1b55f95

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

bin/test-in-docker

Lines changed: 0 additions & 11 deletions
This file was deleted.

exercises/practice/sgf-parsing/.meta/Example.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ object Sgf extends RegexParsers {
4747

4848
private val propValue: Parser[String] =
4949
"[" ~ rep1(propValuePart) ~ "]" ^^ {
50-
case _ ~ values ~ _ => values mkString
50+
case _ ~ values ~ _ => values.mkString
5151
} named "propValue"
5252

5353
private val propValuePart: Parser[String] = {
5454
implicit class AsStringParser(self: String) { def p: Parser[String] = self }
55-
val ignore = const("") _
55+
val ignore = const("")
5656

5757
val escapedNewline: Parser[String] = "\\\n".p ^^ ignore
5858
val escapedChar: Parser[String] = """\\.""".r ^^ (_.takeRight(1))

exercises/practice/sieve/.meta/Example.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ object Sieve {
66
val primes = mutable.HashSet.empty ++ (2 to upperBound)
77

88
// Remove multiples of a possiblePrime from the primes set.
9-
def checkPrime(possiblePrime: Int) {
9+
def checkPrime(possiblePrime: Int) = {
1010
if (primes contains possiblePrime) {
1111
// remove multiples of possiblePrime from set
1212
val possibleSquared = possiblePrime * possiblePrime

exercises/practice/simple-linked-list/src/test/scala/SimpleLinkedListTest.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ class SimpleLinkedListTest extends AnyFlatSpec with Matchers with ScalaCheckDriv
6565

6666
it should "handle arbitrary list fromSeq toSeq" in {
6767
pending
68-
forAll { seq: Seq[Int] =>
68+
forAll { (seq: Seq[Int]) =>
6969
assert(SimpleLinkedList.fromSeq(seq).toSeq == seq)
7070
}
7171
}
7272

7373
it should "handle reverse arbitrary list " in {
7474
pending
75-
forAll { seq: Seq[Int] =>
75+
forAll { (seq: Seq[Int]) =>
7676
assert(SimpleLinkedList.fromSeq(seq).reverse.toSeq == seq.reverse)
7777
}
7878
}
7979

8080
it should "reverse arbitrary list back to original" in {
8181
pending
82-
forAll { list: SimpleLinkedList[Int] =>
82+
forAll { (list: SimpleLinkedList[Int]) =>
8383
assert(list.reverse.reverse.toSeq == list.toSeq)
8484
}
8585
}
@@ -90,7 +90,7 @@ class SimpleLinkedListTest extends AnyFlatSpec with Matchers with ScalaCheckDriv
9090
(0 until i).foldLeft(list)((acc, j) => acc.next).value
9191
}
9292

93-
forAll { xs: Seq[Int] =>
93+
forAll { (xs: Seq[Int]) =>
9494
whenever(xs.nonEmpty) {
9595
val list = SimpleLinkedList.fromSeq(xs)
9696
xs.indices.foreach {
@@ -102,15 +102,15 @@ class SimpleLinkedListTest extends AnyFlatSpec with Matchers with ScalaCheckDriv
102102

103103
it should "return original arbitrary list from added list elements" in {
104104
pending
105-
forAll { xs: Seq[Int] =>
105+
forAll { (xs: Seq[Int]) =>
106106
val list = xs.foldLeft(SimpleLinkedList[Int]())(_.add(_))
107107
assert(list.toSeq == xs)
108108
}
109109
}
110110

111111
it should "handle arbitrary generics" in {
112112
pending
113-
forAll { xs: Seq[String] =>
113+
forAll { (xs: Seq[String]) =>
114114
assert(SimpleLinkedList.fromSeq(xs).toSeq == xs)
115115
}
116116
}

0 commit comments

Comments
 (0)