trackler 2.0.3.0 → 2.0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/fixtures/common/exercises/no-metadata/description.md +1 -0
  3. data/lib/trackler/problem.rb +12 -0
  4. data/lib/trackler/problems.rb +8 -12
  5. data/lib/trackler/version.rb +1 -1
  6. data/tracks/bash/README.md +2 -0
  7. data/tracks/c/config.json +9 -2
  8. data/tracks/c/exercises/sieve/makefile +15 -0
  9. data/tracks/c/exercises/sieve/src/example.c +50 -0
  10. data/tracks/c/exercises/sieve/src/sieve.h +10 -0
  11. data/tracks/c/exercises/sieve/test/test_sieve.c +113 -0
  12. data/tracks/c/exercises/sieve/test/vendor/unity.c +1300 -0
  13. data/tracks/c/exercises/sieve/test/vendor/unity.h +274 -0
  14. data/tracks/c/exercises/sieve/test/vendor/unity_internals.h +701 -0
  15. data/tracks/coffeescript/.travis.yml +1 -0
  16. data/tracks/coldfusion/.travis.yml +1 -0
  17. data/tracks/crystal/Makefile +18 -15
  18. data/tracks/crystal/README.md +5 -5
  19. data/tracks/crystal/config.json +6 -0
  20. data/tracks/crystal/exercises/acronym/src/acronym.cr +1 -0
  21. data/tracks/crystal/exercises/anagram/src/anagram.cr +1 -0
  22. data/tracks/crystal/exercises/atbash-cipher/src/atbash_cipher.cr +1 -0
  23. data/tracks/crystal/exercises/binary/src/binary.cr +1 -0
  24. data/tracks/crystal/exercises/bob/src/bob.cr +1 -0
  25. data/tracks/crystal/exercises/bracket-push/src/bracket_push.cr +1 -0
  26. data/tracks/crystal/exercises/difference-of-squares/spec/difference_of_squares_spec.cr +44 -0
  27. data/tracks/crystal/exercises/difference-of-squares/src/example.cr +15 -0
  28. data/tracks/crystal/exercises/forth/src/forth.cr +1 -0
  29. data/tracks/crystal/exercises/gigasecond/src/gigasecond.cr +1 -0
  30. data/tracks/crystal/exercises/hamming/src/hamming.cr +1 -0
  31. data/tracks/crystal/exercises/hello-world/src/hello_world.cr +1 -0
  32. data/tracks/crystal/exercises/largest-series-product/src/largest_series_product.cr +1 -0
  33. data/tracks/crystal/exercises/leap/src/leap.cr +1 -0
  34. data/tracks/crystal/exercises/pangram/src/pangram.cr +1 -0
  35. data/tracks/crystal/exercises/raindrops/src/raindrops.cr +1 -0
  36. data/tracks/crystal/exercises/react/src/react.cr +1 -0
  37. data/tracks/crystal/exercises/rna-transcription/src/rna_transcription.cr +1 -0
  38. data/tracks/crystal/exercises/roman-numerals/src/roman_numerals.cr +1 -0
  39. data/tracks/crystal/exercises/sieve/src/sieve.cr +1 -0
  40. data/tracks/crystal/src/generator/exercises/difference_of_squares.cr +39 -0
  41. data/tracks/go/exercises/allergies/allergies_test.go +2 -2
  42. data/tracks/go/exercises/anagram/anagram_test.go +3 -3
  43. data/tracks/go/exercises/grade-school/grade_school_test.go +3 -3
  44. data/tracks/go/exercises/secret-handshake/secret_handshake_test.go +1 -1
  45. data/tracks/java/config.json +13 -1
  46. data/tracks/java/exercises/binary-search-tree/build.gradle +18 -0
  47. data/tracks/java/exercises/binary-search-tree/src/example/java/BST.java +122 -0
  48. data/tracks/java/exercises/binary-search-tree/src/main/java/.keep +0 -0
  49. data/tracks/java/exercises/binary-search-tree/src/test/java/.keep +0 -0
  50. data/tracks/java/exercises/binary-search-tree/src/test/java/BSTTest.java +163 -0
  51. data/tracks/java/exercises/pythagorean-triplet/build.gradle +18 -0
  52. data/tracks/java/exercises/pythagorean-triplet/src/example/java/PythagoreanTriplet.java +117 -0
  53. data/tracks/java/exercises/pythagorean-triplet/src/main/java/PythagoreanTriplet.java +3 -0
  54. data/tracks/java/exercises/pythagorean-triplet/src/test/java/PythagoreanTripletTest.java +95 -0
  55. data/tracks/java/exercises/settings.gradle +2 -0
  56. data/tracks/julia/README.md +16 -0
  57. data/tracks/perl5/README.md +2 -0
  58. data/tracks/perl6/README.md +2 -1
  59. data/tracks/php/config.json +5 -0
  60. data/tracks/php/exercises/sieve/example.php +29 -0
  61. data/tracks/php/exercises/sieve/sieve_test.php +201 -0
  62. data/tracks/pony/.travis.yml +1 -0
  63. data/tracks/python/exercises/anagram/anagram_test.py +1 -0
  64. data/tracks/python/exercises/beer-song/beer_song_test.py +1 -0
  65. data/tracks/python/exercises/binary-search/binary_search_test.py +1 -0
  66. data/tracks/python/exercises/binary/binary_test.py +1 -0
  67. data/tracks/python/exercises/bob/bob_test.py +1 -0
  68. data/tracks/python/exercises/clock/clock_test.py +1 -0
  69. data/tracks/python/exercises/etl/etl_test.py +1 -0
  70. data/tracks/python/exercises/gigasecond/gigasecond_test.py +1 -0
  71. data/tracks/python/exercises/grains/grains_test.py +1 -0
  72. data/tracks/python/exercises/leap/leap_test.py +1 -0
  73. data/tracks/python/exercises/meetup/meetup_test.py +1 -0
  74. data/tracks/python/exercises/nucleotide-count/nucleotide_count_test.py +1 -0
  75. data/tracks/python/exercises/ocr-numbers/example.py +1 -0
  76. data/tracks/python/exercises/ocr-numbers/ocr_test.py +1 -0
  77. data/tracks/python/exercises/perfect-numbers/perfect_numbers_test.py +1 -0
  78. data/tracks/python/exercises/phone-number/phone_number_test.py +1 -0
  79. data/tracks/python/exercises/pig-latin/pig_latin_test.py +1 -0
  80. data/tracks/python/exercises/point-mutations/point_mutations_test.py +1 -0
  81. data/tracks/python/exercises/poker/poker_test.py +1 -0
  82. data/tracks/python/exercises/prime-factors/prime_factors_test.py +1 -0
  83. data/tracks/python/exercises/pythagorean-triplet/example.py +2 -3
  84. data/tracks/python/exercises/rail-fence-cipher/rail_fence_cipher_test.py +1 -0
  85. data/tracks/python/exercises/raindrops/raindrops_test.py +1 -0
  86. data/tracks/python/exercises/rectangles/rectangles_count_test.py +1 -0
  87. data/tracks/python/exercises/robot-simulator/robot_simulator_test.py +1 -0
  88. data/tracks/python/exercises/roman-numerals/roman_numerals_test.py +1 -0
  89. data/tracks/python/exercises/run-length-encoding/run_length_test.py +1 -0
  90. data/tracks/python/exercises/say/say_test.py +1 -0
  91. data/tracks/python/exercises/scrabble-score/scrabble_score_test.py +1 -0
  92. data/tracks/python/exercises/sieve/sieve_test.py +1 -0
  93. data/tracks/python/exercises/space-age/space_age_test.py +1 -0
  94. data/tracks/python/exercises/triangle/triangle_test.py +1 -0
  95. data/tracks/python/exercises/word-count/word_count_test.py +1 -0
  96. data/tracks/python/requirements-travis.txt +1 -1
  97. data/tracks/ruby/docs/24pullrequests.md +21 -0
  98. data/tracks/ruby/exercises/bowling/.version +1 -1
  99. data/tracks/ruby/exercises/bowling/bowling_test.rb +44 -15
  100. data/tracks/ruby/exercises/bowling/example.rb +10 -5
  101. data/tracks/ruby/exercises/bowling/example.tt +4 -2
  102. data/tracks/ruby/lib/bowling_cases.rb +1 -1
  103. data/tracks/scala/exercises/bank-account/HINTS.md +11 -0
  104. data/tracks/scala/exercises/bank-account/example.scala +2 -4
  105. data/tracks/scala/exercises/bank-account/src/main/scala/BankAccount.scala +13 -0
  106. data/tracks/scala/exercises/bank-account/src/test/scala/BankAccountTest.scala +5 -5
  107. data/tracks/scala/exercises/hamming/HINTS.md +57 -0
  108. data/tracks/scala/exercises/hello-world/HINTS.md +8 -0
  109. data/tracks/scala/exercises/nucleotide-count/HINTS.md +61 -0
  110. metadata +48 -2
