trackler 2.2.1.93 → 2.2.1.94

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e97ec67bfca10eb667d516f743d6f555611f2cc2
4
- data.tar.gz: '01340854e48597e11cfbac9018dd7d9ecf7b2395'
3
+ metadata.gz: 7bf65140f147f38adddac427e899c2e20f97eb93
4
+ data.tar.gz: 4b58f27e23a153b83d44af7f4cdeee152341117a
5
5
  SHA512:
6
- metadata.gz: bdd6bfc70d06fd7084c145e86db492c4a2b8ccb70b7e9456deed587d53ae8c978e40cc822b0455c092aadef17cc05fff1ac3ba5867197bd029d00fe6fe006d19
7
- data.tar.gz: 4cb7b21baec9d68a22a657e1edd3fc583c708908214c62ab928dec901a197af34db4f245386758ebbcc399965b7a77e8ccb89da0dac6f1dd2f0e4b1deaff6948
6
+ metadata.gz: defc96de7f89ca0c6882c644629709982d51af65e7face2c824080c30aabcfa427824197a27f9a9dae1105cda3ced991b3a8d09fee5733463561c4bd28fc35c2
7
+ data.tar.gz: 6d15b7b62d516e7c8b594b6aa97b71c68411da5ae6b36da72dfef80666e3b4dca83845dbfedf2e7d62a724a399d6ed7664811c9f44eaba77cac517139cecd44f
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.93"
2
+ VERSION = "2.2.1.94"
3
3
  end
@@ -4,9 +4,6 @@
4
4
  {{- with .Hints }}
5
5
  {{ . }}
6
6
  {{ end }}
7
- {{- with .TrackInsert }}
8
- {{ . }}
9
- {{ end }}
10
7
  {{- with .Spec.Credits -}}
11
8
  ## Source
12
9
 
@@ -24,8 +24,10 @@ type js struct {
24
24
  Description string
25
25
  Cases []struct {
26
26
  Description string
27
- Input string
28
- Expected string
27
+ Input struct {
28
+ Birthdate string
29
+ }
30
+ Expected string
29
31
  }
30
32
  }
31
33
  }
