trackler 2.2.1.100 → 2.2.1.101

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/kindergarten-garden/canonical-data.json +37 -19
  4. data/problem-specifications/exercises/ocr-numbers/canonical-data.json +144 -110
  5. data/problem-specifications/exercises/palindrome-products/canonical-data.json +49 -25
  6. data/problem-specifications/exercises/poker/canonical-data.json +171 -115
  7. data/problem-specifications/exercises/prime-factors/canonical-data.json +22 -8
  8. data/problem-specifications/exercises/protein-translation/canonical-data.json +70 -24
  9. data/problem-specifications/exercises/proverb/canonical-data.json +24 -12
  10. data/problem-specifications/exercises/queen-attack/canonical-data.json +115 -91
  11. data/problem-specifications/exercises/rail-fence-cipher/canonical-data.json +25 -13
  12. data/problem-specifications/exercises/raindrops/canonical-data.json +55 -19
  13. data/problem-specifications/exercises/rational-numbers/canonical-data.json +374 -0
  14. data/problem-specifications/exercises/rational-numbers/description.md +27 -0
  15. data/problem-specifications/exercises/rational-numbers/metadata.yml +4 -0
  16. data/problem-specifications/exercises/rectangles/canonical-data.json +93 -67
  17. data/problem-specifications/exercises/reverse-string/canonical-data.json +16 -6
  18. data/problem-specifications/exercises/rna-transcription/metadata.yml +3 -3
  19. data/problem-specifications/exercises/roman-numerals/canonical-data.json +10 -2
  20. data/tracks/bash/config.json +11 -11
  21. data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +7 -0
  22. data/tracks/clojure/exercises/armstrong-numbers/README.md +1 -1
  23. data/tracks/delphi/config.json +11 -0
  24. data/tracks/delphi/exercises/clock/uClockExample.pas +6 -1
  25. data/tracks/delphi/exercises/clock/uClockTest.pas +22 -19
  26. data/tracks/delphi/exercises/isbn-verifier/README.md +1 -1
  27. data/tracks/delphi/exercises/reverse-string/README.md +1 -1
  28. data/tracks/delphi/exercises/rna-transcription/README.md +1 -1
  29. data/tracks/delphi/exercises/roman-numerals/uRomanNumeralsTest.pas +14 -0
  30. data/tracks/delphi/exercises/space-age/README.md +45 -0
  31. data/tracks/delphi/exercises/space-age/SpaceAge.dpr +60 -0
  32. data/tracks/delphi/exercises/space-age/uSpaceAgeExample.pas +120 -0
  33. data/tracks/delphi/exercises/space-age/uSpaceAgeTests.pas +135 -0
  34. data/tracks/delphi/exercises/two-fer/README.md +1 -1
  35. data/tracks/elixir/exercises/nth-prime/nth_prime.exs +0 -1
  36. data/tracks/fsharp/exercises/pov/PovTest.fs +66 -53
  37. data/tracks/fsharp/exercises/space-age/Example.fs +11 -11
  38. data/tracks/fsharp/exercises/space-age/SpaceAge.fs +1 -1
  39. data/tracks/fsharp/exercises/space-age/SpaceAgeTest.fs +21 -34
  40. data/tracks/fsharp/exercises/triangle/Example.fs +11 -16
  41. data/tracks/fsharp/exercises/triangle/Triangle.fs +4 -5
  42. data/tracks/fsharp/exercises/triangle/TriangleTest.fs +44 -31
  43. data/tracks/fsharp/generators/Generators.fs +121 -0
  44. data/tracks/go/config.json +12 -0
  45. data/tracks/go/exercises/clock/.meta/gen.go +37 -13
  46. data/tracks/go/exercises/clock/cases_test.go +10 -10
  47. data/tracks/go/exercises/clock/clock_test.go +16 -2
  48. data/tracks/go/exercises/clock/example.go +4 -0
  49. data/tracks/go/exercises/clock/example_clock_test.go +3 -3
  50. data/tracks/go/exercises/parallel-letter-frequency/.meta/hints.md +33 -0
  51. data/tracks/go/exercises/parallel-letter-frequency/README.md +35 -0
  52. data/tracks/go/exercises/raindrops/.meta/hints.md +7 -4
  53. data/tracks/go/exercises/raindrops/README.md +12 -0
  54. data/tracks/go/exercises/roman-numerals/.meta/gen.go +4 -2
  55. data/tracks/go/exercises/roman-numerals/cases_test.go +3 -2
  56. data/tracks/go/exercises/space-age/.meta/hints.md +10 -0
  57. data/tracks/go/exercises/space-age/README.md +14 -1
  58. data/tracks/go/exercises/twelve-days/README.md +2 -5
  59. data/tracks/go/exercises/two-bucket/.meta/gen.go +62 -0
  60. data/tracks/go/exercises/two-bucket/.meta/hints.md +16 -0
  61. data/tracks/go/exercises/two-bucket/README.md +72 -0
  62. data/tracks/go/exercises/two-bucket/cases_test.go +44 -0
  63. data/tracks/go/exercises/two-bucket/example.go +198 -0
  64. data/tracks/go/exercises/two-bucket/two_bucket_test.go +61 -0
  65. data/tracks/idris/.travis.yml +3 -2
  66. data/tracks/idris/bin/fetch-idris-testing.sh +11 -0
  67. data/tracks/idris/bin/solve_exercises.sh +2 -2
  68. data/tracks/idris/config.json +11 -0
  69. data/tracks/idris/config/exercise_readme.go.tmpl +0 -3
  70. data/tracks/idris/docs/INSTALLATION.md +22 -0
  71. data/tracks/idris/docs/TESTS.md +12 -4
  72. data/tracks/idris/exercises/accumulate/src/Accumulate.idr +5 -0
  73. data/tracks/idris/exercises/hamming/Hamming.ipkg +2 -0
  74. data/tracks/idris/exercises/hamming/src/{example.idr → Example.idr} +5 -1
  75. data/tracks/idris/exercises/hamming/src/Hamming.idr +13 -5
  76. data/tracks/idris/exercises/hamming/src/Test/Hamming.idr +31 -58
  77. data/tracks/idris/exercises/hello-world/HelloWorld.ipkg +2 -0
  78. data/tracks/idris/exercises/hello-world/src/Example.idr +9 -0
  79. data/tracks/idris/exercises/hello-world/src/HelloWorld.idr +6 -1
  80. data/tracks/idris/exercises/hello-world/src/Test/HelloWorld.idr +18 -18
  81. data/tracks/idris/exercises/leap/Leap.ipkg +2 -0
  82. data/tracks/idris/exercises/leap/src/{example.idr → Example.idr} +4 -0
  83. data/tracks/idris/exercises/leap/src/Leap.idr +5 -1
  84. data/tracks/idris/exercises/leap/src/Test/Leap.idr +21 -30
  85. data/tracks/idris/exercises/rna-transcription/Makefile +23 -0
  86. data/tracks/idris/exercises/rna-transcription/README.md +27 -0
  87. data/tracks/idris/exercises/rna-transcription/RnaTranscription.ipkg +5 -0
  88. data/tracks/idris/exercises/rna-transcription/src/RnaTranscription.idr +17 -0
  89. data/tracks/idris/exercises/rna-transcription/src/Test/RnaTranscription.idr +27 -0
  90. data/tracks/idris/exercises/rna-transcription/src/example.idr +35 -0
  91. data/tracks/java/exercises/etl/.meta/version +1 -0
  92. data/tracks/java/exercises/gigasecond/.meta/version +1 -0
  93. data/tracks/java/exercises/isbn-verifier/README.md +1 -1
  94. data/tracks/java/exercises/nucleotide-count/.meta/src/reference/java/NucleotideCounter.java +7 -1
  95. data/tracks/java/exercises/nucleotide-count/.meta/version +1 -0
  96. data/tracks/java/exercises/nucleotide-count/src/test/java/NucleotideCounterTest.java +19 -54
  97. data/tracks/java/exercises/proverb/.meta/version +1 -0
  98. data/tracks/java/exercises/reverse-string/README.md +1 -1
  99. data/tracks/java/exercises/rna-transcription/README.md +1 -1
  100. data/tracks/java/exercises/sum-of-multiples/.meta/version +1 -0
  101. data/tracks/java/exercises/sum-of-multiples/src/test/java/SumOfMultiplesTest.java +13 -1
  102. data/tracks/kotlin/config/exercise_readme.go.tmpl +0 -3
  103. data/tracks/kotlin/docs/TESTS.md +1 -1
  104. data/tracks/objective-c/config.json +11 -0
  105. data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureExample.h +7 -0
  106. data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureExample.m +26 -0
  107. data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m +39 -0
  108. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +31 -1
  109. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/xcshareddata/xcschemes/OCLint.xcscheme +3 -1
  110. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/xcshareddata/xcschemes/xobjectivecTest.xcscheme +3 -1
  111. data/tracks/ocaml/exercises/forth/example.ml +9 -9
  112. data/tracks/ocaml/tools/test-generator/Makefile +3 -9
  113. data/tracks/ocaml/tools/test-generator/src/test_gen.ml +18 -16
  114. data/tracks/perl6/exercises/acronym/.meta/exercise-data.yaml +1 -1
  115. data/tracks/perl6/exercises/acronym/acronym.t +4 -14
  116. data/tracks/perl6/exercises/all-your-base/all-your-base.t +0 -2
  117. data/tracks/perl6/exercises/allergies/allergies.t +0 -2
  118. data/tracks/perl6/exercises/anagram/.meta/exercise-data.yaml +1 -1
  119. data/tracks/perl6/exercises/anagram/anagram.t +2 -40
  120. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +0 -1
  121. data/tracks/perl6/exercises/bob/bob.t +0 -2
  122. data/tracks/perl6/exercises/clock/.meta/exercise-data.yaml +15 -11
  123. data/tracks/perl6/exercises/clock/.meta/solutions/Clock.pm6 +5 -1
  124. data/tracks/perl6/exercises/clock/Clock.pm6 +1 -1
  125. data/tracks/perl6/exercises/clock/clock.t +314 -217
  126. data/tracks/perl6/exercises/etl/etl.t +0 -2
  127. data/tracks/perl6/exercises/flatten-array/flatten-array.t +0 -2
  128. data/tracks/perl6/exercises/grains/grains.t +0 -2
  129. data/tracks/perl6/exercises/hamming/.meta/exercise-data.yaml +2 -2
  130. data/tracks/perl6/exercises/hamming/hamming.t +63 -35
  131. data/tracks/perl6/exercises/hello-world/hello-world.t +2 -3
  132. data/tracks/perl6/exercises/leap/.meta/exercise-data.yaml +1 -1
  133. data/tracks/perl6/exercises/leap/leap.t +14 -8
  134. data/tracks/perl6/exercises/luhn/luhn.t +0 -2
  135. data/tracks/perl6/exercises/nucleotide-count/.meta/exercise-data.yaml +2 -2
  136. data/tracks/perl6/exercises/nucleotide-count/nucleotide-count.t +18 -10
  137. data/tracks/perl6/exercises/pangram/.meta/exercise-data.yaml +1 -1
  138. data/tracks/perl6/exercises/pangram/pangram.t +32 -14
  139. data/tracks/perl6/exercises/phone-number/.meta/exercise-data.yaml +4 -4
  140. data/tracks/perl6/exercises/phone-number/.meta/solutions/Phone.pm6 +1 -1
  141. data/tracks/perl6/exercises/phone-number/Phone.pm6 +1 -1
  142. data/tracks/perl6/exercises/phone-number/phone-number.t +59 -21
  143. data/tracks/perl6/exercises/raindrops/raindrops.t +0 -2
  144. data/tracks/perl6/exercises/rna-transcription/.meta/exercise-data.yaml +1 -1
  145. data/tracks/perl6/exercises/rna-transcription/README.md +1 -1
  146. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +17 -9
  147. data/tracks/perl6/exercises/roman-numerals/.meta/exercise-data.yaml +3 -3
  148. data/tracks/perl6/exercises/roman-numerals/.meta/solutions/RomanNumerals.pm6 +1 -1
  149. data/tracks/perl6/exercises/roman-numerals/RomanNumerals.pm6 +1 -1
  150. data/tracks/perl6/exercises/roman-numerals/roman-numerals.t +66 -24
  151. data/tracks/perl6/exercises/scrabble-score/.meta/exercise-data.yaml +1 -1
  152. data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +35 -15
  153. data/tracks/perl6/exercises/space-age/.meta/exercise-data.yaml +1 -1
  154. data/tracks/perl6/exercises/space-age/space-age.t +34 -20
  155. data/tracks/perl6/exercises/two-fer/.meta/exercise-data.yaml +2 -2
  156. data/tracks/perl6/exercises/two-fer/two-fer.t +15 -11
  157. data/tracks/perl6/exercises/word-count/.meta/exercise-data.yaml +1 -1
  158. data/tracks/perl6/exercises/word-count/word-count.t +46 -26
  159. data/tracks/perl6/exercises/wordy/.meta/exercise-data.yaml +2 -2
  160. data/tracks/perl6/exercises/wordy/wordy.t +51 -21
  161. data/tracks/perl6/lib/Exercism/Generator.pm6 +1 -1
  162. data/tracks/perl6/t/generated-tests.t +1 -1
  163. data/tracks/perl6/templates/test.mustache +0 -1
  164. data/tracks/python/config.json +12 -0
  165. data/tracks/python/exercises/forth/example.py +1 -1
  166. data/tracks/python/exercises/forth/forth_test.py +43 -38
  167. data/tracks/python/exercises/spiral-matrix/README.md +42 -0
  168. data/tracks/python/exercises/spiral-matrix/example.py +11 -0
  169. data/tracks/python/exercises/spiral-matrix/spiral_matrix.py +2 -0
  170. data/tracks/python/exercises/spiral-matrix/spiral_matrix_test.py +40 -0
  171. data/tracks/racket/config/exercise_readme.go.tmpl +24 -4
  172. data/tracks/racket/exercises/accumulate/README.md +3 -6
  173. data/tracks/racket/exercises/acronym/README.md +3 -4
  174. data/tracks/racket/exercises/allergies/README.md +3 -4
  175. data/tracks/racket/exercises/anagram/README.md +3 -3
  176. data/tracks/racket/exercises/bob/README.md +5 -3
  177. data/tracks/racket/exercises/collatz-conjecture/README.md +3 -3
  178. data/tracks/racket/exercises/difference-of-squares/README.md +3 -3
  179. data/tracks/racket/exercises/etl/README.md +6 -4
  180. data/tracks/racket/exercises/gigasecond/README.md +3 -3
  181. data/tracks/racket/exercises/grains/README.md +3 -4
  182. data/tracks/racket/exercises/grep/README.md +15 -15
  183. data/tracks/racket/exercises/hamming/README.md +3 -3
  184. data/tracks/racket/exercises/hello-world/README.md +1 -1
  185. data/tracks/racket/exercises/leap/README.md +4 -4
  186. data/tracks/racket/exercises/list-ops/README.md +3 -4
  187. data/tracks/racket/exercises/meetup/README.md +19 -15
  188. data/tracks/racket/exercises/nucleotide-count/README.md +11 -25
  189. data/tracks/racket/exercises/perfect-numbers/README.md +5 -5
  190. data/tracks/racket/exercises/phone-number/README.md +7 -6
  191. data/tracks/racket/exercises/raindrops/README.md +3 -3
  192. data/tracks/racket/exercises/rna-transcription/README.md +4 -4
  193. data/tracks/racket/exercises/roman-numerals/README.md +4 -4
  194. data/tracks/racket/exercises/say/README.md +3 -3
  195. data/tracks/racket/exercises/scrabble-score/README.md +6 -4
  196. data/tracks/racket/exercises/word-count/README.md +4 -5
  197. data/tracks/scheme/config/exercise_readme.go.tmpl +0 -3
  198. data/tracks/scheme/docs/INSTALLATION.md +23 -14
  199. metadata +40 -9
  200. data/tracks/idris/docs/EXERCISE_README_INSERT.md +0 -0
  201. data/tracks/idris/exercises/hello-world/src/example.idr +0 -5
  202. data/tracks/kotlin/config/exercise-readme-insert.md +0 -1
  203. data/tracks/racket/docs/EXERCISE_README_INSERT.md +0 -23
  204. data/tracks/scheme/docs/EXERCISE_README_INSERT.md +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "exercise": "rail-fence-cipher",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "comments": [
5
5
  "The tests do not expect any normalization or cleaning.",
6
6
  "That trade is tested in enough other exercises."
@@ -12,22 +12,28 @@
12
12
  {
13
13
  "description": "encode with two rails",
14
14
  "property": "encode",
15
- "msg": "XOXOXOXOXOXOXOXOXO",
16
- "rails": 2,
15
+ "input": {
16
+ "msg": "XOXOXOXOXOXOXOXOXO",
17
+ "rails": 2
18
+ },
17
19
  "expected": "XXXXXXXXXOOOOOOOOO"
18
20
  },
19
21
  {
20
22
  "description": "encode with three rails",
21
23
  "property": "encode",
22
- "msg": "WEAREDISCOVEREDFLEEATONCE",
23
- "rails": 3,
24
+ "input": {
25
+ "msg": "WEAREDISCOVEREDFLEEATONCE",
26
+ "rails": 3
27
+ },
24
28
  "expected": "WECRLTEERDSOEEFEAOCAIVDEN"
25
29
  },
26
30
  {
27
31
  "description": "encode with ending in the middle",
28
32
  "property": "encode",
29
- "msg": "EXERCISES",
30
- "rails": 4,
33
+ "input": {
34
+ "msg": "EXERCISES",
35
+ "rails": 4
36
+ },
31
37
  "expected": "ESXIEECSR"
32
38
  }
33
39
  ]