@@ -1,5 +1,6 @@
1
1
  # xPerl6
2
2
 
3
+ [![Gitter](https://badges.gitter.im/exercism/xperl.svg)](https://gitter.im/exercism/xperl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
3
4
  Exercism exercises in Perl 6
4
5
 
5
6
  ## Contributing Guide
@@ -13,4 +14,4 @@ The MIT License (MIT)
13
14
  Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
14
15
 
15
16
  ### Perl 6 icon
16
- The Perl 6 "Camelia" logo is owned by Larry Wall and is released under version 2.0 of the Artistic License. We are using it to identify the Perl 6 language itself, not any part of Exercism, which we believe to be admissible under fair use. The version of the logo that we are using is a pink, black and white adaptation of the logo found on <http://en.wikipedia.org/wiki/Perl_6>.
17
+ The Perl 6 "Camelia" logo is owned by Larry Wall and is released under version 2.0 of the Artistic License. We are using it to identify the Perl 6 language itself, not any part of Exercism, which we believe to be admissible under fair use. The version of the logo that we are using is a pink, black and white adaptation of the logo found on <http://en.wikipedia.org/wiki/Perl_6>.
@@ -69,6 +69,11 @@
69
69
  "difficulty": 4,
70
70
  "topics": []
71
71
  },
72
+ {
73
+ "slug": "sieve",
74
+ "difficulty": 1,
75
+ "topics": []
76
+ },
72
77
  {
73
78
  "slug": "pig-latin",
74
79
  "difficulty": 4,
@@ -0,0 +1,29 @@
1
+ <?php
2
+ function sieve($number)
3
+ {
4
+ if ($number == 1) {
5
+ return [];
6
+ }
7
+ $candidates = _getNumbersFrom2To($number);
8
+ foreach ($candidates as $prime) {
9
+ foreach ($candidates as $key => $multiple) {
10
+ if (_areDifferent($multiple, $prime) && _areMultiples($multiple, $prime)) {
11
+ unset($candidates[$key]);
12
+ }
13
+ }
14
+ }
15
+ return array_values($candidates);
16
+ }
17
+ function _getNumbersFrom2To($number): array
18
+ {
19
+ $candidates = range(2, $number);
20
+ return $candidates;
21
+ }
22
+ function _areDifferent($multiple, $prime): bool
23
+ {
24
+ return ($multiple != $prime);
25
+ }
26
+ function _areMultiples($multiple, $prime): bool
27
+ {
28
+ return ($multiple % $prime == 0);
29
+ }
@@ -0,0 +1,201 @@
1
+ <?php
2
+ require "sieve.php";
3
+ class SieveTest extends PHPUnit_Framework_TestCase
4
+ {
5
+ public function testNoPrimesUnderTwo()
6
+ {
7
+ $this->assertEquals([], sieve(1));
8
+ }
9
+ public function testFindFirstPrime()
10
+ {
11
+ $this->markTestSkipped();
12
+ $this->assertEquals([2], sieve(2));
13
+ }
14
+ public function testFindPrimesUpTo10()
15
+ {
16
+ $this->markTestSkipped();
17
+ $this->assertEquals([2, 3, 5, 7], sieve(10));
18
+ }
19
+ public function testLimitIsPrime()
20
+ {
21
+ $this->markTestSkipped();
22
+ $this->assertEquals([2, 3, 5, 7, 11, 13], sieve(13));
23
+ }
24
+ public function testFindPrimesUpTo1000()
25
+ {
26
+ $this->markTestSkipped();
27
+ $this->assertEquals(
28
+ [
29
+ 2,
30
+ 3,
31
+ 5,
32
+ 7,
33
+ 11,
34
+ 13,
35
+ 17,
36
+ 19,
37
+ 23,
38
+ 29,
39
+ 31,
40
+ 37,
41
+ 41,
42
+ 43,
43
+ 47,
44
+ 53,
45
+ 59,
46
+ 61,
47
+ 67,
48
+ 71,
49
+ 73,
50
+ 79,
51
+ 83,
52
+ 89,
53
+ 97,
54
+ 101,
55
+ 103,
56
+ 107,
57
+ 109,
58
+ 113,
59
+ 127,
60
+ 131,
61
+ 137,
62
+ 139,
63
+ 149,
64
+ 151,
65
+ 157,
66
+ 163,
67
+ 167,
68
+ 173,
69
+ 179,
70
+ 181,
71
+ 191,
72
+ 193,
73
+ 197,
74
+ 199,
75
+ 211,
76
+ 223,
77
+ 227,
78
+ 229,
79
+ 233,
80
+ 239,
81
+ 241,
82
+ 251,
83
+ 257,
84
+ 263,
85
+ 269,
86
+ 271,
87
+ 277,
88
+ 281,
89
+ 283,
90
+ 293,
91
+ 307,
92
+ 311,
93
+ 313,
94
+ 317,
95
+ 331,
96
+ 337,
97
+ 347,
98
+ 349,
99
+ 353,
100
+ 359,
101
+ 367,
102
+ 373,
103
+ 379,
104
+ 383,
105
+ 389,
106
+ 397,
107
+ 401,
108
+ 409,
109
+ 419,
110
+ 421,
111
+ 431,
112
+ 433,
113
+ 439,
114
+ 443,
115
+ 449,
116
+ 457,
117
+ 461,
118
+ 463,
119
+ 467,
120
+ 479,
121
+ 487,
122
+ 491,
123
+ 499,
124
+ 503,
125
+ 509,
126
+ 521,
127
+ 523,
128
+ 541,
129
+ 547,
130
+ 557,
131
+ 563,
132
+ 569,
133
+ 571,
134
+ 577,
135
+ 587,
136
+ 593,
137
+ 599,
138
+ 601,
139
+ 607,
140
+ 613,
141
+ 617,
142
+ 619,
143
+ 631,
144
+ 641,
145
+ 643,
146
+ 647,
147
+ 653,
148
+ 659,
149
+ 661,
150
+ 673,
151
+ 677,
152
+ 683,
153
+ 691,
154
+ 701,
155
+ 709,
156
+ 719,
157
+ 727,
158
+ 733,
159
+ 739,
160
+ 743,
161
+ 751,
162
+ 757,
163
+ 761,
164
+ 769,
165
+ 773,
166
+ 787,
167
+ 797,
168
+ 809,
169
+ 811,
170
+ 821,
171
+ 823,
172
+ 827,
173
+ 829,
174
+ 839,
175
+ 853,
176
+ 857,
177
+ 859,
178
+ 863,
179
+ 877,
180
+ 881,
181
+ 883,
182
+ 887,
183
+ 907,
184
+ 911,
185
+ 919,
186
+ 929,
187
+ 937,
188
+ 941,
189
+ 947,
190
+ 953,
191
+ 967,
192
+ 971,
193
+ 977,
194
+ 983,
195
+ 991,
196
+ 997
197
+ ],
198
+ sieve(1000)
199
+ );
200
+ }
201
+ }
@@ -3,3 +3,4 @@ language: bash
3
3
  script:
4
4
  - bin/fetch-configlet
5
5
  - bin/configlet .
6
+ sudo: false
@@ -67,5 +67,6 @@ class AnagramTests(unittest.TestCase):
67
67
  detect_anagrams('go', 'go Go GO'.split())
68
68
  )
69
69
 
70
+
70
71
  if __name__ == '__main__':
71
72
  unittest.main()
@@ -66,5 +66,6 @@ class BeerTest(unittest.TestCase):
66
66
  "99 bottles of beer on the wall.\n\n"
67
67
  )
