trackler 2.1.0.41 → 2.1.0.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/fixtures/tracks/fake/docs/STRAY.md +1 -0
  3. data/lib/trackler/doc_file.rb +88 -0
  4. data/lib/trackler/track.rb +6 -40
  5. data/lib/trackler/version.rb +1 -1
  6. data/tracks/bash/README.md +2 -2
  7. data/tracks/bash/config.json +1 -1
  8. data/tracks/c/README.md +1 -1
  9. data/tracks/c/config.json +1 -1
  10. data/tracks/ceylon/README.md +4 -4
  11. data/tracks/ceylon/config.json +1 -1
  12. data/tracks/clojure/README.org +3 -3
  13. data/tracks/clojure/config.json +1 -1
  14. data/tracks/cpp/README.md +2 -2
  15. data/tracks/cpp/config.json +1 -1
  16. data/tracks/cpp/docs/INSTALLATION.md +2 -2
  17. data/tracks/crystal/config.json +1 -1
  18. data/tracks/csharp/config.json +1 -1
  19. data/tracks/delphi/README.md +2 -2
  20. data/tracks/delphi/config.json +1 -1
  21. data/tracks/delphi/exercises/bowling/uBowlingTests.pas +14 -14
  22. data/tracks/ecmascript/config.json +1 -1
  23. data/tracks/elisp/README.org +4 -4
  24. data/tracks/elisp/config.json +1 -1
  25. data/tracks/elixir/README.md +3 -3
  26. data/tracks/elixir/config.json +1 -1
  27. data/tracks/erlang/README.md +2 -2
  28. data/tracks/erlang/config.json +2 -2
  29. data/tracks/factor/README.md +9 -9
  30. data/tracks/factor/config.json +1 -1
  31. data/tracks/fsharp/config.json +1 -1
  32. data/tracks/go/README.md +16 -16
  33. data/tracks/go/config.json +1 -1
  34. data/tracks/go/exercises/gigasecond/gigasecond_test.go +2 -2
  35. data/tracks/go/gen/gen.go +2 -2
  36. data/tracks/haskell/.gitignore +1 -1
  37. data/tracks/haskell/README.md +12 -8
  38. data/tracks/haskell/config.json +1 -1
  39. data/tracks/haskell/docs/EXERCISE_README_INSERT.md +1 -1
  40. data/tracks/idris/README.md +1 -1
  41. data/tracks/idris/config.json +1 -1
  42. data/tracks/java/POLICIES.md +7 -7
  43. data/tracks/java/README.md +7 -7
  44. data/tracks/java/bin/journey-test.sh +1 -1
  45. data/tracks/java/config.json +1 -1
  46. data/tracks/java/docs/MAINTAINING.md +3 -20
  47. data/tracks/java/docs/TESTS.md +3 -3
  48. data/tracks/java/exercises/all-your-base/src/test/java/BaseConverterTest.java +23 -20
  49. data/tracks/java/exercises/hello-world/GETTING_STARTED.md +1 -1
  50. data/tracks/java/exercises/hello-world/TUTORIAL.md +2 -2
  51. data/tracks/javascript/config.json +1 -1
  52. data/tracks/julia/.travis.yml +0 -2
  53. data/tracks/julia/config.json +9 -0
  54. data/tracks/julia/exercises/custom-set/example.jl +1 -1
  55. data/tracks/julia/exercises/luhn/example.jl +1 -1
  56. data/tracks/julia/exercises/robot-name/HINTS.md +17 -0
  57. data/tracks/julia/exercises/robot-name/example.jl +14 -0
  58. data/tracks/julia/exercises/robot-name/robot-name.jl +8 -0
  59. data/tracks/julia/exercises/robot-name/runtests.jl +69 -0
  60. data/tracks/kotlin/README.md +7 -7
  61. data/tracks/kotlin/config.json +1 -1
  62. data/tracks/kotlin/docs/TESTS.md +3 -3
  63. data/tracks/kotlin/exercises/hello-world/GETTING_STARTED.md +1 -1
  64. data/tracks/kotlin/exercises/hello-world/TUTORIAL.md +1 -1
  65. data/tracks/lfe/README.md +2 -2
  66. data/tracks/lfe/config.json +1 -1
  67. data/tracks/lisp/README.md +1 -1
  68. data/tracks/lisp/config.json +2 -2
  69. data/tracks/lua/README.md +9 -9
  70. data/tracks/lua/config.json +1 -1
  71. data/tracks/lua/exercises/hamming/hamming_spec.lua +15 -7
  72. data/tracks/lua/exercises/raindrops/raindrops_spec.lua +46 -14
  73. data/tracks/mips/config.json +1 -1
  74. data/tracks/objective-c/Dangerfile +1 -1
  75. data/tracks/objective-c/README.md +1 -1
  76. data/tracks/objective-c/config.json +1 -1
  77. data/tracks/ocaml/README.md +2 -2
  78. data/tracks/ocaml/config.json +1 -1
  79. data/tracks/ocaml/docs/EXERCISE_README_INSERT.md +1 -1
  80. data/tracks/ocaml/tools/test-generator/README.md +2 -2
  81. data/tracks/perl5/README.md +1 -1
  82. data/tracks/perl5/config.json +1 -1
  83. data/tracks/perl6/README.md +2 -2
  84. data/tracks/perl6/config.json +1 -1
  85. data/tracks/perl6/exercises/all-your-base/all-your-base.t +43 -32
  86. data/tracks/perl6/exercises/all-your-base/example.yaml +19 -9
  87. data/tracks/php/config.json +1 -1
  88. data/tracks/pony/README.md +2 -2
  89. data/tracks/pony/config.json +1 -1
  90. data/tracks/powershell/README.md +1 -1
  91. data/tracks/powershell/config.json +1 -1
  92. data/tracks/purescript/README.md +5 -5
  93. data/tracks/purescript/config.json +1 -1
  94. data/tracks/r/README.md +3 -3
  95. data/tracks/r/config.json +1 -1
  96. data/tracks/racket/README.md +2 -2
  97. data/tracks/racket/config.json +1 -1
  98. data/tracks/ruby/README.md +9 -9
  99. data/tracks/ruby/config.json +1 -1
  100. data/tracks/rust/config.json +1 -1
  101. data/tracks/rust/exercises/gigasecond/src/lib.rs +7 -0
  102. data/tracks/rust/exercises/protein-translation/example.rs +11 -22
  103. data/tracks/rust/exercises/protein-translation/tests/proteins.rs +56 -36
  104. data/tracks/scala/config.json +1 -1
  105. data/tracks/scala/exercises/all-your-base/src/test/scala/AllYourBaseTest.scala +46 -64
  106. data/tracks/scala/exercises/rna-transcription/example.scala +1 -3
  107. data/tracks/scala/exercises/rna-transcription/src/test/scala/RnaTranscriptionTest.scala +19 -23
  108. data/tracks/scala/exercises/scrabble-score/example.scala +2 -2
  109. data/tracks/scala/exercises/scrabble-score/src/test/scala/ScrabbleScoreTest.scala +37 -16
  110. data/tracks/scala/testgen/src/main/scala/AllYourBaseTestGenerator.scala +32 -42
  111. data/tracks/scala/testgen/src/main/scala/RnaTranscriptionTestGenerator.scala +34 -0
  112. data/tracks/scala/testgen/src/main/scala/ScrabbleScoreTestGenerator.scala +15 -0
  113. data/tracks/sml/README.md +1 -3
  114. data/tracks/sml/config.json +1 -1
  115. data/tracks/sml/docs/EXERCISE_README_INSERT.md +1 -1
  116. data/tracks/swift/config.json +1 -1
  117. data/tracks/typescript/README.md +1 -1
  118. data/tracks/typescript/config.json +1 -1
  119. data/tracks/vimscript/README.md +5 -5
  120. data/tracks/vimscript/config.json +8 -1
  121. data/tracks/vimscript/exercises/largest-series-product/example.vim +31 -0
  122. data/tracks/vimscript/exercises/largest-series-product/largest_series_product.vader +95 -0
  123. data/tracks/vimscript/exercises/largest-series-product/largest_series_product.vim +17 -0
  124. metadata +13 -2