@@ -38,22 +44,28 @@
38
44
  {
39
45
  "description": "decode with three rails",
40
46
  "property": "decode",
41
- "msg": "TEITELHDVLSNHDTISEIIEA",
42
- "rails": 3,
47
+ "input": {
48
+ "msg": "TEITELHDVLSNHDTISEIIEA",
49
+ "rails": 3
50
+ },
43
51
  "expected": "THEDEVILISINTHEDETAILS"
44
52
  },
45
53
  {
46
54
  "description": "decode with five rails",
47
55
  "property": "decode",
48
- "msg": "EIEXMSMESAORIWSCE",
49
- "rails": 5,
56
+ "input": {
57
+ "msg": "EIEXMSMESAORIWSCE",
58
+ "rails": 5
59
+ },
50
60
  "expected": "EXERCISMISAWESOME"
51
61
  },
52
62
  {
53
63
  "description": "decode with six rails",
54
64
  "property": "decode",
55
- "msg": "133714114238148966225439541018335470986172518171757571896261",
56
- "rails": 6,
65
+ "input": {
66
+ "msg": "133714114238148966225439541018335470986172518171757571896261",
67
+ "rails": 6
68
+ },
57
69
  "expected": "112358132134558914423337761098715972584418167651094617711286"
58
70
  }