68
68
 
69
+
69
70
  if __name__ == '__main__':
70
71
  unittest.main()
@@ -37,5 +37,6 @@ class BinarySearchTests(unittest.TestCase):
37
37
  def test_empty_array(self):
38
38
  self.assertRaises(ValueError, binary_search, [], 1)
39
39
 
40
+
40
41
  if __name__ == '__main__':
41
42
  unittest.main()
@@ -44,5 +44,6 @@ class BinaryTests(unittest.TestCase):
44
44
  def test_invalid_binary_text_with_numbers(self):
45
45
  self.assertRaises(ValueError, parse_binary, "nope10")
46
46
 
47
+
47
48
  if __name__ == '__main__':
48
49
  unittest.main()
@@ -119,5 +119,6 @@ class BobTests(unittest.TestCase):
119
119
  'Whatever.', bob.hey('This is a statement with trailing whitespace ')
120
120
  )
121
121
 
122
+
122
123
  if __name__ == '__main__':
123
124
  unittest.main()
@@ -157,5 +157,6 @@ class ClockTest(unittest.TestCase):
157
157
  def test_clocks_with_negative_hours_and_minutes_that_wrap(self):
158
158
  self.assertEqual(Clock(18, 7), Clock(-54, -11513))
159
159
 
160
+
160
161
  if __name__ == '__main__':
