trackler 2.0.8.43 → 2.0.8.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/ceylon/exercises/anagram/source/anagram/AnagramTest.ceylon +3 -2
  4. data/tracks/ceylon/exercises/bracket-push/source/bracketpush/BracketsTest.ceylon +3 -0
  5. data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +16 -0
  6. data/tracks/ceylon/exercises/largest-series-product/source/largestseriesproduct/SeriesTest.ceylon +16 -0
  7. data/tracks/ceylon/exercises/leap/source/leap/LeapTest.ceylon +1 -0
  8. data/tracks/ceylon/exercises/react/source/react/ReactorTest.ceylon +2 -0
  9. data/tracks/ceylon/exercises/sieve/source/sieve/SieveTest.ceylon +1 -0
  10. data/tracks/crystal/exercises/sieve/src/example.cr +3 -2
  11. data/tracks/csharp/.github/stale.yml +0 -0
  12. data/tracks/csharp/exercises/house/HINTS.md +3 -0
  13. data/tracks/csharp/exercises/saddle-points/HINTS.md +4 -0
  14. data/tracks/fsharp/.github/stale.yml +0 -0
  15. data/tracks/go/.github/stale.yml +22 -0
  16. data/tracks/go/README.md +26 -15
  17. data/tracks/go/exercises/bob/{example_gen.go → .meta/gen.go} +1 -1
  18. data/tracks/go/exercises/bowling/{example_gen.go → .meta/gen.go} +1 -1
  19. data/tracks/go/exercises/change/{example_gen.go → .meta/gen.go} +1 -1
  20. data/tracks/go/exercises/clock/{example_gen.go → .meta/gen.go} +1 -1
  21. data/tracks/go/exercises/connect/{example_gen.go → .meta/gen.go} +1 -1
  22. data/tracks/go/exercises/custom-set/{example_gen.go → .meta/gen.go} +1 -1
  23. data/tracks/go/exercises/forth/.meta/gen.go +71 -0
  24. data/tracks/go/exercises/forth/cases_test.go +259 -236
  25. data/tracks/go/exercises/forth/forth_test.go +19 -34
  26. data/tracks/go/exercises/gigasecond/{example_gen.go → .meta/gen.go} +1 -1
  27. data/tracks/go/exercises/hamming/{example_gen.go → .meta/gen.go} +1 -1
  28. data/tracks/go/exercises/largest-series-product/{example_gen.go → .meta/gen.go} +1 -1
  29. data/tracks/go/exercises/leap/{example_gen.go → .meta/gen.go} +1 -1
  30. data/tracks/go/exercises/luhn/{example_gen.go → .meta/gen.go} +1 -1
  31. data/tracks/go/exercises/meetup/{example_gen.go → .meta/gen.go} +1 -1
  32. data/tracks/go/exercises/raindrops/{example_gen.go → .meta/gen.go} +1 -1
  33. data/tracks/go/exercises/rna-transcription/{example_gen.go → .meta/gen.go} +1 -1
  34. data/tracks/go/exercises/roman-numerals/{example_gen.go → .meta/gen.go} +1 -1
  35. data/tracks/go/exercises/transpose/{example_gen.go → .meta/gen.go} +1 -1
  36. data/tracks/go/exercises/word-count/{example_gen.go → .meta/gen.go} +1 -1
  37. data/tracks/go/gen/gen.go +9 -9
  38. data/tracks/purescript/config.json +7 -0
  39. data/tracks/purescript/exercises/binary-search/bower.json +16 -0
  40. data/tracks/purescript/exercises/binary-search/examples/src/BinarySearch.purs +19 -0
  41. data/tracks/purescript/exercises/binary-search/src/BinarySearch.purs +3 -0
  42. data/tracks/purescript/exercises/binary-search/test/Main.purs +53 -0
  43. data/tracks/python/config.json +6 -0
  44. data/tracks/python/exercises/rectangles/rectangles_test.py +68 -41
  45. data/tracks/python/exercises/transpose/example.py +6 -0
  46. data/tracks/python/exercises/transpose/transpose.py +2 -0
  47. data/tracks/python/exercises/transpose/transpose_test.py +264 -0
  48. metadata +32 -20
  49. data/tracks/go/exercises/forth/example_gen.go +0 -99
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9834bb8d7cd54e4b2c8e1e26da6932cf1e95cc5
4
- data.tar.gz: 21645918c226fde411b8ae99233e4fcd3abe2e97
3
+ metadata.gz: cad1dc38bea7e7ee4ddedd5f7215ef56be2adb9a
4
+ data.tar.gz: 3891605c70d09d4a9e44db48a7e702bcee6486cc
5
5
  SHA512:
