trackler 2.2.1.30 → 2.2.1.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/word-search/canonical-data.json +278 -4
  4. data/tracks/c/exercises/raindrops/test/test_raindrops.c +0 -16
  5. data/tracks/ceylon/README.md +1 -1
  6. data/tracks/ceylon/config.json +12 -0
  7. data/tracks/ceylon/docs/RESOURCES.md +1 -1
  8. data/tracks/ceylon/exercises/anagram/source/anagram/AnagramTest.ceylon +1 -1
  9. data/tracks/ceylon/exercises/anagram/source/anagram/module.ceylon +1 -1
  10. data/tracks/ceylon/exercises/bracket-push/example/module.ceylon +2 -2
  11. data/tracks/ceylon/exercises/bracket-push/source/bracketpush/BracketsTest.ceylon +1 -1
  12. data/tracks/ceylon/exercises/bracket-push/source/bracketpush/module.ceylon +1 -1
  13. data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +1 -1
  14. data/tracks/ceylon/exercises/hamming/source/hamming/module.ceylon +1 -1
  15. data/tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon +1 -1
  16. data/tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/module.ceylon +1 -1
  17. data/tracks/ceylon/exercises/leap/source/leap/LeapTest.ceylon +1 -1
  18. data/tracks/ceylon/exercises/leap/source/leap/module.ceylon +1 -1
  19. data/tracks/ceylon/exercises/react/example/module.ceylon +2 -2
  20. data/tracks/ceylon/exercises/react/source/react/ReactorTest.ceylon +1 -1
  21. data/tracks/ceylon/exercises/react/source/react/module.ceylon +1 -1
  22. data/tracks/ceylon/exercises/rna-transcription/README.md +41 -0
  23. data/tracks/ceylon/exercises/rna-transcription/example/RNA.ceylon +13 -0
  24. data/tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNA.ceylon +5 -0
  25. data/tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNAtest.ceylon +33 -0
  26. data/tracks/ceylon/exercises/rna-transcription/source/rnatranscription/module.ceylon +3 -0
  27. data/tracks/ceylon/exercises/sieve/example/module.ceylon +2 -2
  28. data/tracks/ceylon/exercises/sieve/source/sieve/SieveTest.ceylon +1 -1
  29. data/tracks/ceylon/exercises/sieve/source/sieve/module.ceylon +1 -1
  30. data/tracks/clojure/.travis.yml +1 -1
  31. data/tracks/clojure/_src/generator.clj +1 -1
  32. data/tracks/clojure/exercises/clock/{clock.mustache → .meta/clock.mustache} +0 -0
  33. data/tracks/clojure/exercises/luhn/{luhn.mustache → .meta/luhn.mustache} +0 -0
  34. data/tracks/clojure/exercises/sublist/{sublist.mustache → .meta/sublist.mustache} +0 -0
  35. data/tracks/go/exercises/robot-name/.meta/hints.md +13 -0
  36. data/tracks/go/exercises/robot-name/bonus_example.go +2 -0
  37. data/tracks/java/gradle/wrapper/gradle-wrapper.jar +0 -0
  38. data/tracks/java/gradle/wrapper/gradle-wrapper.properties +2 -2
  39. data/tracks/java/gradlew +3 -3
  40. data/tracks/java/gradlew.bat +0 -0
  41. data/tracks/php/config.json +8 -0
  42. data/tracks/php/exercises/flatten-array/example.php +10 -0
  43. data/tracks/php/exercises/flatten-array/flatten-array_test.php +51 -0
  44. data/tracks/ruby/exercises/hello-world/GETTING_STARTED.md +2 -2
  45. data/tracks/scala/exercises/accumulate/src/test/scala/AccumulateTest.scala +1 -0
  46. data/tracks/scala/exercises/allergies/example.scala +3 -3
  47. data/tracks/scala/exercises/allergies/src/test/scala/AllergiesTest.scala +68 -33
  48. data/tracks/scala/exercises/bank-account/src/test/scala/BankAccountTest.scala +1 -0
  49. data/tracks/scala/exercises/binary-search-tree/src/test/scala/BstTest.scala +1 -0
  50. data/tracks/scala/exercises/connect/example.scala +1 -1
  51. data/tracks/scala/exercises/connect/src/test/scala/ConnectTest.scala +72 -56
  52. data/tracks/scala/exercises/dominoes/src/main/scala/.keep +0 -0
  53. data/tracks/scala/exercises/dominoes/src/test/scala/DominoesTest.scala +32 -31
  54. data/tracks/scala/exercises/grade-school/src/test/scala/GradeSchoolTest.scala +1 -0
  55. data/tracks/scala/exercises/lens-person/src/test/scala/LensPersonTest.scala +1 -0
  56. data/tracks/scala/exercises/linked-list/src/test/scala/DequeTest.scala +1 -0
  57. data/tracks/scala/exercises/matrix/src/test/scala/MatrixTest.scala +1 -0
  58. data/tracks/scala/exercises/parallel-letter-frequency/src/test/scala/FrequencyTest.scala +1 -0
  59. data/tracks/scala/exercises/protein-translation/src/test/scala/ProteinTranslationTest.scala +2 -1
  60. data/tracks/scala/exercises/pythagorean-triplet/src/test/scala/PythagoreanTripletTest.scala +1 -0
  61. data/tracks/scala/exercises/robot-name/src/test/scala/RobotNameTest.scala +1 -0
  62. data/tracks/scala/exercises/series/src/test/scala/SeriesTest.scala +1 -0
  63. data/tracks/scala/exercises/sgf-parsing/src/test/scala/SgfTest.scala +1 -0
  64. data/tracks/scala/exercises/simple-cipher/src/test/scala/CipherTest.scala +1 -0
  65. data/tracks/scala/exercises/simple-linked-list/src/test/scala/SimpleLinkedListTest.scala +1 -1
  66. data/tracks/scala/exercises/strain/src/test/scala/StrainTest.scala +2 -1
  67. data/tracks/scala/exercises/wordy/example.scala +3 -3
  68. data/tracks/scala/exercises/wordy/src/test/scala/WordyTest.scala +84 -0
  69. data/tracks/scala/exercises/zebra-puzzle/src/test/scala/ZebraPuzzleTest.scala +1 -0
  70. data/tracks/scala/exercises/zipper/src/test/scala/ZipperTest.scala +1 -0
  71. data/tracks/scala/testgen/src/main/scala/AllergiesTestGenerator.scala +60 -0
  72. data/tracks/scala/testgen/src/main/scala/ConnectTestGenerator.scala +52 -0
  73. data/tracks/scala/testgen/src/main/scala/DominoesTestGenerator.scala +71 -0
  74. data/tracks/scala/testgen/src/main/scala/WordyTestGenerator.scala +35 -0
  75. data/tracks/scala/testgen/src/main/scala/testgen/TestSuiteBuilder.scala +20 -0
  76. data/tracks/scala/testgen/src/main/twirl/funSuiteTemplateIgnoreExpected.scala.txt +16 -0
  77. metadata +20 -8
  78. data/tracks/scala/exercises/allergies/src/main/scala/Allergies.scala +0 -11
  79. data/tracks/scala/exercises/dominoes/src/main/scala/Dominoes.scala +0 -4
  80. data/tracks/scala/exercises/wordy/src/test/scala/WordProblemTest.scala +0 -81