161
162
  unittest.main()
@@ -49,5 +49,6 @@ class TransformTest(unittest.TestCase):
49
49
 
50
50
  self.assertEqual(expected, etl.transform(old))
51
51
 
52
+
52
53
  if __name__ == '__main__':
53
54
  unittest.main()
@@ -45,5 +45,6 @@ class GigasecondTest(unittest.TestCase):
45
45
  add_gigasecond(your_birthday)
46
46
  )
47
47
 
48
+
48
49
  if __name__ == '__main__':
49
50
  unittest.main()
@@ -32,5 +32,6 @@ class GrainsTest(unittest.TestCase):
32
32
  self.assertEqual(9223372036854775808, on_square(64))
33
33
  self.assertEqual(18446744073709551615, total_after(64))
34
34
 
35
+
35
36
  if __name__ == '__main__':
36
37
  unittest.main()
@@ -19,5 +19,6 @@ class YearTest(unittest.TestCase):
19
19
  def test_exceptional_century(self):
20
20
  self.assertIs(is_leap_year(2400), True)
21
21
 
22
+
22
23
  if __name__ == '__main__':
23
24
  unittest.main()
@@ -62,5 +62,6 @@ class MeetupTest(unittest.TestCase):
62
62
  self.assertRaises(MeetupDayException, meetup_day,
63
63
  2015, 2, 'Monday', '5th')