6
- metadata.gz: 929126636d31a8a2c0d54e607e5b64c2b131087594b836796e2a9f282dde25d522af1a0174bde3ee6939fc4679b0107dbad40e6982e517636124cd9743dff7f9
7
- data.tar.gz: 484e966fda60ece17a4553d9b82e4a5974f2b763acd58369283b5a2f2f3197d931d6e34f4449e41e175c1bb34be8f63d17b574b7d0c65c60048d59e1e4b322c5
6
+ metadata.gz: 454da043eddd6054d7ceacb2ca7768db876af837347ca5c4dc9864638a7f159a6297b905f129bf3adc90d2af078c04b8af228d12be8b4386ba06bf88b5038640
7
+ data.tar.gz: 19be29744501524033e93ea0e793e305dade023157c35de1f5500ba0e81af04d4ebba679c7ec90b1e37dd3f3102e05086b9d53f19f428ebc6013be2d9cf51b50
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.8.43"
2
+ VERSION = "2.0.8.44"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  import ceylon.test { ... }
2
2
 
3
+ // Tests adapted from x-common version 1.0.1
3
4
  {[String, {String*}, {String*}]*} cases => {
4
5
  // no matches
5
6
  ["diaper", {"hello", "world", "zombies", "pants"}, {}],
@@ -7,13 +8,13 @@ import ceylon.test { ... }
7
8
  ["ant", {"tan", "stand", "at"}, {"tan"}],
8
9
  // does not detect false positives
9
10
  ["galea", {"eagle"}, {}],
10
- // detects multiple anagrams
11
+ // detects two anagrams
11
12
  ["master", {"stream", "pigeon", "maters"}, {"stream", "maters"}],
12
13
  // does not detect anagram subsets
13
14
  ["good", {"dog", "goody"}, {}],
14
15
  // detects anagram
15
16
  ["listen", {"enlists", "google", "inlets", "banana"}, {"inlets"}],
16
- // detects multiple anagrams
17
+ // detects three anagrams
17
18
  [
18
19
  "allergy",
19
20
  {"gallery", "ballerina", "regally", "clergy", "largely", "leading"},
@@ -1,5 +1,6 @@
1
1
  import ceylon.test { ... }
2
2
 
3
+ // Tests adapted from x-common version 1.1.0
3
4
  {[String, Boolean]*} cases => {
4
5
  // paired square brackets
5
6
  ["[]", true],
@@ -9,6 +10,8 @@ import ceylon.test { ... }
9
10
  ["[[", false],
10
11
  // wrong ordered brackets
11
12
  ["}{", false],
13
+ // wrong closing bracket
14
+ ["{]", false],
12
15
  // paired with whitespace
13
16
  ["{ }", true],
14
17
  // simple nested brackets
@@ -1,20 +1,36 @@
1
1
  import ceylon.test { ... }
2
2
 
3
+ // Tests adapted from x-common version 1.0.0
3
4
  {[String, String, Integer?]*} cases => {
5
+ // identical strands
4
6
  ["A", "A", 0],
7
+ // long identical strands
5
8
  ["GGACTGA", "GGACTGA", 0],
9
+ // complete distance in single nucleotide strands
6
10
  ["A", "G", 1],
11
+ // complete distance in small strands
7
12
  ["AG", "CT", 2],
13
+ // small distance in small strands
8
14
  ["AT", "CT", 1],
15
+ // small distance
9
16
  ["GGACG", "GGTCG", 1],
17
+ // small distance in long strands
10
18
  ["ACCAGGG", "ACTATGG", 2],
19
+ // non-unique character in first strand
11
20
  ["AGA", "AGG", 1],
21
+ // non-unique character in second strand
12
22
  ["AGG", "AGA", 1],
23
+ // same nucleotides in different positions
13
24
  ["TAG", "GAT", 2],
25
+ // large distance
14
26
  ["GATACA", "GCATAA", 4],
27
+ // large distance in off-by-one strand
15
28
  ["GGACGGATTCTG", "AGGACGGATTCT", 9],
29
+ // empty strands
16
30
  ["", "", 0],
31
+ // disallow first strand longer
17
32
  ["AATG", "AAA", null],
33
+ // disallow second strand longer
18
34
  ["ATA", "AGTG", null]
19
35
  };
20
36
 
@@ -1,20 +1,36 @@
1
1
  import ceylon.test { ... }
2
2
 
3
+ // Tests adapted from x-common version 1.0.0
3
4
  {[String, Integer, Integer?]*} cases => {
5
+ // finds the largest product if span equals length
4
6
  ["29", 2, 18],
7
+ // can find the largest product of 2 with numbers in order
5
8
  ["0123456789", 2, 72],
9
+ // can find the largest product of 2
6
10
  ["576802143", 2, 48],
11
+ // can find the largest product of 3 with numbers in order
7
12
  ["0123456789", 3, 504],
13
+ // can find the largest product of 3
8
14
  ["1027839564", 3, 270],
15
+ // can find the largest product of 5 with numbers in order
9
16
  ["0123456789", 5, 15120],
17
+ // can get the largest product of a big number
10
18
  ["73167176531330624919225119674426574742355349194934", 6, 23520],
19
+ // reports zero if the only digits are zero
11
20
  ["0000", 2, 0],
21
+ // reports zero if all spans include zero
12
22
  ["99099", 3, 0],
23
+ // rejects span longer than string length
13
24
  ["123", 4, null],
25
+ // reports 1 for empty string and empty product (0 span)
14
26
  ["", 0, 1],
27
+ // reports 1 for nonempty string and empty product (0 span)
15
28
  ["123", 0, 1],
29
+ // rejects empty string and nonzero span
16
30
  ["", 1, null],
31
+ // rejects invalid character in digits
17
32
  ["1234a5", 2, null],
33
+ // rejects negative span
18
34
  ["12345", -1, null]
19
35
  };
20
36
 
@@ -1,5 +1,6 @@
1
1
  import ceylon.test { ... }
2
2
 
3
+ // Tests adapted from x-common version 1.0.0
3
4
  {[Integer, Boolean]*} cases =>
4
5
  {[2015, false], [2016, true], [2100, false], [2000, true]};
5
6
 
@@ -1,5 +1,7 @@
1
1
  import ceylon.test { ... }
2
2
 
3
+ // Tests adapted from x-common version 1.0.0
4
+
3
5
  test
4
6
  void inputCellsHaveValue() {
5
7
  value r = Reactor<Integer>();
@@ -1,5 +1,6 @@
1
1
  import ceylon.test { ... }
2
2
 
3
+ // Tests adapted from x-common version 1.0.0
3
4
  {Integer*} cases => {1, 2, 10, 13, 1000};
4
5
 
5
6
  [Integer+] primes1000 = [
@@ -4,9 +4,10 @@ module Primes
4
4
  def sieve(limit)
5
5
  sieve_ar = Array.new(limit + 1, true)
6
6
  sieve_ar[0] = sieve_ar[1] = false
7
- 2.step(Math.sqrt(limit)) do |i|
7
+
8
+ 2.step(to: Math.sqrt(limit)) do |i|
8
9
  next unless sieve_ar[i]
9
- (i*i).step(limit, i) { |ii| sieve_ar[ii] = false }
10
+ (i*i).step(to: limit, by: i) { |ii| sieve_ar[ii] = false }
10
11
  end
11
12
 
12
13
  sieve_ar.each_with_index.reduce([] of Int32) { |p, (s, i)| s ? p << i : p }
File without changes
@@ -0,0 +1,3 @@
1
+ ## Hints
2
+
3
+ Try to capture the structure of the song in your code, where you build up the song by composing its parts.
@@ -0,0 +1,4 @@
1
+ ## Hints
2
+
3
+ For this exercise, you will need to create a set of factors using tuples.
4
+ For more information on tuples, see [this link](https://msdn.microsoft.com/en-us/library/system.tuple(v=vs.110).aspx).
File without changes
@@ -0,0 +1,22 @@
1
+ # Configuration for probot-stale - https://github.com/probot/stale
2
+
3
+ # Number of days of inactivity before an Issue or Pull Request becomes stale
4
+ daysUntilStale: 60
5
+ # Number of days of inactivity before a stale Issue or Pull Request is closed
6
+ daysUntilClose: 7
7
+ # Issues or Pull Requests with these labels will never be considered stale
8
+ exemptLabels:
9
+ - pinned
10
+ - security
11
+ - good first patch
12
+ # Label to use when marking as stale
13
+ staleLabel: wontfix
14
+ # Comment to post when marking as stale. Set to `false` to disable
15
+ markComment: >
16
+ This issue has been automatically marked as stale because it has not had
17
+ recent activity. It will be closed if no further activity occurs. Thank you
18
+ for your contributions.
19
+ # Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
20
+ closeComment: false
21
+ # Limit to only `issues` or `pulls`
22
+ # only: issues
data/tracks/go/README.md CHANGED
@@ -44,15 +44,16 @@ number of files there.
44
44
 
45
45
  ```sh
46
46
  ~/exercism/go/leap
47
- $ tree
47
+ $ tree -a
48
48
  .
49
49
  ├── cases_test.go
50
- ├── example_gen.go
51
50
  ├── example.go
52
51
  ├── leap.go
53
- └── leap_test.go
52
+ ├── leap_test.go
53
+ └── .meta
54
+ └── gen.go
54
55
 
55
- 0 directories, 5 files
56
+ 1 directory, 5 files
56
57
  ```
57
58
 
58
59
  This list of files can vary across exercises so let's quickly run through
@@ -61,16 +62,22 @@ each file and briefly describe what it is.
61
62
  **cases_test.go** - This file contains [generated test cases](#generating-test-cases),
62
63
  and will only be present in some exercises.
63
64
 
64
- **example_gen.go** - This file generates the *cases_test.go* file, and will only
65
- be present in some exercises. See [generating test cases](#generating-test-cases)
66
- for more information.
67
-
68
- **example.go** - This is a reference solution for the exercise.
65
+ **example.go** - This is a reference solution for the exercise. This file is
66
+ ignored by the `exercism fetch` command, as are any files that include the
67
+ word *example* in the filename, or anything within the *.meta* directory.
69
68
 
70
69
  **leap.go** - This is a *stub file*, and will only be present in some exercises.
71
70
 
72
71
  **leap_test.go** - This is the main test file for the exercise.
73
72
 
73
+ **.meta/** - The *.meta* directory is used to contain files that are not
74
+ meant to be included when a user fetches an exercise, for instance test case
75
+ generators.
76
+
77
+ **gen.go** - This file, within the *.meta* directory, generates the *cases_test.go*
78
+ file, and will only be present in some exercises. See [generating test cases](#generating-test-cases)
79
+ for more information.
80
+
74
81
  In some exercises there can be extra files, for instance the `series` exercise
75
82
  contains extra test files.
76
83
 
@@ -136,7 +143,7 @@ without a stub is [twelve-days](exercises/twelve-days/). At this point users wil
136
143
  have some experience in creating solutions for the exercises and can begin to
137
144
  create their own solutions from scratch. Some of the later exercises may have stub
138
145
  files if the author thinks there may be implementation confusion, a particularly
139
- difficult concept, or boilerplate code needed.
146
+ difficult concept, or boilerplate code needed.
140
147
 
141
148
  ### Problem Versioning
142
149
 
@@ -163,17 +170,21 @@ tracks don't.
163
170
 
164
171
  Some problems that are implemented in multiple tracks use the same inputs and
165
172
  outputs to define the test suites. Where the [x-common](https://github.com/exercism/x-common)
166
- repository contains json files with these inputs and outputs, we can generate
167
- the test cases programmatically.
173
+ repository contains a *canonical-data.json* file with these inputs and outputs,
174
+ we can generate the test cases programmatically.
168
175
 
169
- See the *example_gen.go* file in the `leap` exercise for an example of how this
176
+ See the *gen.go* file in the `leap` exercise for an example of how this
170
177
  can be done.
171
178
 
179
+ Test case generators are named *gen.go* and are kept in a special *.meta*
180
+ directory within each exercise that makes use of a test cases generator. This
181
+ *.meta* directory will be ignored when a user fetches an exercise.
182
+
172
183
  Whenever the shared JSON data changes, the test cases will need to be regenerated.
173
184
  To do this, make sure that the **x-common** repository has been cloned in the same
174
185
  parent-directory as the **xgo** repository. Then navigate into the **xgo**
175
- directory and run `go run exercises/<problem>/example_gen.go`. You should see
176
- that the `<problem>/test_cases.go` file has changed. Commit the change.
186
+ directory and run `go run exercises/<exercise>/.meta/gen.go`. You should see
187
+ that the `<exercise>/cases_test.go` file has changed. Commit the change.
177
188
 
178
189
  ## Pull requests
179
190
 
@@ -6,7 +6,7 @@ import (
6
6
  "log"
7
7
  "text/template"
8
8
 
9
- "../../gen"
9
+ "../../../gen"
10
10
  )
11
11
 
12
12
  func main() {
@@ -6,7 +6,7 @@ import (
6
6
  "log"
7
7
  "text/template"
8
8
 
9
- "../../gen"
9
+ "../../../gen"
10
10
  )
11
11
 
12
12
  func main() {
@@ -6,7 +6,7 @@ import (
6
6
  "log"
7
7
  "text/template"
8
8
 
9
- "../../gen"
9
+ "../../../gen"
10
10
  )
11
11
 
12
12
  func main() {
@@ -6,7 +6,7 @@ import (
6
6
  "log"
7
7
  "text/template"
8
8
 
9
- "../../gen"
9
+ "../../../gen"
10
10
  )
11
11
 
12
12
  func main() {
@@ -6,7 +6,7 @@ import (
6
6
  "log"
7
7
  "text/template"
8
8
 
9
- "../../gen"
9
+ "../../../gen"
10
10
  )
11
11
 
12
12
  func main() {
@@ -7,7 +7,7 @@ import (
7
7
  "strconv"
8
8
  "text/template"
9
9
 
10
- "../../gen"
10
+ "../../../gen"
11
11
  )
12
12
 
13
13
  func main() {
@@ -0,0 +1,71 @@
1
+ // +build ignore
2
+
3
+ package main
4
+
5
+ import (
6
+ "log"
7
+ "text/template"
8
+
9
+ "../../../gen"
10
+ )
11
+
12
+ func main() {
13
+ t, err := template.New("").Parse(tmpl)
14
+ if err != nil {
15
+ log.Fatal(err)
16
+ }
17
+ var j js
18
+ if err := gen.Gen("forth", &j, t); err != nil {
19
+ log.Fatal(err)
20
+ }
21
+ }
22
+
23
+ // The JSON structure we expect to be able to unmarshal into
24
+ type js struct {
25
+ Groups []Group `json:"cases"`
26
+ }
27
+
28
+ // A group of test cases.
29
+ type Group struct {
30
+ Name string `json:"description"`
31
+ Cases []OneCase
32
+ }
33
+
34
+ // One test case.
35
+ type OneCase struct {
36
+ Description string
37
+ Input []string
38
+ Expected []int
39
+ }
40
+
41
+ // template applied to above data structure generates the Go test cases
42
+ var tmpl = `package forth
43
+
44
+ {{.Header}}
45
+
46
+ type testGroup struct {
47
+ group string
48
+ tests []testCase
49
+ }
50
+
51
+ type testCase struct {
52
+ description string
53
+ input []string
54
+ expected []int // nil slice indicates error expected.
55
+ }
56
+
57
+ var testGroups = []testGroup{
58
+ {{range .J.Groups}}{
59
+ group: {{printf "%q" .Name}},
60
+ tests: []testCase{
61
+ {{range .Cases}}{
62
+ {{printf "%q" .Description}},
63
+ {{printf "%#v" .Input}},
64
+ {{printf "%#v" .Expected}},
65
+ },
66
+ {{end}}
67
+ },
68
+ },
69
+ {{end}}
70
+ }
71
+ `