trackler 2.2.1.86 → 2.2.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/reverse-string/metadata.yml +0 -1
  4. data/tracks/bash/CONTRIBUTING.md +129 -28
  5. data/tracks/bash/config/exercise_readme.go.tmpl +10 -4
  6. data/tracks/bash/exercises/acronym/README.md +8 -11
  7. data/tracks/bash/exercises/acronym/{acronym_tests.sh → acronym_test.sh} +0 -0
  8. data/tracks/bash/exercises/anagram/README.md +6 -1
  9. data/tracks/bash/exercises/anagram/anagram_test.sh +1 -1
  10. data/tracks/bash/exercises/armstrong-numbers/README.md +10 -2
  11. data/tracks/bash/exercises/atbash-cipher/README.md +6 -6
  12. data/tracks/bash/exercises/bob/README.md +8 -1
  13. data/tracks/bash/exercises/collatz-conjecture/README.md +11 -2
  14. data/tracks/bash/exercises/collatz-conjecture/{collatz_test.sh → collatz_conjecture_test.sh} +6 -6
  15. data/tracks/bash/exercises/difference-of-squares/README.md +6 -1
  16. data/tracks/bash/exercises/error-handling/README.md +13 -5
  17. data/tracks/bash/exercises/error-handling/error_handling_test.sh +18 -22
  18. data/tracks/bash/exercises/error-handling/example.sh +7 -6
  19. data/tracks/bash/exercises/gigasecond/.meta/hints.md +0 -5
  20. data/tracks/bash/exercises/gigasecond/README.md +36 -1
  21. data/tracks/bash/exercises/grains/README.md +10 -2
  22. data/tracks/bash/exercises/hamming/README.md +6 -1
  23. data/tracks/bash/exercises/hello-world/README.md +7 -2
  24. data/tracks/bash/exercises/leap/README.md +7 -2
  25. data/tracks/bash/exercises/luhn/README.md +7 -2
  26. data/tracks/bash/exercises/nucleotide-count/README.md +13 -22
  27. data/tracks/bash/exercises/pangram/README.md +7 -2
  28. data/tracks/bash/exercises/phone-number/README.md +10 -4
  29. data/tracks/bash/exercises/raindrops/README.md +6 -1
  30. data/tracks/bash/exercises/reverse-string/README.md +11 -2
  31. data/tracks/bash/exercises/rna-transcription/README.md +7 -2
  32. data/tracks/bash/exercises/roman-numerals/README.md +11 -2
  33. data/tracks/bash/exercises/triangle/README.md +5 -4
  34. data/tracks/bash/exercises/two-fer/README.md +7 -9
  35. data/tracks/bash/exercises/word-count/README.md +6 -2
  36. data/tracks/bash/exercises/word-count/example.sh +22 -13
  37. data/tracks/bash/scripts/canonical_data_check.sh +112 -0
  38. data/tracks/c/exercises/acronym/src/{example.h → acronym.h} +0 -0
  39. data/tracks/c/exercises/gigasecond/.meta/hints.md +124 -0
  40. data/tracks/c/exercises/gigasecond/README.md +126 -0
  41. data/tracks/c/exercises/isogram/src/{example.h → isogram.h} +0 -0
  42. data/tracks/c/exercises/meetup/.meta/hints.md +124 -0
  43. data/tracks/c/exercises/meetup/README.md +142 -12
  44. data/tracks/c/exercises/pangram/src/{example.h → pangram.h} +0 -0
  45. data/tracks/c/exercises/space-age/.meta/hints.md +124 -0
  46. data/tracks/c/exercises/space-age/README.md +127 -2
  47. data/tracks/elisp/bin/test-examples +11 -14
  48. data/tracks/elisp/config.json +9 -1
  49. data/tracks/elisp/exercises/acronym/README.md +13 -0
  50. data/tracks/elisp/exercises/acronym/acronym-test.el +28 -0
  51. data/tracks/elisp/exercises/acronym/acronym.el +11 -0
  52. data/tracks/elisp/exercises/acronym/example.el +14 -0
  53. data/tracks/elisp/exercises/bob/example.el +1 -3
  54. data/tracks/elisp/exercises/hamming/README.md +2 -0
  55. data/tracks/elisp/exercises/hamming/hamming-test.el +35 -12
  56. data/tracks/elisp/exercises/hamming/hamming.el +0 -3
  57. data/tracks/fsharp/exercises/custom-set/CustomSetTest.fs +206 -132
  58. data/tracks/fsharp/exercises/custom-set/Example.fs +2 -0
  59. data/tracks/fsharp/generators/Generators.fs +61 -0
  60. data/tracks/go/config.json +25 -2
  61. data/tracks/go/exercises/acronym/acronym_test.go +8 -0
  62. data/tracks/go/exercises/alphametics/.meta/gen.go +72 -0
  63. data/tracks/go/exercises/alphametics/.meta/hints.md +38 -0
  64. data/tracks/go/exercises/alphametics/README.md +93 -0
  65. data/tracks/go/exercises/alphametics/alphametics_test.go +33 -0
  66. data/tracks/go/exercises/alphametics/cases_test.go +59 -0
  67. data/tracks/go/exercises/alphametics/example.go +212 -0
  68. data/tracks/go/exercises/atbash-cipher/.meta/gen.go +6 -4
  69. data/tracks/go/exercises/atbash-cipher/cases_test.go +2 -2
  70. data/tracks/go/exercises/change/.meta/gen.go +7 -5
  71. data/tracks/go/exercises/change/cases_test.go +2 -2
  72. data/tracks/go/exercises/collatz-conjecture/.meta/gen.go +5 -3
  73. data/tracks/go/exercises/collatz-conjecture/cases_test.go +2 -2
  74. data/tracks/go/exercises/connect/.meta/gen.go +5 -3
  75. data/tracks/go/exercises/connect/cases_test.go +2 -2
  76. data/tracks/go/exercises/flatten-array/.meta/gen.go +5 -3
  77. data/tracks/go/exercises/flatten-array/cases_test.go +2 -2
  78. data/tracks/go/exercises/meetup/.meta/gen.go +19 -8
  79. data/tracks/go/exercises/meetup/cases_test.go +2 -2
  80. data/tracks/go/exercises/simple-linked-list/README.md +47 -0
  81. data/tracks/go/exercises/simple-linked-list/example.go +74 -0
  82. data/tracks/go/exercises/simple-linked-list/linked_list_test.go +210 -0
  83. data/tracks/idris/config.json +2 -2
  84. data/tracks/java/exercises/all-your-base/.meta/src/reference/java/BaseConverter.java +1 -5
  85. data/tracks/java/exercises/all-your-base/.meta/version +1 -1
  86. data/tracks/java/exercises/all-your-base/src/test/java/BaseConverterTest.java +34 -10
  87. data/tracks/java/exercises/bob/README.md +2 -0
  88. data/tracks/java/exercises/kindergarten-garden/.meta/version +1 -0
  89. data/tracks/java/exercises/kindergarten-garden/src/test/java/KindergartenGardenTest.java +0 -55
  90. data/tracks/java/exercises/meetup/.meta/version +1 -0
  91. data/tracks/java/exercises/meetup/src/test/java/MeetupTest.java +32 -0
  92. data/tracks/java/exercises/parallel-letter-frequency/README.md +1 -0
  93. data/tracks/java/exercises/proverb/README.md +16 -10
  94. data/tracks/java/exercises/rail-fence-cipher/README.md +5 -6
  95. data/tracks/java/exercises/two-fer/README.md +1 -1
  96. data/tracks/java/exercises/word-search/.meta/version +1 -1
  97. data/tracks/java/exercises/word-search/src/test/java/WordSearcherTest.java +240 -2
  98. data/tracks/javascript/.eslintignore +0 -1
  99. data/tracks/javascript/exercises/palindrome-products/example.js +3 -3
  100. data/tracks/kotlin/docs/INSTALLATION.md +77 -68
  101. data/tracks/kotlin/docs/TESTS.md +41 -39
  102. data/tracks/perl6/exercises/acronym/acronym.t +20 -8
  103. data/tracks/perl6/exercises/acronym/example.yaml +1 -1
  104. data/tracks/perl6/exercises/all-your-base/all-your-base.t +108 -66
  105. data/tracks/perl6/exercises/all-your-base/example.yaml +2 -2
  106. data/tracks/perl6/exercises/allergies/allergies.t +39 -15
  107. data/tracks/perl6/exercises/allergies/example.yaml +2 -2
  108. data/tracks/perl6/exercises/anagram/anagram.t +73 -40
  109. data/tracks/perl6/exercises/anagram/example.yaml +1 -1
  110. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +38 -15
  111. data/tracks/perl6/exercises/atbash-cipher/example.yaml +1 -1
  112. data/tracks/perl6/exercises/bob/bob.t +77 -27
  113. data/tracks/perl6/exercises/bob/example.yaml +1 -1
  114. data/tracks/perl6/exercises/flatten-array/example.yaml +1 -1
  115. data/tracks/perl6/exercises/flatten-array/flatten-array.t +20 -8
  116. data/tracks/perl6/exercises/luhn/example.yaml +1 -1
  117. data/tracks/perl6/exercises/luhn/luhn.t +42 -16
  118. data/tracks/perl6/exercises/roman-numerals/README.md +68 -0
  119. data/tracks/php/exercises/gigasecond/gigasecond_test.php +1 -1
  120. data/tracks/python/docs/ABOUT.md +2 -2
  121. metadata +27 -10
  122. data/tracks/bash/docs/EXERCISE_README_INSERT.md +0 -3
  123. data/tracks/bash/exercises/word-count/example.awk +0 -12
  124. data/tracks/java/exercises/alphametics/src/main/java/.keep +0 -0