@@ -1,128 +1,110 @@
1
- import org.scalatest.{FunSuite, Matchers}
2
1
 
2
+ import org.scalatest.{Matchers, FunSuite}
3
+
4
+ /** @version 1.1.0 */
3
5
  class AllYourBaseTest extends FunSuite with Matchers {
4
- test("single bit one to decimal") {
5
- AllYourBase.rebase(2, List(1),
6
- 10) should be (Some(List(1)))
6
+
7
+ test("single bit one to decimal") {
8
+ AllYourBase.rebase(2, List(1), 10) should be (Some(List(1)))
7
9
  }
8
10
 
9
- test("binary to single decimal") {
11
+ test("binary to single decimal") {
10
12
  pending
11
- AllYourBase.rebase(2, List(1, 0, 1),
12
- 10) should be (Some(List(5)))
13
+ AllYourBase.rebase(2, List(1, 0, 1), 10) should be (Some(List(5)))
13
14
  }
14
15
 
15
- test("single decimal to binary") {
16
+ test("single decimal to binary") {
16
17
  pending
17
- AllYourBase.rebase(10, List(5),
18
- 2) should be (Some(List(1 ,0 ,1)))
18
+ AllYourBase.rebase(10, List(5), 2) should be (Some(List(1, 0, 1)))
19
19
  }
20
20
 
21
- test("binary to multiple decimal") {
21
+ test("binary to multiple decimal") {
22
22
  pending
23
- AllYourBase.rebase(2, List(1, 0, 1, 0, 1, 0),
24
- 10) should be (Some(List(4 ,2)))
23
+ AllYourBase.rebase(2, List(1, 0, 1, 0, 1, 0), 10) should be (Some(List(4, 2)))
25
24
  }
26
25
 
27
- test("decimal to binary") {
26
+ test("decimal to binary") {
28
27
  pending
29
- AllYourBase.rebase(10, List(4, 2),
30
- 2) should be (Some(List(1 ,0 ,1 ,0 ,1 ,0)))
28
+ AllYourBase.rebase(10, List(4, 2), 2) should be (Some(List(1, 0, 1, 0, 1, 0)))
31
29
  }
32
30
 
33
- test("trinary to hexadecimal") {
31
+ test("trinary to hexadecimal") {
34
32
  pending
35
- AllYourBase.rebase(3, List(1, 1, 2, 0),
36
- 16) should be (Some(List(2 ,10)))
33
+ AllYourBase.rebase(3, List(1, 1, 2, 0), 16) should be (Some(List(2, 10)))
37
34
  }
38
35
 
39
- test("hexadecimal to trinary") {
36
+ test("hexadecimal to trinary") {
40
37
  pending
41
- AllYourBase.rebase(16, List(2, 10),
42
- 3) should be (Some(List(1 ,1 ,2 ,0)))
38
+ AllYourBase.rebase(16, List(2, 10), 3) should be (Some(List(1, 1, 2, 0)))
43
39
  }
44
40
 
45
- test("15-bit integer") {
41
+ test("15-bit integer") {
46
42
  pending
47
- AllYourBase.rebase(97, List(3, 46, 60),
48
- 73) should be (Some(List(6 ,10 ,45)))
43
+ AllYourBase.rebase(97, List(3, 46, 60), 73) should be (Some(List(6, 10, 45)))
49
44
  }
50
45
 
51
- test("empty list") {
46
+ test("empty list") {
52
47
  pending
53
- AllYourBase.rebase(2, List(),
54
- 10) should be (Some(List()))
48
+ AllYourBase.rebase(2, List(), 10) should be (None)
55
49
  }
56
50
 
57
- test("single zero") {
51
+ test("single zero") {
58
52
  pending
59
- AllYourBase.rebase(10, List(0),
60
- 2) should be (Some(List()))
53
+ AllYourBase.rebase(10, List(0), 2) should be (None)
61
54
  }
62
55
 
63
- test("multiple zeros") {
56
+ test("multiple zeros") {
64
57
  pending
65
- AllYourBase.rebase(10, List(0, 0, 0),
66
- 2) should be (Some(List()))
58
+ AllYourBase.rebase(10, List(0, 0, 0), 2) should be (None)
67
59
  }
68
60
 
69
- test("leading zeros") {
61
+ test("leading zeros") {
70
62
  pending
71
- AllYourBase.rebase(7, List(0, 6, 0),
72
- 10) should be (Some(List(4, 2)))
63
+ AllYourBase.rebase(7, List(0, 6, 0), 10) should be (None)
73
64
  }
74
65
 
75
- test("negative digit") {
66
+ test("first base is one") {
76
67
  pending
77
- AllYourBase.rebase(2, List(1, -1, 1, 0, 1, 0),
78
- 10) should be (None)
68
+ AllYourBase.rebase(1, List(), 10) should be (None)
79
69
  }
80
70
 
81
- test("invalid positive digit") {
71
+ test("first base is zero") {
82
72
  pending
83
- AllYourBase.rebase(2, List(1, 2, 1, 0, 1, 0),
84
- 10) should be (None)
73
+ AllYourBase.rebase(0, List(), 10) should be (None)
85
74
  }
86
75
 
87
- test("first base is one") {
76
+ test("first base is negative") {
88
77
  pending
89
- AllYourBase.rebase(1, List(),
90
- 10) should be (None)
78
+ AllYourBase.rebase(-2, List(1), 10) should be (None)
91
79
  }
92
80
 
93
- test("second base is one") {
81
+ test("negative digit") {
94
82
  pending
95
- AllYourBase.rebase(2, List(1, 0, 1, 0, 1, 0),
96
- 1) should be (None)
83
+ AllYourBase.rebase(2, List(1, -1, 1, 0, 1, 0), 10) should be (None)
97
84
  }
98
85
 
99
- test("first base is zero") {
86
+ test("invalid positive digit") {
100
87
  pending
101
- AllYourBase.rebase(0, List(),
102
- 10) should be (None)
88
+ AllYourBase.rebase(2, List(1, 2, 1, 0, 1, 0), 10) should be (None)
103
89
  }
104
90
 
105
- test("second base is zero") {
91
+ test("second base is one") {
106
92
  pending
107
- AllYourBase.rebase(10, List(7),
108
- 0) should be (None)
93
+ AllYourBase.rebase(2, List(1, 0, 1, 0, 1, 0), 1) should be (None)
109
94
  }
110
95
 
111
- test("first base is negative") {
96
+ test("second base is zero") {
112
97
  pending
113
- AllYourBase.rebase(-2, List(1),
114
- 10) should be (None)
98
+ AllYourBase.rebase(10, List(7), 0) should be (None)
115
99
  }
116
100
 
117
- test("second base is negative") {
101
+ test("second base is negative") {
118
102
  pending
119
- AllYourBase.rebase(2, List(1),
120
- -7) should be (None)
103
+ AllYourBase.rebase(2, List(1), -7) should be (None)
121
104
  }
122
105
 
123
- test("both bases are negative") {
106
+ test("both bases are negative") {
124
107
  pending
125
- AllYourBase.rebase(-2, List(1),
126
- -7) should be (None)
108
+ AllYourBase.rebase(-2, List(1), -7) should be (None)
127
109
  }
128
110
  }
@@ -1,6 +1,4 @@
1
- import Dna._
2
-
3
- object Dna {
1
+ object RnaTranscription {
4
2
  private type Strand = String
5
3
  private type Nucleotide = Char
6
4
 
@@ -1,48 +1,44 @@
1
1
  import org.scalatest.{Matchers, FunSuite}
2
2
 
3
- class DnaTest extends FunSuite with Matchers {
4
- test("transcribes blank string") {
5
- Dna.toRna("") should be (Some(""))
6
- }
3
+ /** @version 1.0.0 */
4
+ class RnaTranscriptionTest extends FunSuite with Matchers {
7
5
 
8
- test("transcribes cytidine to guanine") {
9
- pending
10
- Dna.toRna("C") should be (Some("G"))
6
+ test("rna complement of cytosine is guanine") {
7
+ RnaTranscription.toRna("C") should be (Some("G"))
11
8
  }
12
9
 
13
- test("transcribes guanosine to cytosine") {
10
+ test("rna complement of guanine is cytosine") {
14
11
  pending
15
- Dna.toRna("G") should be (Some("C"))
12
+ RnaTranscription.toRna("G") should be (Some("C"))
16
13
  }
17
14
 
18
- test("transcribes adenosine to uracil") {
15
+ test("rna complement of thymine is adenine") {
19
16
  pending
20
- Dna.toRna("A") should be (Some("U"))
17
+ RnaTranscription.toRna("T") should be (Some("A"))
21
18
  }
22
19
 
23
- test("transcribes thymidine to adenine") {
20
+ test("rna complement of adenine is uracil") {
24
21
  pending
25
- Dna.toRna("T") should be (Some("A"))
22
+ RnaTranscription.toRna("A") should be (Some("U"))
26
23
  }
27
24
 
28
- test("transcribes all ACGT to UGCA") {
25
+ test("rna complement") {
29
26
  pending
30
- Dna.toRna("ACGTGGTCTTAA") should be (Some("UGCACCAGAAUU"))
27
+ RnaTranscription.toRna("ACGTGGTCTTAA") should be (Some("UGCACCAGAAUU"))
31
28
  }
32
29
 
33
- test("transcribes RNA only nucleotide uracil to None") {
30
+ test("dna correctly handles invalid input") {
34
31
  pending
35
- Dna.toRna("U") should be (None)
32
+ RnaTranscription.toRna("U") should be (None)
36
33
  }
37
34
 
38
- test("transcribes completely invalid DNA to None") {
35
+ test("dna correctly handles completely invalid input") {
39
36
  pending
40
- Dna.toRna("XXX") should be (None)
37
+ RnaTranscription.toRna("XXX") should be (None)
41
38
  }
42
39
 
43
- test("transcribes partially invalid DNA to None") {
40
+ test("dna correctly handles partially invalid input") {
44
41
  pending
45
- Dna.toRna("ACGTXXXCTTAA") should be (None)
42
+ RnaTranscription.toRna("ACGTXXXCTTAA") should be (None)
46
43
  }
47
- }
48
-
44
+ }
@@ -1,6 +1,6 @@
1
- object Scrabble {
1
+ object ScrabbleScore {
2
2
 
3
- def scoreWord(word: String): Int = word.foldLeft(0)((score, c) => score + scoreLetter(c))
3
+ def score(word: String): Int = word.foldLeft(0)((score, c) => score + scoreLetter(c))
4
4
 
5
5
  def scoreLetter(c: Char): Int = letterScores.getOrElse(c.toUpper, 0)
6
6
 
@@ -1,38 +1,59 @@
1
1
  import org.scalatest.{Matchers, FunSuite}
2
2
 
3
- class scrabble_score_test extends FunSuite with Matchers {
4
- test("score letter lowercase") {
5
- Scrabble.scoreLetter('a') should be (1)
3
+ /** @version 1.0.0 */
4
+ class ScrabbleScoreTest extends FunSuite with Matchers {
5
+
6
+ test("lowercase letter") {
7
+ ScrabbleScore.score("a") should be (1)
8
+ }
9
+
10
+ test("uppercase letter") {
11
+ pending
12
+ ScrabbleScore.score("A") should be (1)
13
+ }
14
+
15
+ test("valuable letter") {
16
+ pending
17
+ ScrabbleScore.score("f") should be (4)
18
+ }
19
+
20
+ test("short word") {
21
+ pending
22
+ ScrabbleScore.score("at") should be (2)
6
23
  }
7
24
 
8
- test("score letter uppercase") {
25
+ test("short, valuable word") {
9
26
  pending
10
- Scrabble.scoreLetter('A') should be (1)
27
+ ScrabbleScore.score("zoo") should be (12)
11
28
  }
12
29
 
13
- test("score word") {
30
+ test("medium word") {
14
31
  pending
15
- Scrabble.scoreWord("at") should be (2)
32
+ ScrabbleScore.score("street") should be (6)
16
33
  }
17
34
 
18
- test("score word with dupe letters") {
35
+ test("medium, valuable word") {
19
36
  pending
20
- Scrabble.scoreWord("street") should be (6)
37
+ ScrabbleScore.score("quirky") should be (22)
21
38
  }
22
39
 
23
- test("score quirky word") {
40
+ test("long, mixed-case word") {
24
41
  pending
25
- Scrabble.scoreWord("quirky") should be (22)
42
+ ScrabbleScore.score("OxyphenButazone") should be (41)
26
43
  }
27
44
 
28
- test("score capitalized word") {
45
+ test("english-like word") {
29
46
  pending
30
- Scrabble.scoreWord("OXYPHENBUTAZONE") should be (41)
47
+ ScrabbleScore.score("pinata") should be (8)
31
48
  }
32
49
 
33
- test("score mixed case word") {
50
+ test("empty input") {
34
51
  pending
35
- Scrabble.scoreWord("Oxyphenbutazone") should be (41)
52
+ ScrabbleScore.score("") should be (0)
36
53
  }
37
- }
38
54
 
55
+ test("entire alphabet available") {
56
+ pending
57
+ ScrabbleScore.score("abcdefghijklmnopqrstuvwxyz") should be (87)
58
+ }
59
+ }
@@ -1,48 +1,38 @@
1
- import play.api.libs.json.Json
1
+ import java.io.File
2
2
 
3
- import scala.io.Source
4
-
5
-
6
- class AllYourBaseTestGenerator {
7
- implicit val testCaseReader = Json.reads[AllYourBaseTestCase]
8
-
9
- private val filename = "all-your-base.json"
10
- private val fileContents = Source.fromFile(filename).getLines.mkString
11
- private val json = Json.parse(fileContents)
12
-
13
- def write {
14
- val testCases: List[AllYourBaseTestCase] = (json \ "cases").get.as[List[AllYourBaseTestCase]]
15
-
16
- implicit def testCaseToGen(tc: AllYourBaseTestCase): TestCaseGen = {
17
- val callSUT =
18
- s"AllYourBase.rebase(${tc.input_base}, ${toListString(tc.input_digits)}, ${tc.output_base})"
19
- val expected = toListString(tc.output_digits)
20
-
21
- TestCaseGen(tc.description, callSUT, expected)
22
- }
23
-
24
- val testBuilder = new TestBuilder("AllYourBaseTest")
25
- testBuilder.addTestCases(testCases)
26
- testBuilder.toFile
27
- }
28
-
29
- private def toListString(a: Array[Int]): String =
30
- "List(" + a.mkString(", ") + ")"
31
-
32
- private def toListString(o: Option[Array[Int]]): String = {
33
- o match {
34
- case Some(a) => "Some(List(" + a.mkString(" ,") + "))"
35
- case None => "None"
36
- }
37
- }
38
- }
39
-
40
- case class AllYourBaseTestCase(description: String,
41
- input_base: Int, input_digits: Array[Int],
42
- output_base: Int, output_digits: Option[Array[Int]])
3
+ import testgen.TestSuiteBuilder.{toString, _}
4
+ import testgen._
43
5
 
44
6
  object AllYourBaseTestGenerator {
45
7
  def main(args: Array[String]): Unit = {
46
- new AllYourBaseTestGenerator().write
8
+ val file = new File("src/main/resources/all-your-base.json")
9
+
10
+ def toString(expected: CanonicalDataParser.Expected): String = {
11
+ expected match {
12
+ case Left(_) => "None"
13
+ case Right(null) => "None"
14
+ case Right(n) => s"Some($n)"
15
+ }
16
+ }
17
+
18
+ def fromLabeledTest(argNames: String*): ToTestCaseData =
19
+ withLabeledTest { sut =>
20
+ labeledTest =>
21
+ val args = sutArgs(labeledTest.result, argNames: _*)
22
+ val property = labeledTest.property
23
+ val sutCall =
24
+ s"""AllYourBase.$property($args)"""
25
+ val expected = toString(labeledTest.expected)
26
+ TestCaseData(labeledTest.description, sutCall, expected)
27
+ }
28
+
29
+ val code =
30
+ TestSuiteBuilder.build(file,
31
+ fromLabeledTest("input_base", "input_digits", "output_base"))
32
+ println(s"-------------")
33
+ println(code)
34
+ println(s"-------------")
35
+
36
+ TestSuiteBuilder.writeToFile(code, new File("AllYourBaseTest.scala"))
47
37
  }
48
38
  }
@@ -0,0 +1,34 @@
1
+ import java.io.File
2
+
3
+ import testgen.TestSuiteBuilder._
4
+ import testgen._
5
+
6
+ object RnaTranscriptionTestGenerator {
7
+ def main(args: Array[String]): Unit = {
8
+ val file = new File("src/main/resources/rna-transcription.json")
9
+
10
+ def toString(expected: CanonicalDataParser.Expected): String = {
11
+ expected match {
12
+ case Left(_) => "None"
13
+ case Right(null) => "None"
14
+ case Right(n) => s"""Some(\"$n\")"""
15
+ }
16
+ }
17
+
18
+ def fromLabeledTest(argNames: String*): ToTestCaseData =
19
+ withLabeledTest { sut =>
20
+ labeledTest =>
21
+ val args = sutArgs(labeledTest.result, argNames: _*)
22
+ val property = labeledTest.property
23
+ val sutCall =
24
+ s"""RnaTranscription.$property($args)"""
25
+ val expected = toString(labeledTest.expected)
26
+ TestCaseData(labeledTest.description, sutCall, expected)
27
+ }
28
+
29
+ val code = TestSuiteBuilder.build(file, fromLabeledTest("dna"))
30
+ println(s"-------------")
31
+ println(code)
32
+ println(s"-------------")
33
+ }
34
+ }
@@ -0,0 +1,15 @@
1
+ import java.io.File
2
+
3
+ import testgen.TestSuiteBuilder
4
+ import testgen.TestSuiteBuilder.fromLabeledTest
5
+
6
+ object ScrabbleScoreTestGenerator {
7
+ def main(args: Array[String]): Unit = {
8
+ val file = new File("src/main/resources/scrabble-score.json")
9
+
10
+ val code = TestSuiteBuilder.build(file, fromLabeledTest("input"))
11
+ println(s"-------------")
12
+ println(code)
13
+ println(s"-------------")
14
+ }
15
+ }
data/tracks/sml/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # xSML
1
+ # Exercism Standard ML Track
2
2
 
3
3
  Exercism problems in the Standard ML programming language
4
4
 
@@ -9,5 +9,3 @@ Please see SETUP.md for instructions on how to get started solving the SML exerc
9
9
  ## Contributing Guide
10
10
 
11
11
  Please see the [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data)
12
-
13
-
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "slug": "sml",
3
3
  "language": "Standard ML",
4
- "repository": "https://github.com/exercism/xsml",
4
+ "repository": "https://github.com/exercism/sml",
5
5
  "checklist_issue": 8,
6
6
  "active": false,
7
7
  "test_pattern": "^test_*.sml$",
@@ -13,7 +13,7 @@ You will need an SML interpreter to solve these problems. There are several popu
13
13
 
14
14
  #### Example:
15
15
 
16
- cd ~/exercism/xsml/accumulate
16
+ cd ~/exercism/sml/accumulate
17
17
  poly
18
18
  Poly/ML 5.2 Release
19
19
  > use "test_accumulate.sml";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "slug": "swift",
3
3
  "language": "Swift",
4
- "repository": "https://github.com/exercism/xswift",
4
+ "repository": "https://github.com/exercism/swift",
5
5
  "active": true,
6
6
  "exercises": [
7
7
  {
@@ -1,4 +1,4 @@
1
- # xTypeScript [![Build Status](https://travis-ci.org/exercism/xtypescript.svg?branch=master)](https://travis-ci.org/exercism/xtypescript)
1
+ # TypeScript [![Build Status](https://travis-ci.org/exercism/typescript.svg?branch=master)](https://travis-ci.org/exercism/typescript)
2
2
 
3
3
  Exercism exercises in TypeScript
4
4
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "slug": "typescript",
3
3
  "language": "TypeScript",
4
- "repository": "https://github.com/exercism/xtypescript",
4
+ "repository": "https://github.com/exercism/typescript",
5
5
  "active": true,
6
6
  "test_pattern": ".*[.]test[.]ts$",
7
7
  "exercises": [
@@ -1,6 +1,6 @@
1
- # xVimscript
1
+ # Exercism Vim script Track
2
2
 
3
- ![build status](https://travis-ci.org/exercism/xvimscript.svg?branch=master)
3
+ ![build status](https://travis-ci.org/exercism/vimscript.svg?branch=master)
4
4
  [![Join the chat at https://gitter.im/exercism/xvimscript](https://badges.gitter.im/exercism/xvimscript.svg)](https://gitter.im/exercism/xvimscript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
5
 
6
6
  Exercism exercises in Vim script.
@@ -10,12 +10,12 @@ Exercism exercises in Vim script.
10
10
  We welcome any kind of contribution!
11
11
 
12
12
  If you have a suggestion or question, create a new
13
- [issue](https://github.com/exercism/xvimscript/issues).
13
+ [issue](https://github.com/exercism/vimscript/issues).
14
14
 
15
15
  For code or fixing typos and similar things, open a
16
- [pull request](https://github.com/exercism/xvimscript/pulls).
16
+ [pull request](https://github.com/exercism/vimscript/pulls).
17
17
 
18
- Look at recent [commits](https://github.com/exercism/xvimscript/commits/master)
18
+ Look at recent [commits](https://github.com/exercism/vimscript/commits/master)
19
19
  to get a feeling on how to format your own ones.
20
20
 
21
21
  Even if there are any uncertainties, go for it nevertheless. We can straighten
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "slug": "vimscript",
3
3
  "language": "Vim script",
4
- "repository": "https://github.com/exercism/xvimscript",
4
+ "repository": "https://github.com/exercism/vimscript",
5
5
  "active": true,
6
6
  "test_pattern": "\\.vader$",
7
7
  "exercises": [
@@ -129,6 +129,13 @@
129
129
  "difficulty": 1,
130
130
  "topics": [
131
131
 
132
+ ]
133
+ },
134
+ {
135
+ "slug": "largest-series-product",
136
+ "difficulty": 1,
137
+ "topics": [
138
+
132
139
  ]
133
140
  }
134
141
  ],
@@ -0,0 +1,31 @@
1
+ function! LargestProduct(digits, span) abort
2
+ if a:span == 0
3
+ return 1
4
+ elseif a:span < 0 || empty(a:digits)
5
+ return -1
6
+ endif
7
+
8
+ let max = -1
9
+
10
+ for i in range(len(a:digits) - a:span + 1)
11
+ let tmp = s:product(a:digits[i : i + a:span - 1])
12
+ if tmp > max
13
+ let max = tmp
14
+ endif
15
+ endfor
16
+
17
+ return max
18
+ endfunction
19
+
20
+ function! s:product(digits) abort
21
+ let prod = a:digits[0]
22
+
23
+ for digit in split(a:digits[1:], '\zs')
24
+ if digit !~? '\d'
25
+ throw 'invalid input'
26
+ endif
27
+ let prod = prod * digit
28
+ endfor
29
+
30
+ return prod
31
+ endfunction