trackler 2.2.1.19 → 2.2.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/bash/config.json +11 -0
- data/tracks/bash/docs/ABOUT.md +5 -0
- data/tracks/bash/exercises/word-count/README.md +24 -0
- data/tracks/bash/exercises/word-count/example.awk +12 -0
- data/tracks/bash/exercises/word-count/example.sh +21 -0
- data/tracks/bash/exercises/word-count/word_count_test.sh +84 -0
- data/tracks/coffeescript/config/maintainers.json +5 -11
- data/tracks/csharp/.travis.yml +3 -0
- data/tracks/delphi/config/maintainers.json +1 -1
- data/tracks/ecmascript/config.json +108 -108
- data/tracks/elixir/exercises/phone-number/phone_number_test.exs +21 -1
- data/tracks/factor/docs/SNIPPET.txt +5 -0
- data/tracks/idris/docs/TESTS.md +7 -0
- data/tracks/java/config.json +47 -47
- data/tracks/javascript/config.json +103 -103
- data/tracks/julia/config.json +121 -121
- data/tracks/julia/docs/RESOURCES.md +1 -1
- data/tracks/julia/docs/SNIPPET.txt +8 -0
- data/tracks/objective-c/config.json +2 -3
- data/tracks/objective-c/exercises/rna-transcription/RNATranscriptionExample.m +11 -32
- data/tracks/ocaml/.travis-ci.sh +1 -1
- data/tracks/ocaml/.travis.yml +1 -1
- data/tracks/ocaml/README.md +1 -1
- data/tracks/ocaml/exercises/change/test.ml +24 -21
- data/tracks/ocaml/tools/test-generator/src/codegen.ml +3 -7
- data/tracks/ocaml/tools/test-generator/src/controller.ml +4 -5
- data/tracks/ocaml/tools/test-generator/src/languages.ml +4 -3
- data/tracks/ocaml/tools/test-generator/src/model.ml +1 -2
- data/tracks/ocaml/tools/test-generator/src/ocaml_special_cases.ml +19 -18
- data/tracks/ocaml/tools/test-generator/src/parser.ml +12 -17
- data/tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml +11 -3
- data/tracks/ocaml/tools/test-generator/test/codegen_test.ml +2 -3
- data/tracks/ocaml/tools/test-generator/test/ocaml_special_cases_test.ml +12 -4
- data/tracks/ocaml/tools/test-generator/test/parser_test.ml +10 -10
- data/tracks/purescript/exercises/bob/test/Main.purs +5 -5
- data/tracks/ruby/bin/generate +1 -1
- data/tracks/ruby/docs/24pullrequests.md +1 -1
- data/tracks/ruby/exercises/all-your-base/all_your_base_test.rb +24 -24
- data/tracks/ruby/exercises/alphametics/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/bowling/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/bowling/bowling_test.rb +10 -10
- data/tracks/ruby/exercises/change/.meta/.version +1 -1
- data/tracks/ruby/exercises/change/.meta/solutions/change.rb +1 -1
- data/tracks/ruby/exercises/change/change_test.rb +7 -2
- data/tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb +1 -1
- data/tracks/ruby/exercises/connect/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/dominoes/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/hamming/.meta/generator/hamming_case.rb +5 -1
- data/tracks/ruby/exercises/hamming/hamming_test.rb +7 -7
- data/tracks/ruby/exercises/leap/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/exercises/pangram/.meta/.version +1 -1
- data/tracks/ruby/exercises/pangram/.meta/solutions/pangram.rb +1 -1
- data/tracks/ruby/exercises/pangram/pangram_test.rb +3 -3
- data/tracks/ruby/exercises/rna-transcription/rna_transcription_test.rb +4 -4
- data/tracks/ruby/exercises/roman-numerals/.meta/solutions/roman_numerals.rb +1 -1
- data/tracks/ruby/exercises/space-age/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/lib/generator/test_template.erb +1 -1
- data/tracks/ruby/lib/generator/underscore.rb +1 -1
- data/tracks/ruby/lib/helper.rb +4 -4
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha-beta/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha/.meta/.version +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha/.meta/generator/alpha_case.rb +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha/.meta/generator/test_template.erb +1 -1
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/alpha/.meta/solutions/alpha.rb +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/beta/.meta/.version +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/exercises/beta/.meta/generator/beta_case.rb +0 -0
- data/tracks/ruby/test/fixtures/{xruby → ruby}/lib/generator/test_template.erb +1 -1
- data/tracks/ruby/test/generator/files/track_files_test.rb +4 -4
- data/tracks/ruby/test/generator/implementation_test.rb +1 -1
- data/tracks/ruby/test/generator/template_values_test.rb +1 -1
- data/tracks/scala/exercises/rail-fence-cipher/src/main/scala/{RailFenceCipher.scala → .keep} +0 -0
- data/tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala +16 -23
- data/tracks/scala/exercises/say/src/test/scala/SayTest.scala +20 -33
- data/tracks/scala/testgen/src/main/scala/RailFenceCipherTestGenerator.scala +9 -53
- data/tracks/scala/testgen/src/main/scala/SayTestGenerator.scala +50 -0
- data/tracks/sml/bin/generate +1 -1
- data/tracks/sml/config.json +30 -0
- data/tracks/sml/exercises/all-your-base/README.md +61 -0
- data/tracks/sml/exercises/all-your-base/all-your-base.sml +2 -0
- data/tracks/sml/exercises/all-your-base/example.sml +36 -0
- data/tracks/sml/exercises/all-your-base/test.sml +75 -0
- data/tracks/sml/exercises/all-your-base/testlib.sml +159 -0
- data/tracks/sml/exercises/difference-of-squares/example.sml +3 -6
- data/tracks/sml/exercises/list-ops/README.md +40 -0
- data/tracks/sml/exercises/list-ops/example.sml +34 -0
- data/tracks/sml/exercises/list-ops/list-ops.sml +23 -0
- data/tracks/sml/exercises/list-ops/test.sml +85 -0
- data/tracks/sml/exercises/list-ops/testlib.sml +159 -0
- data/tracks/sml/exercises/prime-factors/README.md +66 -0
- data/tracks/sml/exercises/prime-factors/example.sml +15 -0
- data/tracks/sml/exercises/prime-factors/prime-factors.sml +2 -0
- data/tracks/sml/exercises/prime-factors/test.sml +35 -0
- data/tracks/sml/exercises/prime-factors/testlib.sml +159 -0
- metadata +34 -11
@@ -0,0 +1,159 @@
|
|
1
|
+
structure Expect =
|
2
|
+
struct
|
3
|
+
datatype expectation = Pass | Fail of string * string
|
4
|
+
|
5
|
+
local
|
6
|
+
fun failEq b a =
|
7
|
+
Fail ("Expected: " ^ b, "Got: " ^ a)
|
8
|
+
|
9
|
+
fun failExn b a =
|
10
|
+
Fail ("Expected: " ^ b, "Raised: " ^ a)
|
11
|
+
|
12
|
+
fun exnName (e: exn): string = General.exnName e
|
13
|
+
in
|
14
|
+
fun truthy a =
|
15
|
+
if a
|
16
|
+
then Pass
|
17
|
+
else failEq "true" "false"
|
18
|
+
|
19
|
+
fun falsy a =
|
20
|
+
if a
|
21
|
+
then failEq "false" "true"
|
22
|
+
else Pass
|
23
|
+
|
24
|
+
fun equalTo b a =
|
25
|
+
if a = b
|
26
|
+
then Pass
|
27
|
+
else failEq (PolyML.makestring b) (PolyML.makestring a)
|
28
|
+
|
29
|
+
fun nearTo b a =
|
30
|
+
if Real.== (a, b)
|
31
|
+
then Pass
|
32
|
+
else failEq (Real.toString b) (Real.toString a)
|
33
|
+
|
34
|
+
fun anyError f =
|
35
|
+
(
|
36
|
+
f ();
|
37
|
+
failExn "an exception" "Nothing"
|
38
|
+
) handle _ => Pass
|
39
|
+
|
40
|
+
fun error e f =
|
41
|
+
(
|
42
|
+
f ();
|
43
|
+
failExn (exnName e) "Nothing"
|
44
|
+
) handle e' => if exnMessage e' = exnMessage e
|
45
|
+
then Pass
|
46
|
+
else failExn (exnMessage e) (exnMessage e')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
structure TermColor =
|
51
|
+
struct
|
52
|
+
datatype color = Red | Green | Yellow | Normal
|
53
|
+
|
54
|
+
fun f Red = "\027[31m"
|
55
|
+
| f Green = "\027[32m"
|
56
|
+
| f Yellow = "\027[33m"
|
57
|
+
| f Normal = "\027[0m"
|
58
|
+
|
59
|
+
fun colorize color s = (f color) ^ s ^ (f Normal)
|
60
|
+
|
61
|
+
val redit = colorize Red
|
62
|
+
|
63
|
+
val greenit = colorize Green
|
64
|
+
|
65
|
+
val yellowit = colorize Yellow
|
66
|
+
end
|
67
|
+
|
68
|
+
structure Test =
|
69
|
+
struct
|
70
|
+
datatype testnode = TestGroup of string * testnode list
|
71
|
+
| Test of string * (unit -> Expect.expectation)
|
72
|
+
|
73
|
+
local
|
74
|
+
datatype evaluation = Success of string
|
75
|
+
| Failure of string * string * string
|
76
|
+
| Error of string * string
|
77
|
+
|
78
|
+
fun indent n s = (implode (List.tabulate (n, fn _ => #" "))) ^ s
|
79
|
+
|
80
|
+
fun fmt indentlvl ev =
|
81
|
+
let
|
82
|
+
val check = TermColor.greenit "\226\156\148 " (* ✔ *)
|
83
|
+
val cross = TermColor.redit "\226\156\150 " (* ✖ *)
|
84
|
+
val indentlvl = indentlvl * 2
|
85
|
+
in
|
86
|
+
case ev of
|
87
|
+
Success descr => indent indentlvl (check ^ descr)
|
88
|
+
| Failure (descr, exp, got) =>
|
89
|
+
String.concatWith "\n" [indent indentlvl (cross ^ descr),
|
90
|
+
indent (indentlvl + 2) exp,
|
91
|
+
indent (indentlvl + 2) got]
|
92
|
+
| Error (descr, reason) =>
|
93
|
+
String.concatWith "\n" [indent indentlvl (cross ^ descr),
|
94
|
+
indent (indentlvl + 2) (TermColor.redit reason)]
|
95
|
+
end
|
96
|
+
|
97
|
+
fun eval (TestGroup _) = raise Fail "Only a 'Test' can be evaluated"
|
98
|
+
| eval (Test (descr, thunk)) =
|
99
|
+
(
|
100
|
+
case thunk () of
|
101
|
+
Expect.Pass => ((1, 0, 0), Success descr)
|
102
|
+
| Expect.Fail (s, s') => ((0, 1, 0), Failure (descr, s, s'))
|
103
|
+
)
|
104
|
+
handle e => ((0, 0, 1), Error (descr, "Unexpected error: " ^ exnMessage e))
|
105
|
+
|
106
|
+
fun flatten depth testnode =
|
107
|
+
let
|
108
|
+
fun sum (x, y, z) (a, b, c) = (x + a, y + b, z + c)
|
109
|
+
|
110
|
+
fun aux (t, (counter, acc)) =
|
111
|
+
let
|
112
|
+
val (counter', texts) = flatten (depth + 1) t
|
113
|
+
in
|
114
|
+
(sum counter' counter, texts :: acc)
|
115
|
+
end
|
116
|
+
in
|
117
|
+
case testnode of
|
118
|
+
TestGroup (descr, ts) =>
|
119
|
+
let
|
120
|
+
val (counter, texts) = foldr aux ((0, 0, 0), []) ts
|
121
|
+
in
|
122
|
+
(counter, (indent (depth * 2) descr) :: List.concat texts)
|
123
|
+
end
|
124
|
+
| Test _ =>
|
125
|
+
let
|
126
|
+
val (counter, evaluation) = eval testnode
|
127
|
+
in
|
128
|
+
(counter, [fmt depth evaluation])
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
fun println s = print (s ^ "\n")
|
133
|
+
in
|
134
|
+
fun run suite =
|
135
|
+
let
|
136
|
+
val ((succeeded, failed, errored), texts) = flatten 0 suite
|
137
|
+
|
138
|
+
val summary = String.concatWith ", " [
|
139
|
+
TermColor.greenit ((Int.toString succeeded) ^ " passed"),
|
140
|
+
TermColor.redit ((Int.toString failed) ^ " failed"),
|
141
|
+
TermColor.redit ((Int.toString errored) ^ " errored"),
|
142
|
+
(Int.toString (succeeded + failed + errored)) ^ " total"
|
143
|
+
]
|
144
|
+
|
145
|
+
val status = if failed = 0 andalso errored = 0
|
146
|
+
then OS.Process.success
|
147
|
+
else OS.Process.failure
|
148
|
+
|
149
|
+
in
|
150
|
+
List.app println texts;
|
151
|
+
println "";
|
152
|
+
println ("Tests: " ^ summary);
|
153
|
+
OS.Process.exit status
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
fun describe description tests = Test.TestGroup (description, tests)
|
159
|
+
fun test description thunk = Test.Test (description, thunk)
|
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.
|
4
|
+
version: 2.2.1.20
|
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-08-
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -576,6 +576,7 @@ files:
|
|
576
576
|
- tracks/bash/config.json
|
577
577
|
- tracks/bash/config/exercise_readme.go.tmpl
|
578
578
|
- tracks/bash/config/maintainers.json
|
579
|
+
- tracks/bash/docs/ABOUT.md
|
579
580
|
- tracks/bash/docs/EXERCISE_README_INSERT.md
|
580
581
|
- tracks/bash/docs/INSTALLATION.md
|
581
582
|
- tracks/bash/docs/LEARNING.md
|
@@ -621,6 +622,10 @@ files:
|
|
621
622
|
- tracks/bash/exercises/two-fer/README.md
|
622
623
|
- tracks/bash/exercises/two-fer/example.sh
|
623
624
|
- tracks/bash/exercises/two-fer/two_fer_test.sh
|
625
|
+
- tracks/bash/exercises/word-count/README.md
|
626
|
+
- tracks/bash/exercises/word-count/example.awk
|
627
|
+
- tracks/bash/exercises/word-count/example.sh
|
628
|
+
- tracks/bash/exercises/word-count/word_count_test.sh
|
624
629
|
- tracks/bash/img/icon.png
|
625
630
|
- tracks/c/.git
|
626
631
|
- tracks/c/.github/stale.yml
|
@@ -4081,6 +4086,7 @@ files:
|
|
4081
4086
|
- tracks/factor/docs/INSTALLATION.md
|
4082
4087
|
- tracks/factor/docs/LEARNING.md
|
4083
4088
|
- tracks/factor/docs/RESOURCES.md
|
4089
|
+
- tracks/factor/docs/SNIPPET.txt
|
4084
4090
|
- tracks/factor/docs/TESTS.md
|
4085
4091
|
- tracks/factor/exercises/.keep
|
4086
4092
|
- tracks/factor/exercises/hello-world/README.md
|
@@ -6482,6 +6488,7 @@ files:
|
|
6482
6488
|
- tracks/julia/docs/INSTALLATION.md
|
6483
6489
|
- tracks/julia/docs/LEARNING.md
|
6484
6490
|
- tracks/julia/docs/RESOURCES.md
|
6491
|
+
- tracks/julia/docs/SNIPPET.txt
|
6485
6492
|
- tracks/julia/docs/TESTS.md
|
6486
6493
|
- tracks/julia/exercises/.keep
|
6487
6494
|
- tracks/julia/exercises/anagram/README.md
|
@@ -10210,14 +10217,14 @@ files:
|
|
10210
10217
|
- tracks/ruby/lib/tasks/exercise_tests_runner.rb
|
10211
10218
|
- tracks/ruby/test/fixtures/metadata/exercises/alpha/canonical-data.json
|
10212
10219
|
- tracks/ruby/test/fixtures/metadata/exercises/complex/canonical-data.json
|
10213
|
-
- tracks/ruby/test/fixtures/
|
10214
|
-
- tracks/ruby/test/fixtures/
|
10215
|
-
- tracks/ruby/test/fixtures/
|
10216
|
-
- tracks/ruby/test/fixtures/
|
10217
|
-
- tracks/ruby/test/fixtures/
|
10218
|
-
- tracks/ruby/test/fixtures/
|
10219
|
-
- tracks/ruby/test/fixtures/
|
10220
|
-
- tracks/ruby/test/fixtures/
|
10220
|
+
- tracks/ruby/test/fixtures/ruby/exercises/alpha-beta/.meta/generator/test_template.erb
|
10221
|
+
- tracks/ruby/test/fixtures/ruby/exercises/alpha/.meta/.version
|
10222
|
+
- tracks/ruby/test/fixtures/ruby/exercises/alpha/.meta/generator/alpha_case.rb
|
10223
|
+
- tracks/ruby/test/fixtures/ruby/exercises/alpha/.meta/generator/test_template.erb
|
10224
|
+
- tracks/ruby/test/fixtures/ruby/exercises/alpha/.meta/solutions/alpha.rb
|
10225
|
+
- tracks/ruby/test/fixtures/ruby/exercises/beta/.meta/.version
|
10226
|
+
- tracks/ruby/test/fixtures/ruby/exercises/beta/.meta/generator/beta_case.rb
|
10227
|
+
- tracks/ruby/test/fixtures/ruby/lib/generator/test_template.erb
|
10221
10228
|
- tracks/ruby/test/generator/case_values_test.rb
|
10222
10229
|
- tracks/ruby/test/generator/command_line/generator_optparser_test.rb
|
10223
10230
|
- tracks/ruby/test/generator/command_line_test.rb
|
@@ -11035,7 +11042,7 @@ files:
|
|
11035
11042
|
- tracks/scala/exercises/rail-fence-cipher/README.md
|
11036
11043
|
- tracks/scala/exercises/rail-fence-cipher/build.sbt
|
11037
11044
|
- tracks/scala/exercises/rail-fence-cipher/example.scala
|
11038
|
-
- tracks/scala/exercises/rail-fence-cipher/src/main/scala
|
11045
|
+
- tracks/scala/exercises/rail-fence-cipher/src/main/scala/.keep
|
11039
11046
|
- tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala
|
11040
11047
|
- tracks/scala/exercises/raindrops/README.md
|
11041
11048
|
- tracks/scala/exercises/raindrops/build.sbt
|
@@ -11224,6 +11231,7 @@ files:
|
|
11224
11231
|
- tracks/scala/testgen/src/main/scala/RnaTranscriptionTestGenerator.scala
|
11225
11232
|
- tracks/scala/testgen/src/main/scala/RomanNumeralsTestGenerator.scala
|
11226
11233
|
- tracks/scala/testgen/src/main/scala/RunLengthEncodingTestGenerator.scala
|
11234
|
+
- tracks/scala/testgen/src/main/scala/SayTestGenerator.scala
|
11227
11235
|
- tracks/scala/testgen/src/main/scala/ScrabbleScoreTestGenerator.scala
|
11228
11236
|
- tracks/scala/testgen/src/main/scala/SecretHandshakeTestGenerator.scala
|
11229
11237
|
- tracks/scala/testgen/src/main/scala/SeriesTestGenerator.scala
|
@@ -11334,6 +11342,11 @@ files:
|
|
11334
11342
|
- tracks/sml/exercises/accumulate/accumulate.sml
|
11335
11343
|
- tracks/sml/exercises/accumulate/example.sml
|
11336
11344
|
- tracks/sml/exercises/accumulate/test.sml
|
11345
|
+
- tracks/sml/exercises/all-your-base/README.md
|
11346
|
+
- tracks/sml/exercises/all-your-base/all-your-base.sml
|
11347
|
+
- tracks/sml/exercises/all-your-base/example.sml
|
11348
|
+
- tracks/sml/exercises/all-your-base/test.sml
|
11349
|
+
- tracks/sml/exercises/all-your-base/testlib.sml
|
11337
11350
|
- tracks/sml/exercises/allergies/README.md
|
11338
11351
|
- tracks/sml/exercises/allergies/allergies.sml
|
11339
11352
|
- tracks/sml/exercises/allergies/example.sml
|
@@ -11373,6 +11386,11 @@ files:
|
|
11373
11386
|
- tracks/sml/exercises/hello-world/hello-world.sml
|
11374
11387
|
- tracks/sml/exercises/hello-world/test.sml
|
11375
11388
|
- tracks/sml/exercises/hello-world/testlib.sml
|
11389
|
+
- tracks/sml/exercises/list-ops/README.md
|
11390
|
+
- tracks/sml/exercises/list-ops/example.sml
|
11391
|
+
- tracks/sml/exercises/list-ops/list-ops.sml
|
11392
|
+
- tracks/sml/exercises/list-ops/test.sml
|
11393
|
+
- tracks/sml/exercises/list-ops/testlib.sml
|
11376
11394
|
- tracks/sml/exercises/nth-prime/README.md
|
11377
11395
|
- tracks/sml/exercises/nth-prime/example.sml
|
11378
11396
|
- tracks/sml/exercises/nth-prime/nth-prime.sml
|
@@ -11387,6 +11405,11 @@ files:
|
|
11387
11405
|
- tracks/sml/exercises/perfect-numbers/perfect-numbers.sml
|
11388
11406
|
- tracks/sml/exercises/perfect-numbers/test.sml
|
11389
11407
|
- tracks/sml/exercises/perfect-numbers/testlib.sml
|
11408
|
+
- tracks/sml/exercises/prime-factors/README.md
|
11409
|
+
- tracks/sml/exercises/prime-factors/example.sml
|
11410
|
+
- tracks/sml/exercises/prime-factors/prime-factors.sml
|
11411
|
+
- tracks/sml/exercises/prime-factors/test.sml
|
11412
|
+
- tracks/sml/exercises/prime-factors/testlib.sml
|
11390
11413
|
- tracks/sml/exercises/raindrops/README.md
|
11391
11414
|
- tracks/sml/exercises/raindrops/example.sml
|
11392
11415
|
- tracks/sml/exercises/raindrops/raindrops.sml
|