64
64
 
65
+
65
66
  if __name__ == '__main__':
66
67
  unittest.main()
@@ -37,5 +37,6 @@ class DNATest(unittest.TestCase):
37
37
  expected = {'A': 20, 'T': 21, 'G': 17, 'C': 12}
38
38
  self.assertEqual(expected, nucleotide_counts(dna))
39
39
 
40
+
40
41
  if __name__ == '__main__':
41
42
  unittest.main()
@@ -6,6 +6,7 @@ def split_ocr(ocr):
6
6
  return [[ocr[i][COL * j:COL * (j + 1)] for i in range(ROW)]
7
7
  for j in range(len(ocr[0]) // COL)]
8
8
 
9
+
9
10
  ALL = [' _ _ _ _ _ _ _ _ ',
10
11
  ' | _| _||_||_ |_ ||_||_|| |',
11
12
  ' ||_ _| | _||_| ||_| _||_|',
@@ -102,5 +102,6 @@ class OcrTest(unittest.TestCase):
102
102
  def test_invalid_grid(self):
103
103
  self.assertRaises(ValueError, grid, '123a')
104
104
 
105
+
105
106
  if __name__ == '__main__':
106
107
  unittest.main()
@@ -38,5 +38,6 @@ class PerfectNumbersTest(unittest.TestCase):
38
38
  def test_seventh_perfect_number(self):
39
39
  self.assertTrue(is_perfect(137438691328))
40
40
 
41
+
41
42
  if __name__ == '__main__':
42
43
  unittest.main()
@@ -36,5 +36,6 @@ class PhoneTest(unittest.TestCase):
36
36
  number = Phone("11234567890")
37
37
  self.assertEqual("(123) 456-7890", number.pretty())
38
38
 
39
+
39
40
  if __name__ == '__main__':
40
41
  unittest.main()
@@ -49,5 +49,6 @@ class PigLatinTests(unittest.TestCase):
49
49
  def test_word_beginning_with_xr(self):
50
50
  self.assertEqual("xrayay", translate("xray"))
51
51
 
52
+
52
53
  if __name__ == '__main__':
53
54
  unittest.main()
@@ -31,5 +31,6 @@ class DNATest(unittest.TestCase):
31
31
  self.assertEqual(5, hamming_distance('GACTACGGACAGGGTAGGGAAT',
32
32
  'GACATCGCACACC'))
33
33
 
34
+
34
35
  if __name__ == '__main__':
35
36
  unittest.main()
@@ -101,5 +101,6 @@ class PokerTest(unittest.TestCase):
101
101
  self.assertEqual([spadeStraightTo9, diamondStraightTo9],
102
102
  poker([spadeStraightTo9, diamondStraightTo9, threeOf4]))
103
103
 
104
+
104
105
  if __name__ == '__main__':
105
106
  unittest.main()
@@ -37,5 +37,6 @@ class PrimeFactorsTest(unittest.TestCase):
37
37
  def test_93819012551(self):
38
38
  self.assertEqual([11, 9539, 894119], prime_factors(93819012551))
39
39
 
40
+
40
41
  if __name__ == '__main__':
41
42
  unittest.main()
@@ -14,9 +14,7 @@ def primitive_triplets(nbr):
14
14
  factors = [(m, n) for m, n in zip(reversed(a), a) if m > n]
15
15
  ts = set()
16
16
  for m, n in factors:
17
- l = [nbr, m * m - n * n, m * m + n * n]
18
- l.sort()
19
- ts.update([tuple(l)])
17
+ ts.update([tuple(sorted([nbr, m * m - n * n, m * m + n * n]))])
20
18
  return ts
21
19
 
22
20
 
@@ -36,6 +34,7 @@ def triplets_in_range(m, n):
36
34
  t.update([(a, b, c)])
37
35
  return t
38
36
 
37
+
39
38
  primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
40
39
  67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137,
41
40
  139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211,
@@ -30,5 +30,6 @@ class RailFenceTests(unittest.TestCase):
30
30
  decode('133714114238148966225439541018335470986172518171757571896261', 6)
31
31
  )
32
32
 
33
+
33
34
  if __name__ == '__main__':
34
35
  unittest.main()