trackler 2.2.1.73 → 2.2.1.74

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/rna-transcription/canonical-data.json +1 -31
  4. data/problem-specifications/exercises/secret-handshake/metadata.yml +1 -1
  5. data/tracks/csharp/config.json +10 -0
  6. data/tracks/csharp/exercises/Exercises.sln +7 -1
  7. data/tracks/csharp/exercises/armstrong-numbers/ArmstrongNumbers.cs +9 -0
  8. data/tracks/csharp/exercises/armstrong-numbers/ArmstrongNumbers.csproj +17 -0
  9. data/tracks/csharp/exercises/armstrong-numbers/ArmstrongNumbersTest.cs +54 -0
  10. data/tracks/csharp/exercises/armstrong-numbers/Example.cs +18 -0
  11. data/tracks/csharp/exercises/armstrong-numbers/README.md +10 -0
  12. data/tracks/csharp/exercises/bob/BobTest.cs +2 -2
  13. data/tracks/csharp/exercises/bob/Example.cs +2 -0
  14. data/tracks/csharp/exercises/book-store/BookStoreTest.cs +8 -1
  15. data/tracks/csharp/exercises/change/README.md +1 -1
  16. data/tracks/csharp/exercises/rna-transcription/RnaTranscriptionTest.cs +1 -20
  17. data/tracks/csharp/exercises/secret-handshake/README.md +1 -1
  18. data/tracks/csharp/exercises/word-count/WordCountTest.cs +12 -0
  19. data/tracks/csharp/generators/Exercises/ArmstrongNumbers.cs +6 -0
  20. data/tracks/dart/config.json +4 -3
  21. data/tracks/dart/config/maintainers.json +3 -3
  22. data/tracks/delphi/exercises/armstrong-numbers/uArmstrongNumbersExample.pas +13 -10
  23. data/tracks/delphi/exercises/rna-transcription/uTestRnaTranscription.pas +4 -28
  24. data/tracks/ecmascript/config.json +5 -5
  25. data/tracks/fsharp/config.json +11 -0
  26. data/tracks/fsharp/exercises/Exercises.sln +6 -0
  27. data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbers.fs +3 -0
  28. data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbers.fsproj +23 -0
  29. data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbersTest.fs +41 -0
  30. data/tracks/fsharp/exercises/armstrong-numbers/Example.fs +7 -0
  31. data/tracks/fsharp/exercises/armstrong-numbers/Program.fs +1 -0
  32. data/tracks/fsharp/exercises/armstrong-numbers/README.md +15 -0
  33. data/tracks/fsharp/exercises/change/README.md +1 -1
  34. data/tracks/fsharp/exercises/secret-handshake/README.md +1 -1
  35. data/tracks/fsharp/generators/Common.fs +1 -0
  36. data/tracks/fsharp/generators/Generators.fs +7 -0
  37. data/tracks/go/exercises/secret-handshake/README.md +1 -1
  38. data/tracks/idris/.travis.yml +23 -3
  39. data/tracks/idris/bin/fetch-exercism-infra.sh +121 -0
  40. data/tracks/idris/bin/fetch-stack.sh +11 -0
  41. data/tracks/idris/bin/solve_exercises.sh +59 -0
  42. data/tracks/idris/config.json +6 -0
  43. data/tracks/idris/exercises/hello-world/src/HelloWorld.idr +4 -0
  44. data/tracks/java/exercises/reverse-string/src/main/java/ReverseString.java +1 -1
  45. data/tracks/javascript/.eslintignore +0 -7
  46. data/tracks/javascript/config.json +11 -0
  47. data/tracks/javascript/exercises/anagram/example.js +2 -2
  48. data/tracks/javascript/exercises/circular-buffer/circular-buffer.spec.js +1 -1
  49. data/tracks/javascript/exercises/circular-buffer/example.js +1 -1
  50. data/tracks/javascript/exercises/pangram/example.js +5 -4
  51. data/tracks/javascript/exercises/say/example.js +5 -2
  52. data/tracks/javascript/exercises/scrabble-score/example.js +2 -3
  53. data/tracks/javascript/exercises/secret-handshake/README.md +1 -1
  54. data/tracks/javascript/exercises/triangle/example.js +3 -2
  55. data/tracks/javascript/exercises/trinary/example.js +1 -1
  56. data/tracks/javascript/exercises/two-fer/README.md +41 -0
  57. data/tracks/javascript/exercises/two-fer/example.js +10 -0
  58. data/tracks/javascript/exercises/two-fer/two-fer.js +12 -0
  59. data/tracks/javascript/exercises/two-fer/two-fer.spec.js +18 -0
  60. data/tracks/kotlin/exercises/secret-handshake/README.md +1 -1
  61. data/tracks/perl6/exercises/rna-transcription/Example.pm6 +1 -2
  62. data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +1 -1
  63. data/tracks/perl6/exercises/rna-transcription/example.yaml +3 -10
  64. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +4 -40
  65. data/tracks/php/exercises/hamming/hamming_test.php +2 -1
  66. data/tracks/python/config.json +12 -0
  67. data/tracks/python/exercises/armstrong-numbers/README.md +28 -0
  68. data/tracks/python/exercises/armstrong-numbers/armstrong_numbers.py +2 -0
  69. data/tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py +36 -0
  70. data/tracks/python/exercises/armstrong-numbers/example.py +2 -0
  71. data/tracks/python/exercises/protein-translation/example.py +1 -1
  72. data/tracks/python/exercises/protein-translation/protein_translation.py +1 -5
  73. data/tracks/python/exercises/protein-translation/protein_translation_test.py +30 -19
  74. data/tracks/ruby/exercises/secret-handshake/README.md +1 -1
  75. data/tracks/rust/exercises/simple-linked-list/.meta/hints.md +2 -3
  76. data/tracks/rust/exercises/simple-linked-list/README.md +3 -3
  77. data/tracks/swift/config.json +13 -0
  78. data/tracks/swift/exercises/protein-translation/Package.swift +5 -0
  79. data/tracks/swift/exercises/protein-translation/README.md +56 -0
  80. data/tracks/swift/exercises/protein-translation/Sources/ProteinTranslation.swift +1 -0
  81. data/tracks/swift/exercises/protein-translation/Sources/ProteinTranslationExample.swift +54 -0
  82. data/tracks/swift/exercises/protein-translation/Tests/LinuxMain.swift +6 -0
  83. data/tracks/swift/exercises/protein-translation/Tests/ProteinTranslationTests/ProteinTranslationTests.swift +83 -0
  84. metadata +32 -2