@@ -15,7 +15,6 @@ exercises/list-ops
15
15
  exercises/luhn
16
16
  exercises/minesweeper
17
17
  exercises/nth-prime
18
- exercises/palindrome-products
19
18
  exercises/perfect-numbers
20
19
  exercises/pythagorean-triplet
21
20
  exercises/queen-attack
@@ -14,16 +14,16 @@ module.exports = function Palindromes(options) {
14
14
  for (var i = minFactor; i <= maxFactor; i++) {
15
15
  for (var j = minFactor; j <= maxFactor; j++) {
16
16
  var result = i * j;
17
- if ( ! this.isPalindrome(result) ) { continue; }
17
+ if (!this.isPalindrome(result)) { continue; }
18
18
 
19
19
  var newFactor = [i, j].sort();
20
20
 
21
- if (palindromes[result] === undefined) {
21
+ if (!Array.isArray(palindromes[result])) {
22
22
  palindromes[result] = [];
23
23
  palindromeIndexes.push(result);
24
24
  }
25
25
 
26
- if ( ! arrayContainsArray(palindromes[result], newFactor) ) {
26
+ if (!arrayContainsArray(palindromes[result], newFactor)) {
27
27
  palindromes[result].push(newFactor);
28
28
  }
29
29
  }
@@ -24,23 +24,25 @@ Open an administrative command prompt. (If you need assistance opening an admin
24
24
 
25
25
  1. If you have not installed Chocolatey, do so now:
26
26
 
27
- ```batchfile
28
- C:\Windows\system32> @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
29
- ```
27
+ ```batchfile
28
+ C:\Windows\system32> @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
29
+ ```
30
+
30
31
  2. Install the JDK:
31
32
 
32
- ```batchfile
33
- C:\Windows\system32> choco install jdk8
34
- ...
35
- C:\Windows\system32> refreshenv
36
- ...
37
- ```
33
+ ```batchfile
34
+ C:\Windows\system32> choco install jdk8
35
+ ...
36
+ C:\Windows\system32> refreshenv
37
+ ...
38
+ ```
39
+
38
40
  3. Install Gradle:
39
41
 
40
- ```batchfile
41
- C:\Windows\system32>choco install gradle
42
- ...
43
- ```
42
+ ```batchfile
43
+ C:\Windows\system32>choco install gradle
44
+ ...
45
+ ```
44
46
 
45
47
  We recommend closing the administrative command prompt and opening a new command prompt -- you do not require administrator priviledges to practice Exercism exercises.
46
48
 
@@ -58,24 +60,27 @@ Below are instructions for install using the most common method - using Homebrew
58
60
 
59
61
  1. If you haven't installed [Homebrew](http://brew.sh), yet, do so now:
60
62
 
61
- ```sh
62
- $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
63
- ```
63
+ ```sh
64
+ $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
65
+ ```
66
+
64
67
  2. Tap the [Homebrew Cask](https://caskroom.github.io/) — this allows us to install pre-built binaries like the JDK.
65
68
 
66
- ```
67
- $ brew tap caskroom/cask
68
- ```
69
+ ```
70
+ $ brew tap caskroom/cask
71
+ ```
72
+
69
73
  3. Install the JDK:
70
74
 
71
- ```
72
- $ brew cask install java
73
- ```
75
+ ```
76
+ $ brew cask install java
77
+ ```
78
+
74
79
  4. Install Gradle:
75
80
 
76
- ```
77
- $ brew install gradle
78
- ```
81
+ ```
82
+ $ brew install gradle
83
+ ```
79
84
 
80
85
  You now are ready to get started with the Kotlin track of Exercism!
81
86
 
@@ -98,21 +103,22 @@ If you are using Debian or its derivatives (like Ubuntu or Linux Mint), use APT:
98
103
 
99
104
  1. Install the JDK:
100
105
 
101
- ```sh
102
- $ sudo apt-get update
103
- $ sudo apt-get install python-software-properties
104
- $ sudo add-apt-repository ppa:webupd8team/java
105
- $ sudo apt-get update
106
- $ sudo apt-get install oracle-java8-installer
107
- $ sudo apt install oracle-java8-set-default
108
- ```
106
+ ```sh
107
+ $ sudo apt-get update
108
+ $ sudo apt-get install python-software-properties
109
+ $ sudo add-apt-repository ppa:webupd8team/java
110
+ $ sudo apt-get update
111
+ $ sudo apt-get install oracle-java8-installer
112
+ $ sudo apt install oracle-java8-set-default
113
+ ```
114
+
109
115
  2. Install Gradle:
110
116
 
111
- ```sh
112
- $ sudo add-apt-repository ppa:cwchien/gradle
113
- $ sudo apt-get update
114
- $ sudo apt-get install gradle
115
- ```
117
+ ```sh
118
+ $ sudo add-apt-repository ppa:cwchien/gradle
119
+ $ sudo apt-get update
120
+ $ sudo apt-get install gradle
121
+ ```
116
122
 
117
123
  You now are ready to get started with the Kotlin track of Exercism!
118
124
 
@@ -128,14 +134,15 @@ If you are using Fedora or its derivatives, use DNF:
128
134
 
129
135
  1. Install the JDK:
130
136
 
131
- ```sh
132
- $ sudo dnf install java-1.8.0-openjdk-devel
133
- ```
137
+ ```sh
138
+ $ sudo dnf install java-1.8.0-openjdk-devel
139
+ ```
140
+
134
141
  2. Install Gradle:
135
142
 
136
- ```sh
137
- $ sudo dnf install gradle
138
- ```
143
+ ```sh
144
+ $ sudo dnf install gradle
145
+ ```
139
146
 
140
147
 
141
148
  You now are ready to get started with the Kotlin track of Exercism!
@@ -183,20 +190,21 @@ To get started, see "[Running the Tests](http://exercism.io/languages/kotlin/tes
183
190
  1. Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/).
184
191
  2. Unpack Gradle:
185
192
 
186
- ```sh
187
- $ mkdir ~/tools
188
- $ cd ~/tools
189
- $ unzip ~/Downloads/gradle-*-bin.zip
190
- $ cd gradle*
191
- ```
193
+ ```sh
194
+ $ mkdir ~/tools
195
+ $ cd ~/tools
196
+ $ unzip ~/Downloads/gradle-*-bin.zip
197
+ $ cd gradle*
198
+ ```
199
+
192
200
  3. Configure Gradle and add it to the path:
193
201
 
194
- ```sh
195
- $ cat << DONE >> ~/.bashrc
196
- export GRADLE_HOME=`pwd`
197
- export PATH=\$PATH:\$GRADLE_HOME/bin
198
- DONE
199
- ```
202
+ ```sh
203
+ $ cat << DONE >> ~/.bashrc
204
+ export GRADLE_HOME=`pwd`
205
+ export PATH=\$PATH:\$GRADLE_HOME/bin
206
+ DONE
207
+ ```
200
208
 
201
209
 
202
210
  You now are ready to get started with the Kotlin track of Exercism!
@@ -216,20 +224,21 @@ To get started, see "[Running the Tests](http://exercism.io/languages/kotlin/tes
216
224
  1. Download "**Binary only distribution**" from the [Gradle download page](https://gradle.org/gradle-download/).
217
225
  2. Unpack Gradle:
218
226
 
219
- ```sh
220
- $ mkdir ~/tools
221
- $ cd ~/tools
222
- $ unzip ~/Downloads/gradle-*-bin.zip
223
- $ cd gradle*
224
- ```
227
+ ```sh
228
+ $ mkdir ~/tools
229
+ $ cd ~/tools
230
+ $ unzip ~/Downloads/gradle-*-bin.zip
231
+ $ cd gradle*
232
+ ```
233
+
225
234
  3. Configure Gradle and add it to the path:
226
235
 
227
- ```sh
228
- $ cat << DONE >> ~/.bashrc
229
- export GRADLE_HOME=`pwd`
230
- export PATH=\$PATH:\$GRADLE_HOME/bin
231
- DONE
232
- ```
236
+ ```sh
237
+ $ cat << DONE >> ~/.bashrc
238
+ export GRADLE_HOME=`pwd`
239
+ export PATH=\$PATH:\$GRADLE_HOME/bin
240
+ DONE
241
+ ```
233
242
 
234
243
  You now are ready to get started with the Kotlin track of Exercism!
235
244
 
@@ -13,30 +13,31 @@ Choose your operating system:
13
13
  1. Open a Command Prompt.
14
14
  2. Get the first exercise:
15
15
 
16
- ```batchfile
17
- C:\Users\JohnDoe>exercism fetch kotlin
18
- 
19
- Not Submitted: 1 problem
20
- Kotlin (Hello World) C:\Users\JohnDoe\exercism\kotlin\hello-world
16
+ ```batchfile
17
+ C:\Users\JohnDoe>exercism fetch kotlin
21
18
 
22
- New: 1 problem
23
- Kotlin (Hello World) C:\Users\JohnDoe\exercism\kotlin\hello-world
19
+ Not Submitted: 1 problem
20
+ Kotlin (Hello World) C:\Users\JohnDoe\exercism\kotlin\hello-world
24
21
 
25
- unchanged: 0, updated: 0, new: 1
22
+ New: 1 problem
23
+ Kotlin (Hello World) C:\Users\JohnDoe\exercism\kotlin\hello-world
24
+
25
+ unchanged: 0, updated: 0, new: 1
26
+ ```
26
27
 
27
- ```
28
28
  3. Change directory into the exercism:
29
29
 
30
- ```batchfile
31
- C:\Users\JohnDoe>cd C:\Users\JohnDoe\exercism\kotlin\hello-world
32
- ```
30
+ ```batchfile
31
+ C:\Users\JohnDoe>cd C:\Users\JohnDoe\exercism\kotlin\hello-world
32
+ ```
33
33
 
34
34
  4. Run the tests:
35
35
 
36
- ```batchfile
37
- C:\Users\JohnDoe>gradle test
38
- ```
36
+ ```batchfile
37
+ C:\Users\JohnDoe>gradle test
38
+ ```
39
39
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
40
+
40
41
  5. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/kotlin/blob/master/exercises/hello-world/TUTORIAL.md)).
41
42
 
42
43
 
@@ -50,25 +51,26 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
50
51
 
51
52
  1. In the terminal window, get the first exercise:
52
53
 
53
- ```
54
- $ exercism fetch kotlin
54
+ ```
55
+ $ exercism fetch kotlin
55
56
 
56
- New: 1 problem
57
- Kotlin (Etl) /Users/johndoe/exercism/kotlin/hello-world
57
+ New: 1 problem
58
+ Kotlin (Etl) /Users/johndoe/exercism/kotlin/hello-world
58
59
 
59
- unchanged: 0, updated: 0, new: 1
60
- ```
60
+ unchanged: 0, updated: 0, new: 1
61
+ ```
61
62
 
62
63
  2. Change directory into the exercise:
63
64
 
64
- ```
65
- $ cd /Users/johndoe/exercism/kotlin/hello-world
66
- ```
65
+ ```
66
+ $ cd /Users/johndoe/exercism/kotlin/hello-world
67
+ ```
68
+
67
69
  3. Run the tests:
68
70
 
69
- ```
70
- $ gradle test
71
- ```
71
+ ```
72
+ $ gradle test
73
+ ```
72
74
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
73
75
 
74
76
  4. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/kotlin/blob/master/exercises/hello-world/TUTORIAL.md)).
@@ -83,26 +85,26 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
83
85
 
84
86
  1. In the terminal window, get the first exercise:
85
87
 
86
- ```
87
- $ exercism fetch kotlin
88
+ ```
89
+ $ exercism fetch kotlin
88
90
 
89
- New: 1 problem
90
- Kotlin (Etl) /home/johndoe/exercism/kotlin/hello-world
91
+ New: 1 problem
92
+ Kotlin (Etl) /home/johndoe/exercism/kotlin/hello-world
91
93
 
92
- unchanged: 0, updated: 0, new: 1
93
- ```
94
+ unchanged: 0, updated: 0, new: 1
95
+ ```
94
96
 
95
97
  2. Change directory into the exercise:
96
98
 
97
- ```
98
- $ cd /home/johndoe/exercism/kotlin/hello-world
99
- ```
99
+ ```
100
+ $ cd /home/johndoe/exercism/kotlin/hello-world
101
+ ```
100
102
 
101
103
  3. Run the tests:
102
104
 
103
- ```
104
- $ gradle test
105
- ```
105
+ ```
106
+ $ gradle test
107
+ ```
106
108
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
107
109
 
108
110
  4. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/kotlin/blob/master/exercises/hello-world/TUTORIAL.mdhttps://github.com/exercism/kotlin/blob/master/exercises/hello-world/GETTING_STARTED.mdhttps://github.com/exercism/kotlin/blob/master/exercises/hello-world/GETTING_STARTED.mdhttps://github.com/exercism/kotlin/blob/master/exercises/hello-world/GETTING_STARTED.md)).
@@ -24,7 +24,7 @@ require ::($module) <&abbreviate>;
24
24
  my $c-data = from-json $=pod.pop.contents;
25
25
 
26
26
  for $c-data<cases>»<cases>».Array.flat {
27
- is abbreviate(.<phrase>), |.<expected description>;
27
+ is abbreviate(.<input><phrase>), |.<expected description>;
28
28
  }
29
29
 
30
30
  =head2 Canonical Data
@@ -32,7 +32,7 @@ for $c-data<cases>»<cases>».Array.flat {
32
32
 
33
33
  {
34
34
  "exercise": "acronym",
35
- "version": "1.1.0",
35
+ "version": "1.2.0",
36
36
  "cases": [
37
37
  {
38
38
  "description": "Abbreviate a phrase",
@@ -40,37 +40,49 @@ for $c-data<cases>»<cases>».Array.flat {
40
40
  {
41
41
  "description": "basic",
42
42
  "property": "abbreviate",
43
- "phrase": "Portable Network Graphics",
43
+ "input": {
44
+ "phrase": "Portable Network Graphics"
45
+ },
44
46
  "expected": "PNG"
45
47
  },
46
48
  {
47
49
  "description": "lowercase words",
48
50
  "property": "abbreviate",
49
- "phrase": "Ruby on Rails",
51
+ "input": {
52
+ "phrase": "Ruby on Rails"
53
+ },
50
54
  "expected": "ROR"
51
55
  },
52
56
  {
53
57
  "description": "punctuation",
54
58
  "property": "abbreviate",
55
- "phrase": "First In, First Out",
59
+ "input": {
60
+ "phrase": "First In, First Out"
61
+ },
56
62
  "expected": "FIFO"
57
63
  },
58
64
  {
59
65
  "description": "all caps words",
60
66
  "property": "abbreviate",
61
- "phrase": "PHP: Hypertext Preprocessor",
67
+ "input": {
68
+ "phrase": "PHP: Hypertext Preprocessor"
69
+ },
62
70
  "expected": "PHP"
63
71
  },
64
72
  {
65
73
  "description": "non-acronym all caps word",
66
74
  "property": "abbreviate",
67
- "phrase": "GNU Image Manipulation Program",
75
+ "input": {
76
+ "phrase": "GNU Image Manipulation Program"
77
+ },
68
78
  "expected": "GIMP"
69
79
  },
70
80
  {
71
81
  "description": "hyphenated",
72
82
  "property": "abbreviate",
73
- "phrase": "Complementary metal-oxide semiconductor",
83
+ "input": {
84
+ "phrase": "Complementary metal-oxide semiconductor"
85
+ },
74
86
  "expected": "CMOS"
75
87
  }
76
88
  ]
@@ -5,7 +5,7 @@ imports: '&abbreviate'
5
5
  tests: |-
6
6
 
7
7
  for $c-data<cases>»<cases>».Array.flat {
8
- is abbreviate(.<phrase>), |.<expected description>;
8
+ is abbreviate(.<input><phrase>), |.<expected description>;
9
9
  }
10
10
 
11
11
  unit: module
@@ -25,8 +25,8 @@ my $c-data = from-json $=pod.pop.contents;
25
25
  for $c-data<cases>.values -> $case {
26
26
  sub call-convert-base {
27
27
  convert-base(
28
- bases => %(<from to> Z=> .<input_base output_base>),
29
- digits => .<input_digits>,
28
+ bases => %(<from to> Z=> .<input><input_base output_base>),
29
+ digits => .<input><digits>,
30
30
  ) given $case;
31
31
  }
32
32
 
@@ -45,7 +45,7 @@ for $c-data<cases>.values -> $case {
45
45
 
46
46
  {
47
47
  "exercise": "all-your-base",
48
- "version": "2.0.1",
48
+ "version": "2.1.0",
49
49
  "comments": [
50
50
  "This canonical data makes the following choices:",
51
51
  "1. Zero is always represented in outputs as [0] instead of [].",
@@ -61,169 +61,211 @@ for $c-data<cases>.values -> $case {
61
61
  {
62
62
  "description": "single bit one to decimal",
63
63
  "property": "rebase",
64
- "input_base": 2,
65
- "input_digits": [1],
66
- "output_base": 10,
64
+ "input": {
65
+ "input_base": 2,
66
+ "digits": [1],
67
+ "output_base": 10
68
+ },
67
69
  "expected": [1]
68
70
  },
69
71
  {
70
72
  "description": "binary to single decimal",
71
73
  "property": "rebase",
72
- "input_base": 2,
73
- "input_digits": [1, 0, 1],
74
- "output_base": 10,
74
+ "input": {
75
+ "input_base": 2,
76
+ "digits": [1, 0, 1],
77
+ "output_base": 10
78
+ },
75
79
  "expected": [5]
76
80
  },
77
81
  {
78
82
  "description": "single decimal to binary",
79
83
  "property": "rebase",
80
- "input_base": 10,
81
- "input_digits": [5],
82
- "output_base": 2,
84
+ "input": {
85
+ "input_base": 10,
86
+ "digits": [5],
87
+ "output_base": 2
88
+ },
83
89
  "expected": [1, 0, 1]
84
90
  },
85
91
  {
86
92
  "description": "binary to multiple decimal",
87
93
  "property": "rebase",
88
- "input_base": 2,
89
- "input_digits": [1, 0, 1, 0, 1, 0],
90
- "output_base": 10,
94
+ "input": {
95
+ "input_base": 2,
96
+ "digits": [1, 0, 1, 0, 1, 0],
97
+ "output_base": 10
98
+ },
91
99
  "expected": [4, 2]
92
100
  },
93
101
  {
94
102
  "description": "decimal to binary",
95
103
  "property": "rebase",
96
- "input_base": 10,
97
- "input_digits": [4, 2],
98
- "output_base": 2,
104
+ "input": {
105
+ "input_base": 10,
106
+ "digits": [4, 2],
107
+ "output_base": 2
108
+ },
99
109
  "expected": [1, 0, 1, 0, 1, 0]
100
110
  },
101
111
  {
102
112
  "description": "trinary to hexadecimal",
103
113
  "property": "rebase",
104
- "input_base": 3,
105
- "input_digits": [1, 1, 2, 0],
106
- "output_base": 16,
114
+ "input": {
115
+ "input_base": 3,
116
+ "digits": [1, 1, 2, 0],
117
+ "output_base": 16
118
+ },
107
119
  "expected": [2, 10]
108
120
  },
109
121
  {
110
122
  "description": "hexadecimal to trinary",
111
123
  "property": "rebase",
112
- "input_base": 16,
113
- "input_digits": [2, 10],
114
- "output_base": 3,
124
+ "input": {
125
+ "input_base": 16,
126
+ "digits": [2, 10],
127
+ "output_base": 3
128
+ },
115
129
  "expected": [1, 1, 2, 0]
116
130
  },
117
131
  {
118
132
  "description": "15-bit integer",
119
133
  "property": "rebase",
120
- "input_base": 97,
121
- "input_digits": [3, 46, 60],
122
- "output_base": 73,
134
+ "input": {
135
+ "input_base": 97,
136
+ "digits": [3, 46, 60],
137
+ "output_base": 73
138
+ },
123
139
  "expected": [6, 10, 45]
124
140
  },
125
141
  {
126
142
  "description": "empty list",
127
143
  "property": "rebase",
128
- "input_base": 2,
129
- "input_digits": [],
130
- "output_base": 10,
144
+ "input": {
145
+ "input_base": 2,
146
+ "digits": [],
147
+ "output_base": 10
148
+ },
131
149
  "expected": [0]
132
150
  },
133
151
  {
134
152
  "description": "single zero",
135
153
  "property": "rebase",
136
- "input_base": 10,
137
- "input_digits": [0],
138
- "output_base": 2,
154
+ "input": {
155
+ "input_base": 10,
156
+ "digits": [0],
157
+ "output_base": 2
158
+ },
139
159
  "expected": [0]
140
160
  },
141
161
  {
142
162
  "description": "multiple zeros",
143
163
  "property": "rebase",
144
- "input_base": 10,
145
- "input_digits": [0, 0, 0],
146
- "output_base": 2,
164
+ "input": {
165
+ "input_base": 10,
166
+ "digits": [0, 0, 0],
167
+ "output_base": 2
168
+ },
147
169
  "expected": [0]
148
170
  },
149
171
  {
150
172
  "description": "leading zeros",
151
173
  "property": "rebase",
152
- "input_base": 7,
153
- "input_digits": [0, 6, 0],
154
- "output_base": 10,
174
+ "input": {
175
+ "input_base": 7,
176
+ "digits": [0, 6, 0],
177
+ "output_base": 10
178
+ },
155
179
  "expected": [4, 2]
156
180
  },
157
181
  {
158
182
  "description": "input base is one",
159
183
  "property": "rebase",
160
- "input_base": 1,
161
- "input_digits": [],
162
- "output_base": 10,
184
+ "input": {
185
+ "input_base": 1,
186
+ "digits": [],
187
+ "output_base": 10
188
+ },
163
189
  "expected": {"error": "input base must be >= 2"}
164
190
  },
165
191
  {
166
192
  "description": "input base is zero",
167
193
  "property": "rebase",
168
- "input_base": 0,
169
- "input_digits": [],
170
- "output_base": 10,
194
+ "input": {
195
+ "input_base": 0,
196
+ "digits": [],
197
+ "output_base": 10
198
+ },
171
199
  "expected": {"error": "input base must be >= 2"}
172
200
  },
173
201
  {
174
202
  "description": "input base is negative",
175
203
  "property": "rebase",
176
- "input_base": -2,
177
- "input_digits": [1],
178
- "output_base": 10,
204
+ "input": {
205
+ "input_base": -2,
206
+ "digits": [1],
207
+ "output_base": 10
208
+ },
179
209
  "expected": {"error": "input base must be >= 2"}
180
210
  },
181
211
  {
182
212
  "description": "negative digit",
183
213
  "property": "rebase",
184
- "input_base": 2,
185
- "input_digits": [1, -1, 1, 0, 1, 0],
186
- "output_base": 10,
214
+ "input": {
215
+ "input_base": 2,
216
+ "digits": [1, -1, 1, 0, 1, 0],
217
+ "output_base": 10
218
+ },
187
219
  "expected": {"error": "all digits must satisfy 0 <= d < input base"}
188
220
  },
189
221
  {
190
222
  "description": "invalid positive digit",
191
223
  "property": "rebase",
192
- "input_base": 2,
193
- "input_digits": [1, 2, 1, 0, 1, 0],
194
- "output_base": 10,
224
+ "input": {
225
+ "input_base": 2,
226
+ "digits": [1, 2, 1, 0, 1, 0],
227
+ "output_base": 10
228
+ },
195
229
  "expected": {"error": "all digits must satisfy 0 <= d < input base"}
196
230
  },
197
231
  {
198
232
  "description": "output base is one",
199
233
  "property": "rebase",
200
- "input_base": 2,
201
- "input_digits": [1, 0, 1, 0, 1, 0],
202
- "output_base": 1,
234
+ "input": {
235
+ "input_base": 2,
236
+ "digits": [1, 0, 1, 0, 1, 0],
237
+ "output_base": 1
238
+ },
203
239
  "expected": {"error": "output base must be >= 2"}
204
240
  },
205
241
  {
206
242
  "description": "output base is zero",
207
243
  "property": "rebase",
208
- "input_base": 10,
209
- "input_digits": [7],
210
- "output_base": 0,
244
+ "input": {
245
+ "input_base": 10,
246
+ "digits": [7],
247
+ "output_base": 0
248
+ },
211
249
  "expected": {"error": "output base must be >= 2"}
212
250
  },
213
251
  {
214
252
  "description": "output base is negative",
215
253
  "property": "rebase",
216
- "input_base": 2,
217
- "input_digits": [1],
218
- "output_base": -7,
254
+ "input": {
255
+ "input_base": 2,
256
+ "digits": [1],
257
+ "output_base": -7
258
+ },
219
259
  "expected": {"error": "output base must be >= 2"}
220
260
  },
221
261
  {
222
262
  "description": "both bases are negative",
223
263
  "property": "rebase",
224
- "input_base": -2,
225
- "input_digits": [1],
226
- "output_base": -7,
264
+ "input": {
265
+ "input_base": -2,
266
+ "digits": [1],
267
+ "output_base": -7
268
+ },
227
269
  "expected": {"error": "input base must be >= 2"}
228
270
  }
229
271
  ]