trackler 2.0.5.13 → 2.0.5.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/.travis.yml +1 -0
- data/common/bin/check_required_files_present +55 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/pascal/exercises/Hello-World/TestHelloWorld.dpr +60 -0
- data/tracks/pascal/exercises/Hello-World/TestHelloWorld.dproj +176 -0
- data/tracks/pascal/exercises/Hello-World/uHelloWorldExample.pas +24 -0
- data/tracks/pascal/exercises/Hello-World/uTestHelloWorld.pas +65 -0
- data/tracks/pascal/exercises/allergies/AllergyTests.dpr +60 -0
- data/tracks/pascal/exercises/allergies/AllergyTests.dproj +176 -0
- data/tracks/pascal/exercises/allergies/uAllergiesExample.pas +67 -0
- data/tracks/pascal/exercises/allergies/uAllergyTests.pas +177 -0
- data/tracks/pascal/exercises/bank-account/BankAccountTests.dpr +60 -0
- data/tracks/pascal/exercises/bank-account/BankAccountTests.dproj +176 -0
- data/tracks/pascal/exercises/bank-account/uBankAccountExample.pas +96 -0
- data/tracks/pascal/exercises/bank-account/uBankAccountTests.pas +140 -0
- data/tracks/pascal/exercises/beer-song/BeerSongTests.dpr +60 -0
- data/tracks/pascal/exercises/beer-song/BeerSongTests.dproj +176 -0
- data/tracks/pascal/exercises/beer-song/uBeerSongExample.pas +45 -0
- data/tracks/pascal/exercises/beer-song/uBeerSongTests.pas +84 -0
- data/tracks/pascal/exercises/binary-search/BinarySearchTest.dpr +60 -0
- data/tracks/pascal/exercises/binary-search/BinarySearchTest.dproj +176 -0
- data/tracks/pascal/exercises/binary-search/uBinarySearchExample.pas +40 -0
- data/tracks/pascal/exercises/binary-search/uBinarySearchTest.pas +132 -0
- data/tracks/pascal/exercises/bob/BobTests.dpr +60 -0
- data/tracks/pascal/exercises/bob/BobTests.dproj +176 -0
- data/tracks/pascal/exercises/bob/uBobExample.pas +47 -0
- data/tracks/pascal/exercises/bob/uBobTests.pas +180 -0
- data/tracks/pascal/exercises/book-store/BookStoreTests.dpr +60 -0
- data/tracks/pascal/exercises/book-store/BookStoreTests.dproj +176 -0
- data/tracks/pascal/exercises/book-store/uBookStoreExample.pas +144 -0
- data/tracks/pascal/exercises/book-store/uBookStoreTests.pas +56 -0
- data/tracks/pascal/exercises/bowling/BowlingTests.dpr +60 -0
- data/tracks/pascal/exercises/bowling/BowlingTests.dproj +176 -0
- data/tracks/pascal/exercises/bowling/uBowlingExample.pas +105 -0
- data/tracks/pascal/exercises/bowling/uBowlingTests.pas +101 -0
- data/tracks/pascal/exercises/circular-buffer/CircularBufferTests.dpr +60 -0
- data/tracks/pascal/exercises/circular-buffer/CircularBufferTests.dproj +176 -0
- data/tracks/pascal/exercises/circular-buffer/uCircularBufferExample.pas +72 -0
- data/tracks/pascal/exercises/circular-buffer/uCircularBufferTests.pas +249 -0
- data/tracks/pascal/exercises/clock/ClockTest.dpr +60 -0
- data/tracks/pascal/exercises/clock/ClockTest.dproj +176 -0
- data/tracks/pascal/exercises/clock/uClockExample.pas +54 -0
- data/tracks/pascal/exercises/clock/uClockTest.pas +157 -0
- data/tracks/pascal/exercises/etl/ETLtests.dpr +60 -0
- data/tracks/pascal/exercises/etl/ETLtests.dproj +176 -0
- data/tracks/pascal/exercises/etl/uETLexample.pas +25 -0
- data/tracks/pascal/exercises/etl/uETLtests.pas +191 -0
- data/tracks/pascal/exercises/hamming/Hamming.dpr +60 -0
- data/tracks/pascal/exercises/hamming/Hamming.dproj +176 -0
- data/tracks/pascal/exercises/hamming/uHammingExample.pas +24 -0
- data/tracks/pascal/exercises/hamming/uHammingTests.pas +165 -0
- data/tracks/pascal/exercises/leap/LeapTest.dpr +60 -0
- data/tracks/pascal/exercises/leap/LeapTest.dproj +176 -0
- data/tracks/pascal/exercises/leap/uLeapExample.pas +17 -0
- data/tracks/pascal/exercises/leap/uLeapTests.pas +81 -0
- data/tracks/pascal/exercises/nucleotide-count/NucleotideCountTest.dpr +60 -0
- data/tracks/pascal/exercises/nucleotide-count/NucleotideCountTest.dproj +176 -0
- data/tracks/pascal/exercises/nucleotide-count/uNucleotideCountExample.pas +72 -0
- data/tracks/pascal/exercises/nucleotide-count/uNucleotideCountTest.pas +190 -0
- data/tracks/pascal/exercises/perfect-numbers/PerfectNumbersTest.dpr +60 -0
- data/tracks/pascal/exercises/perfect-numbers/PerfectNumbersTest.dproj +176 -0
- data/tracks/pascal/exercises/perfect-numbers/uPerfectNumbersExample.pas +34 -0
- data/tracks/pascal/exercises/perfect-numbers/uPerfectNumbersTest.pas +48 -0
- data/tracks/pascal/exercises/phone-number/PhoneNumberTests.dpr +60 -0
- data/tracks/pascal/exercises/phone-number/PhoneNumberTests.dproj +176 -0
- data/tracks/pascal/exercises/phone-number/uPhoneNumberExample.pas +102 -0
- data/tracks/pascal/exercises/phone-number/uPhoneNumberTests.pas +138 -0
- data/tracks/php/exercises/variable-length-quantity/variable-length-quantity_test.php +1 -1
- data/tracks/ruby/Gemfile +0 -1
- data/tracks/ruby/Makefile +2 -1
- data/tracks/ruby/Rakefile +3 -0
- data/tracks/ruby/exercises/simple-linked-list/.meta/.version +1 -0
- data/tracks/ruby/exercises/simple-linked-list/example.rb +39 -48
- data/tracks/ruby/exercises/simple-linked-list/simple_linked_list_test.rb +99 -125
- data/tracks/ruby/exercises/wordy/.meta/.version +1 -0
- data/tracks/ruby/exercises/wordy/example.rb +4 -0
- data/tracks/ruby/exercises/wordy/example.tt +17 -0
- data/tracks/ruby/exercises/wordy/wordy_test.rb +66 -35
- data/tracks/ruby/lib/wordy_cases.rb +67 -0
- data/tracks/ruby/test/wordy_cases_test.rb +102 -0
- data/tracks/scala/config.json +7 -1
- data/tracks/scala/exercises/connect/{README.md → HINTS.md} +1 -12
- data/tracks/scala/exercises/connect/build.sbt +2 -2
- metadata +73 -3
@@ -122,7 +122,7 @@ class VariableLengthQuantityTest extends PHPUnit_Framework_TestCase
|
|
122
122
|
|
123
123
|
$this->setExpectedException(OverflowException::class);
|
124
124
|
|
125
|
-
vlq_decode([0xff, 0xff, 0xff, 0xff, 0xff]);
|
125
|
+
vlq_decode([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f]);
|
126
126
|
}
|
127
127
|
|
128
128
|
public function testChainedDecodeEncodeGivesOriginalBytes()
|
data/tracks/ruby/Gemfile
CHANGED
data/tracks/ruby/Makefile
CHANGED
data/tracks/ruby/Rakefile
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
1
|
@@ -1,68 +1,59 @@
|
|
1
1
|
class Element
|
2
|
-
attr_reader
|
2
|
+
attr_reader :datum
|
3
3
|
attr_accessor :next
|
4
|
-
|
5
|
-
|
6
|
-
@
|
7
|
-
@next = next_element
|
8
|
-
end
|
9
|
-
|
10
|
-
def tail?
|
11
|
-
@next.nil?
|
4
|
+
def initialize(value)
|
5
|
+
@datum = value
|
6
|
+
@next = nil
|
12
7
|
end
|
13
8
|
end
|
14
9
|
|
15
10
|
class SimpleLinkedList
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
def initialize
|
20
|
-
@head = nil
|
21
|
-
@size = 0
|
11
|
+
def initialize(array = [])
|
12
|
+
create_from_array(array)
|
22
13
|
end
|
23
14
|
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
15
|
+
def to_a
|
16
|
+
result = []
|
17
|
+
pointer = @head
|
18
|
+
while pointer
|
19
|
+
result << pointer.datum
|
20
|
+
pointer = pointer.next
|
21
|
+
end
|
22
|
+
result
|
32
23
|
end
|
33
24
|
|
34
|
-
def
|
35
|
-
|
25
|
+
def push(element)
|
26
|
+
element.next = @head unless @head.nil?
|
27
|
+
@head = element
|
28
|
+
self
|
36
29
|
end
|
37
30
|
|
38
31
|
def pop
|
39
|
-
|
40
|
-
@
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
32
|
+
element = @head
|
33
|
+
@head = element.next if element
|
34
|
+
element
|
35
|
+
end
|
36
|
+
|
37
|
+
def reverse!
|
38
|
+
previous = nil
|
39
|
+
pointer = @head
|
40
|
+
while pointer
|
41
|
+
temp = pointer.next
|
42
|
+
pointer.next = previous
|
43
|
+
previous = pointer
|
44
|
+
pointer = temp
|
50
45
|
end
|
46
|
+
@head = previous
|
47
|
+
self
|
51
48
|
end
|
52
49
|
|
53
|
-
|
54
|
-
each.to_a
|
55
|
-
end
|
50
|
+
private
|
56
51
|
|
57
|
-
def
|
58
|
-
each
|
52
|
+
def create_from_array(array)
|
53
|
+
array.each { |value| push(Element.new(value)) }
|
59
54
|
end
|
55
|
+
end
|
60
56
|
|
61
|
-
|
62
|
-
|
63
|
-
a.to_a.reverse_each do |item|
|
64
|
-
list.push(item)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
57
|
+
module BookKeeping
|
58
|
+
VERSION = 1
|
68
59
|
end
|
@@ -1,189 +1,163 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
gem 'minitest', '>= 5.0.0'
|
3
1
|
require 'minitest/autorun'
|
4
|
-
|
5
2
|
require_relative 'simple_linked_list'
|
6
3
|
|
7
4
|
class LinkedListTest < Minitest::Test
|
8
|
-
def
|
9
|
-
|
10
|
-
assert_equal 1,
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_element_tail
|
14
|
-
skip
|
15
|
-
e = Element.new(1)
|
16
|
-
assert e.tail?
|
5
|
+
def test_element
|
6
|
+
element = Element.new(1)
|
7
|
+
assert_equal 1, element.datum
|
17
8
|
end
|
18
9
|
|
19
|
-
def
|
10
|
+
def test_element_can_hold_a_different_value
|
20
11
|
skip
|
21
|
-
|
22
|
-
|
12
|
+
element = Element.new(10)
|
13
|
+
assert_equal 10, element.datum
|
23
14
|
end
|
24
15
|
|
25
|
-
def
|
16
|
+
def test_element_next
|
26
17
|
skip
|
27
|
-
|
28
|
-
|
29
|
-
assert_equal e1, e2.next
|
18
|
+
element = Element.new(1)
|
19
|
+
assert_nil element.next
|
30
20
|
end
|
31
21
|
|
32
|
-
def
|
22
|
+
def test_element_next_can_be_assigned_to
|
33
23
|
skip
|
34
|
-
|
35
|
-
|
24
|
+
first = Element.new(1)
|
25
|
+
second = Element.new(2)
|
26
|
+
first.next = second
|
27
|
+
assert_equal second, first.next
|
36
28
|
end
|
37
29
|
|
38
|
-
def
|
30
|
+
def test_list_push
|
39
31
|
skip
|
40
|
-
|
41
|
-
|
32
|
+
list = SimpleLinkedList.new
|
33
|
+
element = Element.new(1)
|
34
|
+
assert_equal list, list.push(element)
|
42
35
|
end
|
43
36
|
|
44
|
-
def
|
37
|
+
def test_list_pop
|
45
38
|
skip
|
46
|
-
|
47
|
-
|
48
|
-
|
39
|
+
list = SimpleLinkedList.new
|
40
|
+
element = Element.new(1)
|
41
|
+
list.push(element)
|
42
|
+
assert_equal element, list.pop
|
49
43
|
end
|
50
44
|
|
51
|
-
def
|
45
|
+
def test_list_pop_empty
|
52
46
|
skip
|
53
|
-
|
54
|
-
|
55
|
-
refute l.empty?
|
47
|
+
list = SimpleLinkedList.new
|
48
|
+
assert_nil list.pop
|
56
49
|
end
|
57
50
|
|
58
|
-
def
|
51
|
+
def test_list_pop_is_last_in_first_out
|
59
52
|
skip
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
53
|
+
list = SimpleLinkedList.new
|
54
|
+
first = Element.new(1)
|
55
|
+
second = Element.new(2)
|
56
|
+
list.push(first).push(second)
|
57
|
+
assert_equal second, list.pop
|
64
58
|
end
|
65
59
|
|
66
|
-
def
|
60
|
+
def test_list_empty_to_array
|
67
61
|
skip
|
68
|
-
|
69
|
-
|
62
|
+
list = SimpleLinkedList.new
|
63
|
+
assert_equal [], list.to_a
|
70
64
|
end
|
71
65
|
|
72
|
-
def
|
66
|
+
def test_list_single_to_array
|
73
67
|
skip
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
assert_equal 1,
|
78
|
-
assert l.head.tail?
|
68
|
+
list = SimpleLinkedList.new
|
69
|
+
first = Element.new(1)
|
70
|
+
list.push(first)
|
71
|
+
assert_equal [1], list.to_a
|
79
72
|
end
|
80
73
|
|
81
|
-
def
|
74
|
+
def test_list_multiple_to_array
|
82
75
|
skip
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
assert_equal 1,
|
76
|
+
list = SimpleLinkedList.new
|
77
|
+
first = Element.new(1)
|
78
|
+
second = Element.new(2)
|
79
|
+
third = Element.new(3)
|
80
|
+
list.push(first).push(second).push(third)
|
81
|
+
assert_equal [3,2,1], list.to_a
|
89
82
|
end
|
90
83
|
|
91
|
-
def
|
84
|
+
def test_list_create_from_array
|
92
85
|
skip
|
93
|
-
|
94
|
-
(
|
95
|
-
|
96
|
-
end
|
97
|
-
assert_equal 10, l.size
|
98
|
-
assert_equal 10, l.peek
|
86
|
+
array = [1,2,3]
|
87
|
+
list = SimpleLinkedList.new(array)
|
88
|
+
assert_equal [3,2,1], list.to_a
|
99
89
|
end
|
100
90
|
|
101
|
-
def
|
91
|
+
def test_list_created_from_array_still_made_up_of_elements
|
102
92
|
skip
|
103
|
-
|
104
|
-
|
105
|
-
assert_equal
|
106
|
-
assert_equal 0, l.size
|
93
|
+
array = [1,2,3]
|
94
|
+
list = SimpleLinkedList.new(array)
|
95
|
+
assert_equal Element, list.pop.class
|
107
96
|
end
|
108
97
|
|
109
|
-
def
|
98
|
+
def test_list_from_array_still_acts_as_lifo
|
110
99
|
skip
|
111
|
-
|
112
|
-
(
|
113
|
-
|
114
|
-
|
115
|
-
6.times { l.pop }
|
116
|
-
assert_equal 4, l.size
|
117
|
-
assert_equal 4, l.peek
|
100
|
+
array = [1,2,3]
|
101
|
+
list = SimpleLinkedList.new(array)
|
102
|
+
element = list.pop
|
103
|
+
assert_equal 3, element.datum
|
118
104
|
end
|
119
105
|
|
120
|
-
def
|
106
|
+
def test_list_in_place_reverse!
|
121
107
|
skip
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
def test_from_a_nil
|
128
|
-
skip
|
129
|
-
l = SimpleLinkedList.from_a(nil)
|
130
|
-
assert_equal 0, l.size
|
131
|
-
assert_nil l.peek
|
132
|
-
end
|
108
|
+
first = Element.new(1)
|
109
|
+
second = Element.new(2)
|
110
|
+
third = Element.new(3)
|
111
|
+
list = SimpleLinkedList.new
|
112
|
+
list.push(first).push(second).push(third)
|
133
113
|
|
134
|
-
|
135
|
-
skip
|
136
|
-
l = SimpleLinkedList.from_a([1, 2])
|
137
|
-
assert_equal 2, l.size
|
138
|
-
assert_equal 1, l.peek
|
139
|
-
assert_equal 2, l.head.next.datum
|
114
|
+
assert_equal [1,2,3], list.reverse!.to_a
|
140
115
|
end
|
141
116
|
|
142
|
-
def
|
117
|
+
def test_list_in_place_reverse_are_the_same_elements
|
143
118
|
skip
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
end
|
119
|
+
first = Element.new(1)
|
120
|
+
second = Element.new(2)
|
121
|
+
list = SimpleLinkedList.new
|
122
|
+
list.push(first).push(second)
|
149
123
|
|
150
|
-
|
151
|
-
skip
|
152
|
-
l = SimpleLinkedList.new
|
153
|
-
assert_equal [], l.to_a
|
154
|
-
end
|
124
|
+
list.reverse!
|
155
125
|
|
156
|
-
|
157
|
-
|
158
|
-
assert_equal [1], SimpleLinkedList.from_a([1]).to_a
|
126
|
+
assert_equal first, list.pop
|
127
|
+
assert_equal second, list.pop
|
159
128
|
end
|
160
129
|
|
161
|
-
def
|
130
|
+
def test_list_reverse_empty_list
|
162
131
|
skip
|
163
|
-
|
132
|
+
list = SimpleLinkedList.new
|
133
|
+
assert_equal list, list.reverse!
|
164
134
|
end
|
165
135
|
|
166
|
-
def
|
136
|
+
def test_works_for_1_through_10
|
167
137
|
skip
|
168
|
-
list = SimpleLinkedList.
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
assert_equal 2, list_r.peek
|
173
|
-
assert_equal 1, list_r.head.next.datum
|
174
|
-
assert list_r.head.next.tail?
|
138
|
+
list = SimpleLinkedList.new(1..10)
|
139
|
+
expected = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
|
140
|
+
assert_equal expected, list.to_a
|
175
141
|
end
|
176
142
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
143
|
+
# Problems in exercism evolve over time, as we find better ways to ask
|
144
|
+
# questions.
|
145
|
+
# The version number refers to the version of the problem you solved,
|
146
|
+
# not your solution.
|
147
|
+
#
|
148
|
+
# Define a constant named VERSION inside of the top level BookKeeping
|
149
|
+
# module.
|
150
|
+
# In your file, it will look like this:
|
151
|
+
#
|
152
|
+
# module BookKeeping
|
153
|
+
# VERSION = 1 # Where the version number matches the one in the test.
|
154
|
+
# end
|
155
|
+
#
|
156
|
+
# If you are curious, read more about constants on RubyDoc:
|
157
|
+
# http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html
|
183
158
|
|
184
|
-
def
|
159
|
+
def test_bookkeeping
|
185
160
|
skip
|
186
|
-
|
187
|
-
assert_equal data, SimpleLinkedList.from_a(data).to_a
|
161
|
+
assert_equal 1, BookKeeping::VERSION
|
188
162
|
end
|
189
163
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
1
|