@@ -1,5 +1,11 @@
1
1
  {
2
2
  "active": false,
3
+ "deprecated": [
4
+
5
+ ],
6
+ "foregone": [
7
+
8
+ ],
3
9
  "exercises": [
4
10
  {
5
11
  "core": false,
@@ -0,0 +1,4 @@
1
+ module HelloWorld
2
+
3
+ export
4
+ greet : Maybe String -> String
@@ -1,6 +1,6 @@
1
1
  class ReverseString {
2
2
 
3
- String reverse() {
3
+ String reverse(String stringToReverse) {
4
4
  throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
5
5
  }
6
6
 
@@ -1,11 +1,9 @@
1
1
  big-integer.js
2
2
  exercises/alphametics
3
- exercises/anagram
4
3
  exercises/binary-search
5
4
  exercises/binary-search-tree
6
5
  exercises/bowling
7
6
  exercises/bracket-push
8
- exercises/circular-buffer
9
7
  exercises/clock
10
8
  exercises/custom-set
11
9
  exercises/flatten-array
@@ -22,7 +20,6 @@ exercises/minesweeper
22
20
  exercises/nth-prime
23
21
  exercises/octal
24
22
  exercises/palindrome-products
25
- exercises/pangram
26
23
  exercises/perfect-numbers
27
24
  exercises/pythagorean-triplet
28
25
  exercises/queen-attack
@@ -30,10 +27,6 @@ exercises/robot-name
30
27
  exercises/robot-simulator
31
28
  exercises/roman-numerals
32
29
  exercises/saddle-points
33
- exercises/say
34
- exercises/scrabble-score
35
30
  exercises/secret-handshake
36
31
  exercises/simple-cipher
37
32
  exercises/simple-linked-list
38
- exercises/triangle
39
- exercises/trinary
@@ -13,6 +13,17 @@
13
13
  ],
14
14
  "uuid": "4756cfc9-7509-4783-8be7-60e3376b8256"
15
15
  },
16
+ {
17
+ "core": false,
18
+ "difficulty": 1,
19
+ "slug": "two-fer",
20
+ "topics": [
21
+ "strings",
22
+ "control-flow-(conditionals)"
23
+ ],
24
+ "unlocked_by": "hello-world",
25
+ "uuid": "5f3d1326-f0c5-44a6-b90a-6af3b7d455f1"
26
+ },
16
27
  {
17
28
  "core": true,
18
29
  "difficulty": 1,
@@ -4,8 +4,8 @@ function Anagram(word) {
4
4
  this.word = word;
5
5
  }
6
6
 
7
- Anagram.prototype.matches = function (words) {
8
- words = Array.isArray(words) ? words : [].slice.call(arguments, 0);
7
+ Anagram.prototype.matches = function (wordList) {
8
+ var words = Array.isArray(wordList) ? wordList : [].slice.call(arguments, 0);
9
9
 
10
10
  return words.filter(function (candidate) {
11
11
  return !sameWord(this.word, candidate) && isAnagram(this.word, candidate);
@@ -57,7 +57,7 @@ describe('CircularBuffer', function () {
57
57
  xit('writes of undefined or null don\'t occupy buffer', function () {
58
58
  var buffer = circularBuffer(3);
59
59
  buffer.write(null);
60
- buffer.write(undefined);
60
+ buffer.write(undefined); // eslint-disable-line no-undefined
61
61
  [1, 2, 3].map(function (i) { buffer.write(i.toString()); });
62
62
  expect(buffer.read()).toBe('1');
63
63
  });
@@ -68,7 +68,7 @@ function CircularBuffer(capacity) {
68
68
  }
69
69
 
70
70
  function isEmpty(data) {
71
- return data === null || data === undefined;
71
+ return !data;
72
72
  }
73
73
  }
74
74
 
@@ -1,9 +1,10 @@
1
- var notAlpha = /[^a-z]+/gi,
2
- ALPHA_LENGTH = 26,
3
- cleaned,
4
- unique;
5
1
 
6
2
  var Pangram = function (candidate) {
3
+ var notAlpha = /[^a-z]+/gi;
4
+ var ALPHA_LENGTH = 26;
5
+ var cleaned;
6
+ var unique;
7
+
7
8
  unique = {};
8
9
  cleaned = (candidate.replace(notAlpha, '')).toLowerCase();
9
10
  cleaned.split('').forEach(function (el) {
@@ -41,7 +41,8 @@ var bigNumbers = {
41
41
  };
42
42
 
43
43
  function bigPart(number) {
44
- var factor, result = '';
44
+ var factor;
45
+ var result = '';
45
46
  for (var bigNumber = 1000000000; bigNumber >= 1000; bigNumber /= 1000) {
46
47
  if (number.current >= bigNumber) {
47
48
  factor = Math.floor(number.current / bigNumber);
@@ -58,6 +59,7 @@ function sayDecade(n) {
58
59
  return decades[decade] + '-' + smallNumbers[n - decade];
59
60
  }
60
61
  }
62
+ throw new Error('Number must be between 10 and 99.');
61
63
  }
62
64
 
63
65
  function twoDigit(n) {
@@ -78,7 +80,8 @@ function threeDigit(n) {
78
80
  }
79
81
 
80
82
  exports.inEnglish = function (n) {
81
- var result, number = {current: n};
83
+ var result;
84
+ var number = {current: n};
82
85
  if (n >= 0 && n < 1000000000000) {
83
86
  result = bigPart(number);
84
87
  result += threeDigit(number.current);
@@ -14,9 +14,8 @@ function letterScore(letter) {
14
14
  return letterScores[letter] || 0;
15
15
  }
16
16
 
17
- module.exports = function (word) {
18
- word || (word = '');
19
- word = word.toLowerCase();
17
+ module.exports = function (wrd) {
18
+ var word = wrd ? wrd.toLowerCase() : '';
20
19
 
21
20
  var sum = 0;
22
21
  var idx = -1;
@@ -53,7 +53,7 @@ changing `xit` to `it`.
53
53
 
54
54
  ## Source
55
55
 
56
- Bert, in Mary Poppins [http://www.imdb.com/character/ch0011238/quotes](http://www.imdb.com/character/ch0011238/quotes)
56
+ Bert, in Mary Poppins [http://www.imdb.com/title/tt0058331/quotes/qt0437047](http://www.imdb.com/title/tt0058331/quotes/qt0437047)
57
57
 
58
58
  ## Submitting Incomplete Solutions
59
59
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -22,7 +22,6 @@ function Triangle(a, b, c) {
22
22
  };
23
23
 
24
24
  this.violatesInequality = function () {
25
- var a = this.sides[0], b = this.sides[1], c = this.sides[2];
26
25
  return (a + b < c) || (a + c < b) || (b + c < a);
27
26
  };
28
27
 
@@ -50,7 +49,9 @@ function Triangle(a, b, c) {
50
49
  var uniqueSides = [];
51
50
 
52
51
  for (var uniqueSide in uniques) {
53
- uniqueSides.push(uniqueSide);
52
+ if (uniques.hasOwnProperty(uniqueSide)) {
53
+ uniqueSides.push(uniqueSide);
54
+ }
54
55
  }
55
56
 
56
57
  return uniqueSides;
@@ -14,5 +14,5 @@ Trinary.prototype.toDecimal = function () {
14
14
  };
15
15
 
16
16
  Trinary.prototype.accumulator = function (decimal, digit, index) {
17
- return decimal += digit * Math.pow(BASE, index);
17
+ return decimal + digit * Math.pow(BASE, index);
18
18
  };
@@ -0,0 +1,41 @@
1
+ # Two Fer
2
+
3
+ `Two-fer` or `2-fer` is short for two for one. One for you and one for me.
4
+
5
+ ```
6
+ "One for X, one for me."
7
+ ```
8
+
9
+ When X is a name or "you".
10
+
11
+ If the given name is "Alice", the result should be "One for Alice, one for me."
12
+ If no name is given, the result should be "One for you, one for me."
13
+
14
+ ## Setup
15
+
16
+ Go through the setup instructions for JavaScript to
17
+ install the necessary dependencies:
18
+
19
+ http://exercism.io/languages/javascript
20
+
21
+ ## Making the Test Suite Pass
22
+
23
+ Execute the tests with:
24
+
25
+ jasmine <exercise-name>.spec.js
26
+
27
+ Replace `<exercise-name>` with the name of the current exercise. E.g., to
28
+ test the Two Fer exercise:
29
+
30
+ jasmine two-fer.spec.js
31
+
32
+ All tests but the first have been skipped. Once you get a test passing,
33
+ you can unskip the next one by changing `xit` to `it`.
34
+
35
+ ## Source
36
+
37
+ This is an exercise to introduce users to basic programming constructs, just after 'Hello World'. [https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer)
38
+
39
+ ## Submitting Incomplete Solutions
40
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
41
+
@@ -0,0 +1,10 @@
1
+ var TwoFer = function () {};
2
+
3
+ TwoFer.prototype.twoFer = function (who) {
4
+ if (who) {
5
+ return 'One for ' + who + ', one for me.';
6
+ }
7
+ return 'One for you, one for me.';
8
+ };
9
+
10
+ module.exports = TwoFer;
@@ -0,0 +1,12 @@
1
+ var TwoFer = function () {};
2
+
3
+ TwoFer.prototype.twoFer = function (who) {
4
+ // your code goes here
5
+ // You will have to use the parameter who
6
+ // in some way. In this example, it is just
7
+ // returned, but your solution will have to
8
+ // use a conditional.
9
+ return who;
10
+ };
11
+
12
+ module.exports = TwoFer;
@@ -0,0 +1,18 @@
1
+
2
+ var TwoFer = require('./two-fer');
3
+
4
+ describe('Two Fer', function () {
5
+ var twoFer = new TwoFer();
6
+
7
+ it('gives one to you if no parameter given', function () {
8
+ expect(twoFer.twoFer()).toEqual('One for you, one for me.');
9
+ });
10
+
11
+ xit('gives one to Alice if \'Alice\' is given', function () {
12
+ expect(twoFer.twoFer('Alice')).toEqual('One for Alice, one for me.');
13
+ });
14
+
15
+ xit('gives one to Bob if \'Bob\' is given', function () {
16
+ expect(twoFer.twoFer('Bob')).toEqual('One for Bob, one for me.');
17
+ });
18
+ });
@@ -32,7 +32,7 @@ has caused the array to be reversed.
32
32
 
33
33
  ## Source
34
34
 
35
- Bert, in Mary Poppins [http://www.imdb.com/character/ch0011238/quotes](http://www.imdb.com/character/ch0011238/quotes)
35
+ Bert, in Mary Poppins [http://www.imdb.com/title/tt0058331/quotes/qt0437047](http://www.imdb.com/title/tt0058331/quotes/qt0437047)
36
36
 
37
37
  ## Submitting Incomplete Solutions
38
38
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -1,6 +1,5 @@
1
- unit module RNA:ver<1>;
1
+ unit module RNA:ver<2>;
2
2
 
3
3
  sub to-rna ($dna) is export {
4
- fail if $dna ~~ /<-[AGCT]>/;
5
4
  $dna.trans(<A G C T> => <U C G A>);
6
5
  }
@@ -1,4 +1,4 @@
1
- unit module RNA:ver<1>;
1
+ unit module RNA:ver<2>;
2
2
 
3
3
  sub to-rna ($dna) is export {
4
4
  }
@@ -1,20 +1,13 @@
1
1
  exercise: RNA
2
- version: 1
3
- plan: 10
2
+ version: 2
3
+ plan: 7
4
4
  imports: '&to-rna'
5
5
  tests: |-
6
- for @($c-data<cases>) {
7
- if .<expected> {
8
- is .<dna>.&to-rna, |.<expected description>;
9
- } else {
10
- throws-like {.<dna>.&to-rna}, Exception;
11
- }
12
- }
6
+ is .<dna>.&to-rna, |.<expected description> for $c-data<cases>.values;
13
7
 
14
8
  unit: module
15
9
  example: |-
16
10
  sub to-rna ($dna) is export {
17
- fail if $dna ~~ /<-[AGCT]>/;
18
11
  $dna.trans(<A G C T> => <U C G A>);
19
12
  }
20
13
  stub: |-
@@ -5,9 +5,9 @@ use lib my $dir = $?FILE.IO.dirname;
5
5
  use JSON::Fast;
6
6
 
7
7
  my Str:D $exercise := 'RNA';
8
- my Version:D $version = v1;
8
+ my Version:D $version = v2;
9
9
  my Str $module //= $exercise;
10
- plan 10;
10
+ plan 7;
11
11
 
12
12
  use-ok $module or bail-out;
13
13
  require ::($module);
@@ -22,32 +22,14 @@ if ::($exercise).^ver !~~ $version {
22
22
  require ::($module) <&to-rna>;
23
23
 
24
24
  my $c-data = from-json $=pod.pop.contents;
25
- for @($c-data<cases>) {
26
- if .<expected> {
27
- is .<dna>.&to-rna, |.<expected description>;
28
- } else {
29
- throws-like {.<dna>.&to-rna}, Exception;
30
- }
31
- }
25
+ is .<dna>.&to-rna, |.<expected description> for $c-data<cases>.values;
32
26
 
33
27
  =head2 Canonical Data
34
28
  =begin code
35
29
 
36
30
  {
37
31
  "exercise": "rna-transcription",
38
- "version": "1.0.1",
39
- "comments": [
40
- "Language implementations vary on the issue of invalid input data.",
41
- "A language may elect to simplify this task by only presenting valid",
42
- "test cases. For languages handling invalid input data as",
43
- "error conditions, invalid test cases are included here and are",
44
- "indicated with an expected value of null. Note however that null is",
45
- "simply an indication here in the JSON. Actually returning null from",
46
- "a rna-transcription function may or may not be idiomatic in a language.",
47
- "Language idioms of errors or exceptions should be followed.",
48
- "Alternative interpretations such as ignoring excess length at the end",
49
- "are not represented here."
50
- ],
32
+ "version": "1.1.0",
51
33
  "cases": [
52
34
  {
53
35
  "description": "RNA complement of cytosine is guanine",
@@ -78,24 +60,6 @@ for @($c-data<cases>) {
78
60
  "property": "toRna",
79
61
  "dna": "ACGTGGTCTTAA",
80
62
  "expected": "UGCACCAGAAUU"
81
- },
82
- {
83
- "description": "correctly handles invalid input (RNA instead of DNA)",
84
- "property": "toRna",
85
- "dna": "U",
86
- "expected": null
87
- },
88
- {
89
- "description": "correctly handles completely invalid DNA input",
90
- "property": "toRna",
91
- "dna": "XXX",
92
- "expected": null
93
- },
94
- {
95
- "description": "correctly handles partially invalid DNA input",
96
- "property": "toRna",
97
- "dna": "ACGTXXXCTTAA",
98
- "expected": null
99
63
  }
100
64
  ]
101
65
  }
@@ -49,7 +49,8 @@ class HammingComparatorTest extends PHPUnit\Framework\TestCase
49
49
  public function testExceptionThrownWhenStrandsAreDifferentLength()
50
50
  {
51
51
  $this->markTestSkipped();
52
- $this->expectException('InvalidArgumentException', 'DNA strands must be of equal length.');
52
+ $this->expectException('InvalidArgumentException');
53
+ $this->expectExceptionMessage('DNA strands must be of equal length.');
53
54
  distance('GGACG', 'AGGACGTGG');
54
55
  }
55
56
  }
@@ -150,6 +150,18 @@
150
150
  "pattern_recognition"
151
151
  ]
152
152
  },
153
+ {
154
+ "uuid": "e9b0defc-dac5-11e7-9296-cec278b6b50a",
155
+ "slug": "armstrong-numbers",
156
+ "core": false,
157
+ "unlocked_by": null,
158
+ "difficulty": 1,
159
+ "topics": [
160
+ "mathematics",
161
+ "algorithms",
162
+ "loops"
163
+ ]
164
+ },
153
165
  {
154
166
  "uuid": "4c408aab-80b9-475d-9c06-b01cd0fcd08f",
155
167
  "slug": "rotational-cipher",