@@ -1,5 +1,6 @@
1
1
  import org.scalatest.{Matchers, FunSuite}
2
2
 
3
+ /** @version created manually **/
3
4
  class SeriesTest extends FunSuite with Matchers {
4
5
 
5
6
  test("slices of one") {
@@ -1,6 +1,7 @@
1
1
  import org.scalatest.{FunSuite, Matchers}
2
2
  import Sgf._
3
3
 
4
+ /** @version created manually **/
4
5
  class SgfTest extends FunSuite with Matchers {
5
6
  test("parse \"\"") {
6
7
  Sgf.parseSgf("") should be (None)
@@ -1,5 +1,6 @@
1
1
  import org.scalatest.{Matchers, FunSuite}
2
2
 
3
+ /** @version created manually **/
3
4
  class CipherTest extends FunSuite with Matchers {
4
5
 
5
6
  test("Random key cipher - can encode/decode") {
@@ -2,7 +2,7 @@ import org.scalacheck.{Arbitrary}
2
2
  import org.scalatest.prop.GeneratorDrivenPropertyChecks
3
3
  import org.scalatest.{FlatSpec, Matchers}
4
4
 
5
-
5
+ /** @version created manually **/
6
6
  class SimpleLinkedListTest extends FlatSpec with Matchers with GeneratorDrivenPropertyChecks {
7
7
 
8
8
  private implicit def arbitrarySimpleLinkedList[T](implicit arbitraryTs: Arbitrary[Array[T]]): Arbitrary[SimpleLinkedList[T]] =
@@ -1,5 +1,6 @@
1
1
  import org.scalatest.{Matchers, FlatSpec}
2
2
 
3
+ /** @version created manually **/
3
4
  class StrainTest extends FlatSpec with Matchers {
4
5
 
5
6
  it should "handle empty keep" in {
@@ -75,4 +76,4 @@ class StrainTest extends FlatSpec with Matchers {
75
76
  val result = Strain.discard[Seq[Int]](sequences, seq => seq.contains(5))
76
77
  result should be (expected)
77
78
  }
78
- }
79
+ }
@@ -1,5 +1,5 @@
1
- import scala.util.parsing.combinator.RegexParsers
2
1
  import scala.math.pow
2
+ import scala.util.parsing.combinator.RegexParsers
3
3
 
4
4
  sealed abstract class Expression {
5
5
  def evaluate(): Integer
@@ -29,7 +29,7 @@ case class Pow(e1: Expression, e2: Expression) extends Expression {
29
29
  def evaluate(): Integer = pow(e1.evaluate().toDouble, e2.evaluate().toDouble).toInt
30
30
  }
31
31
 
32
- object WordProblem extends RegexParsers {
32
+ object Wordy extends RegexParsers {
33
33
  private lazy val prefix = "What is "
34
34
  private lazy val questionMark = "?"
35
35
  private lazy val operators = "plus" | "minus" | "multiplied by" |
@@ -53,7 +53,7 @@ object WordProblem extends RegexParsers {
53
53
 
54
54
  def parse(str: String): ParseResult[Expression] = parseAll(questionParser, str)
55
55
 
56
- def apply(question: String): Option[Int] = parse(question) match {
56
+ def answer(question: String): Option[Int] = parse(question) match {
57
57
  case Success(result: Expression, _) => Some(result.evaluate())
58
58
  case _ => None
59
59
  }
@@ -0,0 +1,84 @@
1
+ import org.scalatest.{Matchers, FunSuite}
2
+
3
+ /** @version 1.0.0 */
4
+ class WordyTest extends FunSuite with Matchers {
5
+
6
+ test("addition") {
7
+ Wordy.answer("What is 1 plus 1?") should be (Some(2))
8
+ }
9
+
10
+ test("more addition") {
11
+ pending
12
+ Wordy.answer("What is 53 plus 2?") should be (Some(55))
13
+ }
14
+
15
+ test("addition with negative numbers") {
16
+ pending
17
+ Wordy.answer("What is -1 plus -10?") should be (Some(-11))
18
+ }
19
+
20
+ test("large addition") {
21
+ pending
22
+ Wordy.answer("What is 123 plus 45678?") should be (Some(45801))
23
+ }
24
+
25
+ test("subtraction") {
26
+ pending
27
+ Wordy.answer("What is 4 minus -12?") should be (Some(16))
28
+ }
29
+
30
+ test("multiplication") {
31
+ pending
32
+ Wordy.answer("What is -3 multiplied by 25?") should be (Some(-75))
33
+ }
34
+
35
+ test("division") {
36
+ pending
37
+ Wordy.answer("What is 33 divided by -3?") should be (Some(-11))
38
+ }
39
+
40
+ test("multiple additions") {
41
+ pending
42
+ Wordy.answer("What is 1 plus 1 plus 1?") should be (Some(3))
43
+ }
44
+
45
+ test("addition and subtraction") {
46
+ pending
47
+ Wordy.answer("What is 1 plus 5 minus -2?") should be (Some(8))
48
+ }
49
+
50
+ test("multiple subtraction") {
51
+ pending
52
+ Wordy.answer("What is 20 minus 4 minus 13?") should be (Some(3))
53
+ }
54
+
55
+ test("subtraction then addition") {
56
+ pending
57
+ Wordy.answer("What is 17 minus 6 plus 3?") should be (Some(14))
58
+ }
59
+
60
+ test("multiple multiplication") {
61
+ pending
62
+ Wordy.answer("What is 2 multiplied by -2 multiplied by 3?") should be (Some(-12))
63
+ }
64
+
65
+ test("addition and multiplication") {
66
+ pending
67
+ Wordy.answer("What is -3 plus 7 multiplied by -2?") should be (Some(-8))
68
+ }
69
+
70
+ test("multiple division") {
71
+ pending
72
+ Wordy.answer("What is -12 divided by 2 divided by -3?") should be (Some(2))
73
+ }
74
+
75
+ test("unknown operation") {
76
+ pending
77
+ Wordy.answer("What is 52 cubed?") should be (None)
78
+ }
79
+
80
+ test("Non math question") {
81
+ pending
82
+ Wordy.answer("Who is the President of the United States?") should be (None)
83
+ }
84
+ }
@@ -2,6 +2,7 @@ import org.scalatest.{FunSuite, Matchers}
2
2
 
3
3
  import ZebraPuzzle._
4
4
 
5
+ /** @version created manually **/
5
6
  class ZebraPuzzleTest extends FunSuite with Matchers {
6
7
  test("solve the Zebra Puzzle") {
7
8
  ZebraPuzzle.solve should be (
@@ -1,5 +1,6 @@
1
1
  import org.scalatest.{FunSuite, Matchers}
2
2
 
3
+ /** @version created manually **/
3
4
  class ZipperTest extends FunSuite with Matchers {
4
5
  def empty[A]: Option[BinTree[A]] = None
5
6
 
@@ -0,0 +1,60 @@
1
+ import java.io.File
2
+
3
+ import testgen.TestSuiteBuilder._
4
+ import testgen._
5
+
6
+ object AllergiesTestGenerator {
7
+ def main(args: Array[String]): Unit = {
8
+ val file = new File("src/main/resources/allergies.json")
9
+
10
+ def toAlergenEnum(s: String): String =
11
+ "Allergen." + s.toLowerCase.capitalize
12
+
13
+
14
+ def toAllergicToExpected(expected: CanonicalDataParser.Expected): List[(String, Boolean)] = {
15
+ expected match {
16
+ case Right(xs: List[Map[String, Any]]) =>
17
+ xs.map(f => (toAlergenEnum(f("substance").asInstanceOf[String]),
18
+ f("result").asInstanceOf[Boolean]))
19
+ case _ => throw new IllegalStateException
20
+ }
21
+ }
22
+
23
+ def toListExpected(expected: CanonicalDataParser.Expected): String = {
24
+ expected match {
25
+ case Right(xs: List[String]) => s"List(${xs.map(toAlergenEnum).mkString(", ")})"
26
+ case _ => throw new IllegalStateException
27
+ }
28
+ }
29
+
30
+ def sutArgs(parseResult: CanonicalDataParser.ParseResult, argNames: String*): String =
31
+ argNames map (name => TestSuiteBuilder.toString(parseResult(name))) mkString ", "
32
+
33
+ def fromLabeledTest(argNames: String*): ToTestCaseDataList =
34
+ withLabeledList { sut =>
35
+ labeledTest =>
36
+ val score = labeledTest.result("score").asInstanceOf[Int]
37
+ val property = labeledTest.property
38
+ if ("allergicTo".equals(property)) {
39
+ val expected: List[(String, Boolean)] = toAllergicToExpected(labeledTest.expected)
40
+ expected.map(e => {
41
+ val sutCall =
42
+ s"""$sut.$property(${e._1}, $score)"""
43
+ val result = e._2.toString
44
+ TestCaseData(s"${e._1} - ${labeledTest.description}", sutCall, result)
45
+ })
46
+ } else {
47
+ val args = sutArgs(labeledTest.result, "score")
48
+ val expected = toListExpected(labeledTest.expected)
49
+ val sutCall =
50
+ s"""$sut.$property($args)"""
51
+ List(TestCaseData(labeledTest.description, sutCall, expected))
52
+ }
53
+ }
54
+
55
+ val code = TestSuiteBuilder.buildFromList(file, fromLabeledTest("score"))
56
+ println(s"-------------")
57
+ println(code)
58
+ println(s"-------------")
59
+ }
60
+ }
@@ -0,0 +1,52 @@
1
+ import java.io.File
2
+
3
+ import testgen.TestSuiteBuilder._
4
+ import testgen._
5
+
6
+ object ConnectTestGenerator {
7
+ def main(args: Array[String]): Unit = {
8
+ val file = new File("src/main/resources/connect.json")
9
+
10
+ def toString(expected: CanonicalDataParser.Expected): String = {
11
+ expected match {
12
+ case Right("") => "None"
13
+ case Right("X") => s"""Some(Color.Black)"""
14
+ case Right("O") => s"""Some(Color.White)"""
15
+ case _ => throw new IllegalArgumentException
16
+ }
17
+ }
18
+
19
+ def sutArgs(parseResult: CanonicalDataParser.ParseResult, argNames: String*): String =
20
+ argNames map (name => toArgString(parseResult(name))) mkString ", "
21
+
22
+ def toArgString(any: Any): String = {
23
+ any match {
24
+ case list: List[_] =>
25
+ val vals = list.map(s => TestSuiteBuilder.toString(s)).mkString(", ")
26
+ s"mkBoard(List($vals))"
27
+ case _ => any.toString
28
+ }
29
+ }
30
+
31
+ def fromLabeledTest(argNames: String*): ToTestCaseData =
32
+ withLabeledTest { sut =>
33
+ labeledTest =>
34
+ val args = sutArgs(labeledTest.result, argNames: _*)
35
+ val property = labeledTest.property
36
+ val sutCall =
37
+ s"""$sut($args).$property"""
38
+ val expected = toString(labeledTest.expected)
39
+ TestCaseData(labeledTest.description, sutCall, expected)
40
+ }
41
+
42
+ val code = TestSuiteBuilder.build(file, fromLabeledTest("board"),
43
+ Seq(),
44
+ Seq("// Filter readable board into valid input",
45
+ "private def mkBoard(lines: List[String]): List[String] =",
46
+ "lines.map(l => l.filter(!_.isSpaceChar))"))
47
+
48
+ println(s"-------------")
49
+ println(code)
50
+ println(s"-------------")
51
+ }
52
+ }
@@ -0,0 +1,71 @@
1
+ import java.io.File
2
+
3
+ import testgen.TestSuiteBuilder._
4
+ import testgen._
5
+ import play.twirl.api.Txt
6
+ import play.twirl.api.Template1
7
+
8
+ object DominoesTestGenerator {
9
+ def main(args: Array[String]): Unit = {
10
+ val file = new File("src/main/resources/dominoes.json")
11
+
12
+ def toString(expected: CanonicalDataParser.Expected): String = {
13
+ expected match {
14
+ case Left(_) => "false"
15
+ case Right(false) => "false"
16
+ case Right(true) => "true"
17
+ }
18
+ }
19
+
20
+ def sutArgs(parseResult: CanonicalDataParser.ParseResult, argNames: String*): String =
21
+ argNames map (name => toArgString(parseResult(name))) mkString ", "
22
+
23
+ def toArgString(any: Any): String = {
24
+ any match {
25
+ case xs: List[List[_]] => s"List(${xs.map(ys => s"(${ys.mkString(", ")})").mkString(", ")})"
26
+ case _ => any.toString
27
+ }
28
+ }
29
+
30
+ def fromLabeledTest(argNames: String*): ToTestCaseData =
31
+ withLabeledTest { sut =>
32
+ labeledTest =>
33
+ val args = sutArgs(labeledTest.result, argNames: _*)
34
+ val property = labeledTest.property
35
+ val expected = toString(labeledTest.expected)
36
+ val sutCall =
37
+ s"""check($args, $expected)"""
38
+ TestCaseData(labeledTest.description, sutCall, expected)
39
+ }
40
+
41
+ val template: TestSuiteTemplate =
42
+ txt.funSuiteTemplateIgnoreExpected.asInstanceOf[Template1[TestSuiteData, Txt]]
43
+
44
+ val code = TestSuiteBuilder.build(file, fromLabeledTest("input"), Seq(),
45
+ Seq("private def check(input: List[(Int, Int)], hasResult: Boolean): Unit = {",
46
+ " val result = Dominoes.chain(input)", " if (hasResult) {",
47
+ " checkChain(result getOrElse fail(\"should have had a chain, but didn't\"), input)",
48
+ " }", " else assert(result == None)", " }",
49
+ "",
50
+ " private def checkChain(result: List[(Int, Int)], input: List[(Int, Int)]): Unit = {",
51
+ " def sortDomino(ab: (Int, Int)): (Int, Int) =", " if (ab._1 > ab._2) ab.swap else ab",
52
+ " def consecutivesShouldMatch(dominoes: List[((Int, Int), Int)]): Unit =",
53
+ " dominoes.tails foreach {",
54
+ " case (a@(_,x), i1)::(b@(y,_), i2)::_ =>",
55
+ " assert(x == y, s\"dominoes $i1 and $i2 don't match: $a $b\")",
56
+ " case _ =>",
57
+ " }",
58
+ " def endsShouldMatch: Unit =",
59
+ " if (!result.isEmpty)",
60
+ " consecutivesShouldMatch(List((result.last, result.length - 1),",
61
+ " (result.head, 0)))",
62
+ "",
63
+ " assert(result.map(sortDomino).sorted == input.map(sortDomino).sorted,",
64
+ " \"doesn't consist of input dominoes\")",
65
+ " consecutivesShouldMatch(result.zipWithIndex)",
66
+ " endsShouldMatch", " }"))(template)
67
+ println(s"-------------")
68
+ println(code)
69
+ println(s"-------------")
70
+ }
71
+ }
@@ -0,0 +1,35 @@
1
+ import java.io.File
2
+
3
+ import testgen.TestSuiteBuilder._
4
+ import testgen._
5
+
6
+ object WordyTestGenerator {
7
+
8
+ def toString(expected: CanonicalDataParser.Expected): String = {
9
+ expected match {
10
+ case Right(false) => s"None"
11
+ case Right(n) => s"Some($n)"
12
+ case _ => throw new IllegalStateException()
13
+ }
14
+ }
15
+
16
+ def fromLabeledTest(argNames: String*): ToTestCaseData =
17
+ withLabeledTest { sut =>
18
+ labeledTest =>
19
+ val args = sutArgs(labeledTest.result, argNames: _*)
20
+ val property = labeledTest.property
21
+ val sutCall =
22
+ s"$sut.$property($args)"
23
+ val expected = toString(labeledTest.expected)
24
+ TestCaseData(labeledTest.description, sutCall, expected)
25
+ }
26
+
27
+ def main(args: Array[String]): Unit = {
28
+ val file = new File("src/main/resources/wordy.json")
29
+
30
+ val code = TestSuiteBuilder.build(file, fromLabeledTest("input"))
31
+ println(s"-------------")
32
+ println(code)
33
+ println(s"-------------")
34
+ }
35
+ }
@@ -10,6 +10,7 @@ object TestSuiteBuilder {
10
10
 
11
11
  type TestSuiteTemplate = Template1[TestSuiteData, Txt]
12
12
  type ToTestCaseData = String => LabeledTestItem => TestCaseData
13
+ type ToTestCaseDataList = String => LabeledTestItem => List[TestCaseData]
13
14
  type ToOptionTestCaseData = String => LabeledTestItem => Option[TestCaseData]
14
15
 
15
16
  private val DefaultTemplate: TestSuiteTemplate =
@@ -30,6 +31,22 @@ object TestSuiteBuilder {
30
31
  template.render(testSuiteData).toString
31
32
  }
32
33
 
34
+
35
+ def buildFromList(file: File, toTestCaseData: ToTestCaseDataList, imports: Seq[String] = Seq(), statements: Seq[String] = Seq())(
36
+ implicit template: TestSuiteTemplate = DefaultTemplate): String =
37
+ {
38
+ val exercise @ Exercise(name, version, cases, comments) =
39
+ CanonicalDataParser.parse(file)
40
+ val tsName = testSuiteName(name)
41
+ val testCasesAllPending = cases.flatMap(toTestCaseData(sutName(name)))
42
+ val testCases =
43
+ testCasesAllPending updated(0, testCasesAllPending.head.copy(pending = false))
44
+ val testSuiteData =
45
+ TestSuiteData(tsName, version, imports, testCases, statements)
46
+
47
+ template.render(testSuiteData).toString
48
+ }
49
+
33
50
  def buildFromOption(file: File, toTestCaseData: ToOptionTestCaseData, imports: Seq[String] = Seq())(
34
51
  implicit template: TestSuiteTemplate = DefaultTemplate): String =
35
52
  {
@@ -48,6 +65,9 @@ object TestSuiteBuilder {
48
65
  def withLabeledTest(f: String => LabeledTest => TestCaseData): ToTestCaseData =
49
66
  sut => item => f(sut)(item.asInstanceOf[LabeledTest])
50
67
 
68
+ def withLabeledList(f: String => LabeledTest => List[TestCaseData]): ToTestCaseDataList =
69
+ sut => item => f(sut)(item.asInstanceOf[LabeledTest])
70
+
51
71
  def withLabeledTestOpt(f: String => LabeledTest => Option[TestCaseData]): ToOptionTestCaseData =
52
72
  sut => item => f(sut)(item.asInstanceOf[LabeledTest])
53
73
 
@@ -0,0 +1,16 @@
1
+ @(data: testgen.TestSuiteData)@for(imp <- data.imports) {
2
+ import @imp}
3
+
4
+ import org.scalatest.{Matchers, FunSuite}
5
+ @import testgen.TestSuiteBuilder._
6
+
7
+ /** @@version @data.version */
8
+ class @data.name extends FunSuite with Matchers {
9
+ @for(statement <- data.statements) {
10
+ @statement}
11
+ @for(testCase <- data.testCases) {
12
+ test("@testCase.description") { @if(testCase.pending) {
13
+ pending}
14
+ @testCase.sutCall
15
+ }
16
+ }}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1.30
4
+ version: 2.2.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-12 00:00:00.000000000 Z
11
+ date: 2017-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -1011,6 +1011,11 @@ files:
1011
1011
  - tracks/ceylon/exercises/react/source/react/Reactor.ceylon
1012
1012
  - tracks/ceylon/exercises/react/source/react/ReactorTest.ceylon
1013
1013
  - tracks/ceylon/exercises/react/source/react/module.ceylon
1014
+ - tracks/ceylon/exercises/rna-transcription/README.md
1015
+ - tracks/ceylon/exercises/rna-transcription/example/RNA.ceylon
1016
+ - tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNA.ceylon
1017
+ - tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNAtest.ceylon
1018
+ - tracks/ceylon/exercises/rna-transcription/source/rnatranscription/module.ceylon
1014
1019
  - tracks/ceylon/exercises/sieve/README.md
1015
1020
  - tracks/ceylon/exercises/sieve/example/Sieve.ceylon
1016
1021
  - tracks/ceylon/exercises/sieve/example/module.ceylon
@@ -1097,8 +1102,8 @@ files:
1097
1102
  - tracks/clojure/exercises/change/project.clj
1098
1103
  - tracks/clojure/exercises/change/src/example.clj
1099
1104
  - tracks/clojure/exercises/change/test/change_test.clj
1105
+ - tracks/clojure/exercises/clock/.meta/clock.mustache
1100
1106
  - tracks/clojure/exercises/clock/README.md
1101
- - tracks/clojure/exercises/clock/clock.mustache
1102
1107
  - tracks/clojure/exercises/clock/project.clj
1103
1108
  - tracks/clojure/exercises/clock/src/example.clj
1104
1109
  - tracks/clojure/exercises/clock/test/clock_test.clj
@@ -1160,8 +1165,8 @@ files:
1160
1165
  - tracks/clojure/exercises/leap/project.clj
1161
1166
  - tracks/clojure/exercises/leap/src/example.clj
1162
1167
  - tracks/clojure/exercises/leap/test/leap_test.clj
1168
+ - tracks/clojure/exercises/luhn/.meta/luhn.mustache
1163
1169
  - tracks/clojure/exercises/luhn/README.md
1164
- - tracks/clojure/exercises/luhn/luhn.mustache
1165
1170
  - tracks/clojure/exercises/luhn/project.clj
1166
1171
  - tracks/clojure/exercises/luhn/src/example.clj
1167
1172
  - tracks/clojure/exercises/luhn/test/luhn_test.clj
@@ -1263,10 +1268,10 @@ files:
1263
1268
  - tracks/clojure/exercises/strain/project.clj
1264
1269
  - tracks/clojure/exercises/strain/src/example.clj
1265
1270
  - tracks/clojure/exercises/strain/test/strain_test.clj
1271
+ - tracks/clojure/exercises/sublist/.meta/sublist.mustache
1266
1272
  - tracks/clojure/exercises/sublist/README.md
1267
1273
  - tracks/clojure/exercises/sublist/project.clj
1268
1274
  - tracks/clojure/exercises/sublist/src/example.clj
1269
- - tracks/clojure/exercises/sublist/sublist.mustache
1270
1275
  - tracks/clojure/exercises/sublist/test/sublist_test.clj
1271
1276
  - tracks/clojure/exercises/sum-of-multiples/README.md
1272
1277
  - tracks/clojure/exercises/sum-of-multiples/project.clj
@@ -5298,6 +5303,7 @@ files:
5298
5303
  - tracks/go/exercises/rna-transcription/cases_test.go
5299
5304
  - tracks/go/exercises/rna-transcription/example.go
5300
5305
  - tracks/go/exercises/rna-transcription/rna_transcription_test.go
5306
+ - tracks/go/exercises/robot-name/.meta/hints.md
5301
5307
  - tracks/go/exercises/robot-name/README.md
5302
5308
  - tracks/go/exercises/robot-name/bonus_example.go
5303
5309
  - tracks/go/exercises/robot-name/bonus_test.go
@@ -9098,6 +9104,8 @@ files:
9098
9104
  - tracks/php/exercises/etl/README.md
9099
9105
  - tracks/php/exercises/etl/etl_test.php
9100
9106
  - tracks/php/exercises/etl/example.php
9107
+ - tracks/php/exercises/flatten-array/example.php
9108
+ - tracks/php/exercises/flatten-array/flatten-array_test.php
9101
9109
  - tracks/php/exercises/gigasecond/README.md
9102
9110
  - tracks/php/exercises/gigasecond/example.php
9103
9111
  - tracks/php/exercises/gigasecond/gigasecond_test.php
@@ -11134,7 +11142,6 @@ files:
11134
11142
  - tracks/scala/exercises/allergies/build.sbt
11135
11143
  - tracks/scala/exercises/allergies/example.scala
11136
11144
  - tracks/scala/exercises/allergies/src/main/scala/.keep
11137
- - tracks/scala/exercises/allergies/src/main/scala/Allergies.scala
11138
11145
  - tracks/scala/exercises/allergies/src/test/scala/AllergiesTest.scala
11139
11146
  - tracks/scala/exercises/alphametics/README.md
11140
11147
  - tracks/scala/exercises/alphametics/build.sbt
@@ -11232,7 +11239,7 @@ files:
11232
11239
  - tracks/scala/exercises/dominoes/Example.scala
11233
11240
  - tracks/scala/exercises/dominoes/README.md
11234
11241
  - tracks/scala/exercises/dominoes/build.sbt
11235
- - tracks/scala/exercises/dominoes/src/main/scala/Dominoes.scala
11242
+ - tracks/scala/exercises/dominoes/src/main/scala/.keep
11236
11243
  - tracks/scala/exercises/dominoes/src/test/scala/DominoesTest.scala
11237
11244
  - tracks/scala/exercises/etl/README.md
11238
11245
  - tracks/scala/exercises/etl/build.sbt
@@ -11552,7 +11559,7 @@ files:
11552
11559
  - tracks/scala/exercises/wordy/build.sbt
11553
11560
  - tracks/scala/exercises/wordy/example.scala
11554
11561
  - tracks/scala/exercises/wordy/src/main/scala/.keep
11555
- - tracks/scala/exercises/wordy/src/test/scala/WordProblemTest.scala
11562
+ - tracks/scala/exercises/wordy/src/test/scala/WordyTest.scala
11556
11563
  - tracks/scala/exercises/zebra-puzzle/README.md
11557
11564
  - tracks/scala/exercises/zebra-puzzle/build.sbt
11558
11565
  - tracks/scala/exercises/zebra-puzzle/example.scala
@@ -11572,6 +11579,7 @@ files:
11572
11579
  - tracks/scala/testgen/project/plugins.sbt
11573
11580
  - tracks/scala/testgen/src/main/scala/AcronymTestGenerator.scala
11574
11581
  - tracks/scala/testgen/src/main/scala/AllYourBaseTestGenerator.scala
11582
+ - tracks/scala/testgen/src/main/scala/AllergiesTestGenerator.scala
11575
11583
  - tracks/scala/testgen/src/main/scala/AlphametricsTestGenerator.scala
11576
11584
  - tracks/scala/testgen/src/main/scala/AnagramTestGenerator.scala
11577
11585
  - tracks/scala/testgen/src/main/scala/AtbashCipherTestGenerator.scala
@@ -11582,9 +11590,11 @@ files:
11582
11590
  - tracks/scala/testgen/src/main/scala/BowlingTestGenerator.scala
11583
11591
  - tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
11584
11592
  - tracks/scala/testgen/src/main/scala/ChangeTestGenerator.scala
11593
+ - tracks/scala/testgen/src/main/scala/ConnectTestGenerator.scala
11585
11594
  - tracks/scala/testgen/src/main/scala/CryptoSquareTestGenerator.scala
11586
11595
  - tracks/scala/testgen/src/main/scala/CustomSetTestGenerator.scala
11587
11596
  - tracks/scala/testgen/src/main/scala/DifferenceOfSquaresTestGenerator.scala
11597
+ - tracks/scala/testgen/src/main/scala/DominoesTestGenerator.scala
11588
11598
  - tracks/scala/testgen/src/main/scala/EtlTestGenerator.scala
11589
11599
  - tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
11590
11600
  - tracks/scala/testgen/src/main/scala/GigasecondTestGenerator.scala
@@ -11622,9 +11632,11 @@ files:
11622
11632
  - tracks/scala/testgen/src/main/scala/TestBuilder.scala
11623
11633
  - tracks/scala/testgen/src/main/scala/TriangleTestGenerator.scala
11624
11634
  - tracks/scala/testgen/src/main/scala/VariableLengthQuantityTestGenerator.scala
11635
+ - tracks/scala/testgen/src/main/scala/WordyTestGenerator.scala
11625
11636
  - tracks/scala/testgen/src/main/scala/testgen/CanonicalDataParser.scala
11626
11637
  - tracks/scala/testgen/src/main/scala/testgen/TestSuiteBuilder.scala
11627
11638
  - tracks/scala/testgen/src/main/twirl/funSuiteTemplate.scala.txt
11639
+ - tracks/scala/testgen/src/main/twirl/funSuiteTemplateIgnoreExpected.scala.txt
11628
11640
  - tracks/scheme/.git
11629
11641
  - tracks/scheme/.gitignore
11630
11642
  - tracks/scheme/.travis.yml
@@ -1,11 +0,0 @@
1
- import Allergen.Allergen
2
-
3
- object Allergies {
4
- def isAllergicTo(allergen: Allergen, score: Int): Boolean = ???
5
-
6
- def allergies(score: Int): List[Allergen] = ???
7
- }
8
-
9
- object Allergen extends Enumeration {
10
- type Allergen = ???
11
- }
@@ -1,4 +0,0 @@
1
- object Dominoes {
2
-
3
- def chain(dominoes: List[(Int, Int)]): Option[List[(Int, Int)]] = ???
4
- }