59
71
  ]
@@ -1,113 +1,149 @@
1
1
  {
2
2
  "exercise": "raindrops",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "cases": [
5
5
  {
6
6
  "description": "the sound for 1 is 1",
7
7
  "property": "convert",
8
- "number": 1,
8
+ "input": {
9
+ "number": 1
10
+ },
9
11
  "expected": "1"
10
12
  },
11
13
  {
12
14
  "description": "the sound for 3 is Pling",
13
15
  "property": "convert",
14
- "number": 3,
16
+ "input": {
17
+ "number": 3
18
+ },
15
19
  "expected": "Pling"
16
20
  },
17
21
  {
18
22
  "description": "the sound for 5 is Plang",
19
23
  "property": "convert",
20
- "number": 5,
24
+ "input": {
25
+ "number": 5
26
+ },
21
27
  "expected": "Plang"
22
28
  },
23
29
  {
24
30
  "description": "the sound for 7 is Plong",
25
31
  "property": "convert",
26
- "number": 7,
32
+ "input": {
33
+ "number": 7
34
+ },
27
35
  "expected": "Plong"
28
36
  },
29
37
  {
30
38
  "description": "the sound for 6 is Pling as it has a factor 3",
31
39
  "property": "convert",
32
- "number": 6,
40
+ "input": {
41
+ "number": 6
42
+ },
33
43
  "expected": "Pling"
34
44
  },
35
45
  {
36
46
  "description": "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base",
37
47
  "property": "convert",
38
- "number": 8,
48
+ "input": {
49
+ "number": 8
50
+ },
39
51
  "expected": "8"
40
52
  },
41
53
  {
42
54
  "description": "the sound for 9 is Pling as it has a factor 3",
43
55
  "property": "convert",
44
- "number": 9,
56
+ "input": {
57
+ "number": 9
58
+ },
45
59
  "expected": "Pling"
46
60
  },
47
61
  {
48
62
  "description": "the sound for 10 is Plang as it has a factor 5",
49
63
  "property": "convert",
50
- "number": 10,
64
+ "input": {
65
+ "number": 10
66
+ },
51
67
  "expected": "Plang"
52
68
  },
53
69
  {
54
70
  "description": "the sound for 14 is Plong as it has a factor of 7",
55
71
  "property": "convert",
56
- "number": 14,
72
+ "input": {
73
+ "number": 14
74
+ },
57
75
  "expected": "Plong"
58
76
  },
59
77
  {
60
78
  "description": "the sound for 15 is PlingPlang as it has factors 3 and 5",
61
79
  "property": "convert",
62
- "number": 15,
80
+ "input": {
81
+ "number": 15
82
+ },
63
83
  "expected": "PlingPlang"
64
84
  },
65
85
  {
66
86
  "description": "the sound for 21 is PlingPlong as it has factors 3 and 7",
67
87
  "property": "convert",
68
- "number": 21,
88
+ "input": {
89
+ "number": 21
90
+ },
69
91
  "expected": "PlingPlong"
70
92
  },
71
93
  {
72
94
  "description": "the sound for 25 is Plang as it has a factor 5",
73
95
  "property": "convert",
74
- "number": 25,
96
+ "input": {
97
+ "number": 25
98
+ },
75
99
  "expected": "Plang"
76
100
  },
77
101
  {
78
102
  "description": "the sound for 27 is Pling as it has a factor 3",
79
103
  "property": "convert",
80
- "number": 27,
104
+ "input": {
105
+ "number": 27
106
+ },
81
107
  "expected": "Pling"
82
108
  },
83
109
  {
84
110
  "description": "the sound for 35 is PlangPlong as it has factors 5 and 7",
85
111
  "property": "convert",
86
- "number": 35,
112
+ "input": {
113
+ "number": 35
114
+ },
87
115
  "expected": "PlangPlong"
88
116
  },
89
117
  {
90
118
  "description": "the sound for 49 is Plong as it has a factor 7",
91
119
  "property": "convert",
92
- "number": 49,
120
+ "input": {
121
+ "number": 49
122
+ },
93
123
  "expected": "Plong"
94
124
  },
95
125
  {
96
126
  "description": "the sound for 52 is 52",
97
127
  "property": "convert",
98
- "number": 52,
128
+ "input": {
129
+ "number": 52
130
+ },
99
131
  "expected": "52"
100
132
  },
101
133
  {
102
134
  "description": "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7",
103
135
  "property": "convert",
104
- "number": 105,
136
+ "input": {
137
+ "number": 105
138
+ },
105
139
  "expected": "PlingPlangPlong"
106
140
  },
107
141
  {
108
142
  "description": "the sound for 3125 is Plang as it has a factor 5",
109
143
  "property": "convert",
110
- "number": 3125,
144
+ "input": {
145
+ "number": 3125
146
+ },
111
147
  "expected": "Plang"
112
148
  }
113
149
  ]
@@ -0,0 +1,374 @@
1
+ {
2
+ "exercise": "rational-numbers",
3
+ "version": "1.0.0",
4
+ "comments": [
5
+ " The canonical data assumes mathematically correct real ",
6
+ " numbers. The testsuites should consider rounding errors ",
7
+ " instead of testing for exact values for any non-integer ",
8
+ " tests. ",
9
+ " Rational numbers r are represented as arrays [a, b] so ",
10
+ " that r = a/b. "
11
+ ],
12
+ "cases": [
13
+ {
14
+ "description": "Arithmetic",
15
+ "cases": [
16
+ {
17
+ "description": "Addition",
18
+ "cases": [
19
+ {
20
+ "description": "Add two positive rational numbers",
21
+ "property": "add",
22
+ "input": {
23
+ "r1": [1, 2],
24
+ "r2": [2, 3]
25
+ },
26
+ "expected": [7, 6]
27
+ },
28
+ {
29
+ "description": "Add a positive rational number and a negative rational number",
30
+ "property": "add",
31
+ "input": {
32
+ "r1": [1, 2],
33
+ "r2": [-2, 3]
34
+ },
35
+ "expected": [-1, 6]
36
+ },
37
+ {
38
+ "description": "Add two negative rational numbers",
39
+ "property": "add",
40
+ "input": {
41
+ "r1": [-1, 2],
42
+ "r2": [-2, 3]
43
+ },
44
+ "expected": [-7, 6]
45
+ },
46
+ {
47
+ "description": "Add a rational number to its additive inverse",
48
+ "property": "add",
49
+ "input": {
50
+ "r1": [1, 2],
51
+ "r2": [-1, 2]
52
+ },
53
+ "expected": [0, 1]
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "description": "Subtraction",
59
+ "cases": [
60
+ {
61
+ "description": "Subtract two positive rational numbers",
62
+ "property": "sub",
63
+ "input": {
64
+ "r1": [1, 2],
65
+ "r2": [2, 3]
66
+ },
67
+ "expected": [-1, 6]
68
+ },
69
+ {
70
+ "description": "Subtract a positive rational number and a negative rational number",
71
+ "property": "sub",
72
+ "input": {
73
+ "r1": [1, 2],
74
+ "r2": [-2, 3]
75
+ },
76
+ "expected": [7, 6]
77
+ },
78
+ {
79
+ "description": "Subtract two negative rational numbers",
80
+ "property": "sub",
81
+ "input": {
82
+ "r1": [-1, 2],
83
+ "r2": [-2, 3]
84
+ },
85
+ "expected": [1, 6]
86
+ },
87
+ {
88
+ "description": "Subtract a rational number from itself",
89
+ "property": "sub",
90
+ "input": {
91
+ "r1": [1, 2],
92
+ "r2": [1, 2]
93
+ },
94
+ "expected": [0, 1]
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "description": "Multiplication",
100
+ "cases": [
101
+ {
102
+ "description": "Multiply two positive rational numbers",
103
+ "property": "mul",
104
+ "input": {
105
+ "r1": [1, 2],
106
+ "r2": [2, 3]
107
+ },
108
+ "expected": [1, 3]
109
+ },
110
+ {
111
+ "description": "Multiply a negative rational number by a positive rational number",
112
+ "property": "mul",
113
+ "input": {
114
+ "r1": [-1, 2],
115
+ "r2": [2, 3]
116
+ },
117
+ "expected": [-1, 3]
118
+ },
119
+ {
120
+ "description": "Multiply two negative rational numbers",
121
+ "property": "mul",
122
+ "input": {
123
+ "r1": [-1, 2],
124
+ "r2": [-2, 3]
125
+ },
126
+ "expected": [1, 3]
127
+ },
128
+ {
129
+ "description": "Multiply a rational number by its reciprocal",
130
+ "property": "mul",
131
+ "input": {
132
+ "r1": [1, 2],
133
+ "r2": [2, 1]
134
+ },
135
+ "expected": [1, 1]
136
+ },
137
+ {
138
+ "description": "Multiply a rational number by 1",
139
+ "property": "mul",
140
+ "input": {
141
+ "r1": [1, 2],
142
+ "r2": [1, 1]
143
+ },
144
+ "expected": [1, 2]
145
+ },
146
+ {
147
+ "description": "Multiply a rational number by 0",
148
+ "property": "mul",
149
+ "input": {
150
+ "r1": [1, 2],
151
+ "r2": [0, 1]
152
+ },
153
+ "expected": [0, 1]
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "description": "Division",
159
+ "cases": [
160
+ {
161
+ "description": "Divide two positive rational numbers",
162
+ "property": "div",
163
+ "input": {
164
+ "r1": [1, 2],
165
+ "r2": [2, 3]
166
+ },
167
+ "expected": [3, 4]
168
+ },
169
+ {
170
+ "description": "Divide a positive rational number by a negative rational number",
171
+ "property": "div",
172
+ "input": {
173
+ "r1": [1, 2],
174
+ "r2": [-2, 3]
175
+ },
176
+ "expected": [-3, 4]
177
+ },
178
+ {
179
+ "description": "Divide two negative rational numbers",
180
+ "property": "div",
181
+ "input": {
182
+ "r1": [-1, 2],
183
+ "r2": [-2, 3]
184
+ },
185
+ "expected": [3, 4]
186
+ },
187
+ {
188
+ "description": "Divide a rational number by 1",
189
+ "property": "div",
190
+ "input": {
191
+ "r1": [1, 2],
192
+ "r2": [1, 1]
193
+ },
194
+ "expected": [1, 2]
195
+ }
196
+ ]
197
+ }
198
+ ]
199
+ },
200
+ {
201
+ "description": "Absolute value",
202
+ "cases": [
203
+ {
204
+ "description": "Absolute value of a positive rational number",
205
+ "property": "abs",
206
+ "input": {
207
+ "r": [1, 2]
208
+ },
209
+ "expected": [1, 2]
210
+ },
211
+ {
212
+ "description": "Absolute value of a negative rational number",
213
+ "property": "abs",
214
+ "input": {
215
+ "r": [-1, 2]
216
+ },
217
+ "expected": [1, 2]
218
+ },
219
+ {
220
+ "description": "Absolute value of zero",
221
+ "property": "abs",
222
+ "input": {
223
+ "r": [0, 1]
224
+ },
225
+ "expected": [0, 1]
226
+ }
227
+ ]
228
+ },
229
+ {
230
+ "description": "Exponentiation of a rational number",
231
+ "cases": [
232
+ {
233
+ "description": "Raise a positive rational number to a positive integer power",
234
+ "property": "exprational",
235
+ "input": {
236
+ "r": [1, 2],
237
+ "n": 3
238
+ },
239
+ "expected": [1, 8]
240
+ },
241
+ {
242
+ "description": "Raise a negative rational number to a positive integer power",
243
+ "property": "exprational",
244
+ "input": {
245
+ "r": [-1, 2],
246
+ "n": 3
247
+ },
248
+ "expected": [-1, 8]
249
+ },
250
+ {
251
+ "description": "Raise zero to an integer power",
252
+ "property": "exprational",
253
+ "input": {
254
+ "r": [0, 1],
255
+ "n": 5
256
+ },
257
+ "expected": [0, 1]
258
+ },
259
+ {
260
+ "description": "Raise one to an integer power",
261
+ "property": "exprational",
262
+ "input": {
263
+ "r": [1, 1],
264
+ "n": 4
265
+ },
266
+ "expected": [1, 1]
267
+ },
268
+ {
269
+ "description": "Raise a positive rational number to the power of zero",
270
+ "property": "exprational",
271
+ "input": {
272
+ "r": [1, 2],
273
+ "n": 0
274
+ },
275
+ "expected": [1, 1]
276
+ },
277
+ {
278
+ "description": "Raise a negative rational number to the power of zero",
279
+ "property": "exprational",
280
+ "input": {
281
+ "r": [-1, 2],
282
+ "n": 0
283
+ },
284
+ "expected": [1, 1]
285
+ }
286
+ ]
287
+ },
288
+ {
289
+ "description": "Exponentiation of a real number to a rational number",
290
+ "cases": [
291
+ {
292
+ "description": "Raise a real number to a positive rational number",
293
+ "property": "expreal",
294
+ "input": {
295
+ "x": 8,
296
+ "r": [4, 3]
297
+ },
298
+ "expected": 16.0
299
+ },
300
+ {
301
+ "description": "Raise a real number to a negative rational number",
302
+ "property": "expreal",
303
+ "input": {
304
+ "x": 9,
305
+ "r": [-1, 2]
306
+ },
307
+ "expected": 0.3333333333333333
308
+ },
309
+ {
310
+ "description": "Raise a real number to a zero rational number",
311
+ "property": "expreal",
312
+ "input": {
313
+ "x": 2,
314
+ "r": [0, 1]
315
+ },
316
+ "expected": 1.0
317
+ }
318
+ ]
319
+ },
320
+ {
321
+ "description": "Reduction to lowest terms",
322
+ "cases": [
323
+ {
324
+ "description": "Reduce a positive rational number to lowest terms",
325
+ "property": "reduce",
326
+ "input": {
327
+ "r": [2, 4]
328
+ },
329
+ "expected": [1, 2]
330
+ },
331
+ {
332
+ "description": "Reduce a negative rational number to lowest terms",
333
+ "property": "reduce",
334
+ "input": {
335
+ "r": [-4, 6]
336
+ },
337
+ "expected": [-2, 3]
338
+ },
339
+ {
340
+ "description": "Reduce a rational number with a negative denominator to lowest terms",
341
+ "property": "reduce",
342
+ "input": {
343
+ "r": [3, -9]
344
+ },
345
+ "expected": [-1, 3]
346
+ },
347
+ {
348
+ "description": "Reduce zero to lowest terms",
349
+ "property": "reduce",
350
+ "input": {
351
+ "r": [0, 6]
352
+ },
353
+ "expected": [0, 1]
354
+ },
355
+ {
356
+ "description": "Reduce an integer to lowest terms",
357
+ "property": "reduce",
358
+ "input": {
359
+ "r": [-14, 7]
360
+ },
361
+ "expected": [-2, 1]
362
+ },
363
+ {
364
+ "description": "Reduce one to lowest terms",
365
+ "property": "reduce",
366
+ "input": {
367
+ "r": [13, 13]
368
+ },
369
+ "expected": [1, 1]
370
+ }
371
+ ]
372
+ }
373
+ ]
374
+ }