@@ -43,7 +45,7 @@ var addCases = []struct {
43
45
  }{
44
46
  {{range .Cases}}{
45
47
  {{printf "%q" .Description}},
46
- {{printf "%q" .Input}},
48
+ {{printf "%q" .Input.Birthdate}},
47
49
  {{printf "%q" .Expected}},
48
50
  },
49
51
  {{end}}{{end}}
@@ -1,8 +1,8 @@
1
1
  package gigasecond
2
2
 
3
3
  // Source: exercism/problem-specifications
4
- // Commit: 61e7d70 Fix "Gigasecond: Schema Compliance"
5
- // Problem Specifications Version: 1.0.0
4
+ // Commit: 5506bac gigasecond: Apply new "input" policy
5
+ // Problem Specifications Version: 1.1.0
6
6
 
7
7
  // Add one gigasecond to the input.
8
8
  var addCases = []struct {
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.3.0
@@ -28,14 +28,6 @@ public class AcronymTest {
28
28
  assertEquals(expected, new Acronym(phrase).get());
29
29
  }
30
30
 
31
- @Ignore("Remove to run test")
32
- @Test
33
- public void allCapsWords() {
34
- final String phrase = "PHP: Hypertext Preprocessor";
35
- final String expected = "PHP";
36
- assertEquals(expected, new Acronym(phrase).get());
37
- }
38
-
39
31
  @Ignore("Remove to run test")
40
32
  @Test
41
33
  public void NonAcronymAllCapsWord() {
@@ -46,7 +38,7 @@ public class AcronymTest {
46
38
 
47
39
  @Ignore("Remove to run test")
48
40
  @Test
49
- public void hyphenated() {
41
+ public void punctuationWithoutWhitespace() {
50
42
  final String phrase = "Complementary metal-oxide semiconductor";
51
43
  final String expected = "CMOS";
52
44
  assertEquals(expected, new Acronym(phrase).get());
@@ -13,7 +13,7 @@ Please see the [contributing guide](https://github.com/exercism/docs/blob/master
13
13
 
14
14
  ### Implementing an exercise
15
15
 
16
- A pool of exercises can be found in the [x-Common repo](https://github.com/exercism/x-common).
16
+ A pool of exercises can be found in the [problem-specifications repo](https://github.com/exercism/problem-specifications).
17
17
 
18
18
  Exercises for the Julia track go in the `exercises` directory and should follow the following filename conventions:
19
19
 
@@ -4,9 +4,6 @@
4
4
  {{- with .Hints }}
5
5
  {{ . }}
6
6
  {{ end }}
7
- {{- with .TrackInsert }}
8
- {{ . }}
9
- {{ end }}
10
7
  {{- with .Spec.Credits -}}
11
8
 
12
9
  ## Source
@@ -14,4 +14,4 @@ jobs:
14
14
  - run:
15
15
  name: Danger Systems
16
16
  when: on_success
17
- command: danger
17
+ command: danger || true # Dont fail build on non zero exit codes
@@ -411,6 +411,21 @@
411
411
  "unlocked_by": null,
412
412
  "uuid": "72bd3b46-c3ed-4399-a925-9b616cfa1e9b"
413
413
  },
414
+ {
415
+ "core": false,
416
+ "difficulty": 3,
417
+ "slug": "circular-buffer",
418
+ "topics": [
419
+ "arrays",
420
+ "control-flow-(conditionals)",
421
+ "control-flow-(loops)",
422
+ "data-structures",
423
+ "exception-handling",
424
+ "lists"
425
+ ],
426
+ "unlocked_by": null,
427
+ "uuid": "f5499564-62b9-47ab-9ba2-8be6ba453269"
428
+ },
414
429
  {
415
430
  "core": false,
416
431
  "difficulty": 4,
@@ -0,0 +1,4 @@
1
+ .DS_Store
2
+ /.build
3
+ /Packages
4
+ /*.xcodeproj
@@ -0,0 +1,5 @@
1
+ import PackageDescription
2
+
3
+ let package = Package(
4
+ name: "CircularBuffer"
5
+ )
@@ -0,0 +1,57 @@
1
+ # Circular Buffer
2
+
3
+ A circular buffer, cyclic buffer or ring buffer is a data structure that
4
+ uses a single, fixed-size buffer as if it were connected end-to-end.
5
+
6
+ A circular buffer first starts empty and of some predefined length. For
7
+ example, this is a 7-element buffer:
8
+
9
+ [ ][ ][ ][ ][ ][ ][ ]
10
+
11
+ Assume that a 1 is written into the middle of the buffer (exact starting
12
+ location does not matter in a circular buffer):
13
+
14
+ [ ][ ][ ][1][ ][ ][ ]
15
+
16
+ Then assume that two more elements are added — 2 & 3 — which get
17
+ appended after the 1:
18
+
19
+ [ ][ ][ ][1][2][3][ ]
20
+
21
+ If two elements are then removed from the buffer, the oldest values
22
+ inside the buffer are removed. The two elements removed, in this case,
23
+ are 1 & 2, leaving the buffer with just a 3:
24
+
25
+ [ ][ ][ ][ ][ ][3][ ]
26
+
27
+ If the buffer has 7 elements then it is completely full:
28
+
29
+ [6][7][8][9][3][4][5]
30
+
31
+ When the buffer is full an error will be raised, alerting the client
32
+ that further writes are blocked until a slot becomes free.
33
+
34
+ The client can opt to overwrite the oldest data with a forced write. In
35
+ this case, two more elements — A & B — are added and they overwrite the
36
+ 3 & 4:
37
+
38
+ [6][7][8][9][A][B][5]
39
+
40
+ Finally, if two elements are now removed then what would be returned is
41
+ not 3 & 4 but 5 & 6 because A & B overwrote the 3 & the 4 yielding the
42
+ buffer with:
43
+
44
+ [ ][7][8][9][A][B][ ]
45
+
46
+ ## Setup
47
+
48
+ Go through the project setup instructions for Xcode using Swift:
49
+
50
+ http://exercism.io/languages/swift
51
+
52
+ ## Source
53
+
54
+ Wikipedia [http://en.wikipedia.org/wiki/Circular_buffer](http://en.wikipedia.org/wiki/Circular_buffer)
55
+
56
+ ## Submitting Incomplete Solutions
57
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1 @@
1
+ //Solution goes in Sources
@@ -0,0 +1,66 @@
1
+ import Foundation
2
+
3
+ enum CircularBufferError: Error {
4
+ case bufferFull
5
+ case bufferEmpty
6
+ }
7
+
8
+ struct CircularBuffer<T: Equatable> {
9
+ var buffer: [T?]
10
+ let capacity: Int
11
+ var writePoint = 0
12
+ var readPoint = 0
13
+
14
+ private var isFull: Bool {
15
+ return buffer.flatMap { $0 }.count >= capacity
16
+ }
17
+
18
+ private var isEmpty: Bool {
19
+ return buffer.flatMap { $0 }.isEmpty
20
+ }
21
+
22
+ init(capacity: Int) {
23
+ self.capacity = capacity
24
+ buffer = [T?](repeating: nil, count: capacity)
25
+ }
26
+
27
+ mutating func write(_ data: T) throws {
28
+ guard !isFull else {
29
+ throw CircularBufferError.bufferFull
30
+ }
31
+
32
+ buffer[writePoint] = data
33
+ updateWritePoint()
34
+ }
35
+
36
+ mutating func overwrite(_ data: T) {
37
+ buffer[writePoint] = data
38
+ if isFull && writePoint == readPoint {
39
+ updateReadPoint()
40
+ }
41
+ updateWritePoint()
42
+ }
43
+
44
+ mutating func read() throws -> T {
45
+ guard let data = buffer[readPoint] else {
46
+ throw CircularBufferError.bufferEmpty
47
+ }
48
+
49
+ buffer[readPoint] = nil
50
+ updateReadPoint()
51
+
52
+ return data
53
+ }
54
+
55
+ mutating func clear() {
56
+ buffer = [T?](repeating: nil, count: capacity)
57
+ }
58
+
59
+ private mutating func updateWritePoint() {
60
+ writePoint = (writePoint + 1) % capacity
61
+ }
62
+
63
+ private mutating func updateReadPoint() {
64
+ readPoint = (readPoint + 1) % capacity
65
+ }
66
+ }
@@ -0,0 +1,134 @@
1
+ import XCTest
2
+ @testable import CircularBuffer
3
+
4
+ class CircularBufferTests: XCTestCase {
5
+
6
+ func testReadEmptyBufferThrowsBufferEmptyException() {
7
+ var buffer = CircularBuffer<Int>(capacity: 1)
8
+
9
+ XCTAssertThrowsError(try buffer.read()) { error in
10
+ XCTAssertEqual(error as? CircularBufferError, .bufferEmpty)
11
+ }
12
+ }
13
+
14
+ func testWriteAndReadBackOneItem() {
15
+ var buffer = CircularBuffer<Int>(capacity: 1)
16
+ try? buffer.write(1)
17
+ XCTAssertEqual(try? buffer.read(), 1)
18
+ XCTAssertThrowsError(try buffer.read()) { error in
19
+ XCTAssertEqual(error as? CircularBufferError, .bufferEmpty)
20
+ }
21
+ }
22
+
23
+ func testWriteAndReadBackMultipleItems() {
24
+ var buffer = CircularBuffer<Int>(capacity: 2)
25
+ try? buffer.write(1)
26
+ try? buffer.write(2)
27
+ XCTAssertEqual(try? buffer.read(), 1)
28
+ XCTAssertEqual(try? buffer.read(), 2)
29
+ XCTAssertThrowsError(try buffer.read()) { error in
30
+ XCTAssertEqual(error as? CircularBufferError, .bufferEmpty)
31
+ }
32
+ }
33
+
34
+ func testClearingBuffer() {
35
+ var buffer = CircularBuffer<Int>(capacity: 3)
36
+ (1...3).forEach {
37
+ try? buffer.write($0)
38
+ }
39
+ buffer.clear()
40
+ XCTAssertThrowsError(try buffer.read()) { error in
41
+ XCTAssertEqual(error as? CircularBufferError, .bufferEmpty)
42
+ }
43
+ try? buffer.write(1)
44
+ try? buffer.write(2)
45
+ XCTAssertEqual(try? buffer.read(), 1)
46
+ try? buffer.write(3)
47
+ XCTAssertEqual(try? buffer.read(), 2)
48
+ }
49
+
50
+ func testAlternateWriteAndRead() {
51
+ var buffer = CircularBuffer<Int>(capacity: 2)
52
+ try? buffer.write(1)
53
+ XCTAssertEqual(try? buffer.read(), 1)
54
+ try? buffer.write(2)
55
+ XCTAssertEqual(try? buffer.read(), 2)
56
+ }
57
+
58
+ func testReadsBackOldestItem() {
59
+ var buffer = CircularBuffer<Int>(capacity: 3)
60
+ try? buffer.write(1)
61
+ try? buffer.write(2)
62
+ XCTAssertEqual(try? buffer.read(), 1)
63
+ try? buffer.write(3)
64
+ XCTAssertEqual(try? buffer.read(), 2)
65
+ XCTAssertEqual(try? buffer.read(), 3)
66
+ }
67
+
68
+ func testWritingToAFullBufferThrowsAnException() {
69
+ var buffer = CircularBuffer<String>(capacity: 2)
70
+ try? buffer.write("1")
71
+ try? buffer.write("2")
72
+ XCTAssertThrowsError(try buffer.write("A")) { error in
73
+ XCTAssertEqual(error as? CircularBufferError, .bufferFull)
74
+ }
75
+ }
76
+
77
+ func testOverwritingOldestItemInAFullBuffer() {
78
+ var buffer = CircularBuffer<String>(capacity: 2)
79
+ try? buffer.write("1")
80
+ try? buffer.write("2")
81
+ buffer.overwrite("A")
82
+ XCTAssertEqual(try? buffer.read(), "2")
83
+ XCTAssertEqual(try? buffer.read(), "A")
84
+ XCTAssertThrowsError(try buffer.read()) { error in
85
+ XCTAssertEqual(error as? CircularBufferError, .bufferEmpty)
86
+ }
87
+ }
88
+
89
+ func testForcedWritesToNonFullBufferShouldBehaveLikeWrites() {
90
+ var buffer = CircularBuffer<String>(capacity: 2)
91
+ buffer.overwrite("1")
92
+ buffer.overwrite("2")
93
+ XCTAssertEqual(try? buffer.read(), "1")
94
+ XCTAssertEqual(try? buffer.read(), "2")
95
+ XCTAssertThrowsError(try buffer.read()) { error in
96
+ XCTAssertEqual(error as? CircularBufferError, .bufferEmpty)
97
+ }
98
+ }
99
+
100
+ func testAlternateReadAndWriteIntoBufferOverflow() {
101
+ var buffer = CircularBuffer<Int>(capacity: 5)
102
+ (1...3).forEach { try? buffer.write($0) }
103
+ _ = try? buffer.read()
104
+ _ = try? buffer.read()
105
+ _ = try? buffer.write(4)
106
+ _ = try? buffer.read()
107
+ (5...8).forEach { try? buffer.write($0) }
108
+ buffer.overwrite(9)
109
+ buffer.overwrite(10)
110
+ (6...8).forEach {
111
+ XCTAssertEqual(try? buffer.read(), $0)
112
+ }
113
+ XCTAssertEqual(try? buffer.read(), 9)
114
+ XCTAssertEqual(try? buffer.read(), 10)
115
+ XCTAssertThrowsError(try buffer.read()) { error in
116
+ XCTAssertEqual(error as? CircularBufferError, .bufferEmpty)
117
+ }
118
+ }
119
+
120
+ static var allTests: [(String, (CircularBufferTests) -> () throws -> Void)] {
121
+ return [
122
+ ("testReadEmptyBufferThrowsBufferEmptyException", testReadEmptyBufferThrowsBufferEmptyException),
123
+ ("testWriteAndReadBackOneItem", testWriteAndReadBackOneItem),
124
+ ("testWriteAndReadBackMultipleItems", testWriteAndReadBackMultipleItems),
125
+ ("testClearingBuffer", testClearingBuffer),
126
+ ("testAlternateWriteAndRead", testAlternateWriteAndRead),
127
+ ("testReadsBackOldestItem", testReadsBackOldestItem),
128
+ ("testWritingToAFullBufferThrowsAnException", testWritingToAFullBufferThrowsAnException),
129
+ ("testOverwritingOldestItemInAFullBuffer", testOverwritingOldestItemInAFullBuffer),
130
+ ("testForcedWritesToNonFullBufferShouldBehaveLikeWrites", testForcedWritesToNonFullBufferShouldBehaveLikeWrites),
131
+ ("testAlternateReadAndWriteIntoBufferOverflow", testAlternateReadAndWriteIntoBufferOverflow),
132
+ ]
133
+ }
134
+ }
@@ -0,0 +1,6 @@
1
+ import XCTest
2
+ @testable import CircularBufferTests
3
+
4
+ XCTMain([
5
+ testCase(CircularBufferTests.allTests),
6
+ ])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1.93
4
+ version: 2.2.1.94
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-16 00:00:00.000000000 Z
11
+ date: 2018-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -1415,7 +1415,6 @@ files:
1415
1415
  - tracks/clojure/config/exercise_readme.go.tmpl
1416
1416
  - tracks/clojure/config/maintainers.json
1417
1417
  - tracks/clojure/docs/ABOUT.org
1418
- - tracks/clojure/docs/EXERCISE_README_INSERT.md
1419
1418
  - tracks/clojure/docs/INSTALLATION.org
1420
1419
  - tracks/clojure/docs/LEARNING.org
1421
1420
  - tracks/clojure/docs/RESOURCES.org
@@ -1553,7 +1552,7 @@ files:
1553
1552
  - tracks/clojure/exercises/hamming/src/example.clj
1554
1553
  - tracks/clojure/exercises/hamming/src/hamming.clj
1555
1554
  - tracks/clojure/exercises/hamming/test/hamming_test.clj
1556
- - tracks/clojure/exercises/hello-world/HINTS.md
1555
+ - tracks/clojure/exercises/hello-world/.meta/hints.md
1557
1556
  - tracks/clojure/exercises/hello-world/README.md
1558
1557
  - tracks/clojure/exercises/hello-world/project.clj
1559
1558
  - tracks/clojure/exercises/hello-world/src/example.clj
@@ -7976,7 +7975,7 @@ files:
7976
7975
  - tracks/javascript/exercises/hamming/README.md
7977
7976
  - tracks/javascript/exercises/hamming/example.js
7978
7977
  - tracks/javascript/exercises/hamming/hamming.spec.js
7979
- - tracks/javascript/exercises/hello-world/HINTS.md
7978
+ - tracks/javascript/exercises/hello-world/.meta/hints.md
7980
7979
  - tracks/javascript/exercises/hello-world/README.md
7981
7980
  - tracks/javascript/exercises/hello-world/example.js
7982
7981
  - tracks/javascript/exercises/hello-world/hello-world.js
@@ -8165,7 +8164,6 @@ files:
8165
8164
  - tracks/julia/config/exercise_readme.go.tmpl
8166
8165
  - tracks/julia/config/maintainers.json
8167
8166
  - tracks/julia/docs/ABOUT.md
8168
- - tracks/julia/docs/EXERCISE_README_INSERT.md
8169
8167
  - tracks/julia/docs/INSTALLATION.md
8170
8168
  - tracks/julia/docs/LEARNING.md
8171
8169
  - tracks/julia/docs/RESOURCES.md
@@ -13630,6 +13628,13 @@ files:
13630
13628
  - tracks/swift/exercises/bracket-push/Sources/BracketPushExample.swift
13631
13629
  - tracks/swift/exercises/bracket-push/Tests/BracketPushTests/BracketPushTests.swift
13632
13630
  - tracks/swift/exercises/bracket-push/Tests/LinuxMain.swift
13631
+ - tracks/swift/exercises/circular-buffer/.gitignore
13632
+ - tracks/swift/exercises/circular-buffer/Package.swift
13633
+ - tracks/swift/exercises/circular-buffer/README.md
13634
+ - tracks/swift/exercises/circular-buffer/Sources/CircularBuffer.swift
13635
+ - tracks/swift/exercises/circular-buffer/Sources/CircularBufferExample.swift
13636
+ - tracks/swift/exercises/circular-buffer/Tests/CircularBufferTests/CircularBufferTests.swift
13637
+ - tracks/swift/exercises/circular-buffer/Tests/LinuxMain.swift
13633
13638
  - tracks/swift/exercises/clock/.gitignore
13634
13639
  - tracks/swift/exercises/clock/Package.swift
13635
13640
  - tracks/swift/exercises/clock/README.md
File without changes
File without changes