trackler 2.2.1.72 → 2.2.1.73
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/armstrong-numbers/canonical-data.json +70 -0
- data/problem-specifications/exercises/armstrong-numbers/description.md +10 -0
- data/problem-specifications/exercises/armstrong-numbers/metadata.yml +4 -0
- data/problem-specifications/exercises/bob/canonical-data.json +2 -2
- data/problem-specifications/exercises/bob/description.md +2 -0
- data/tracks/c/config.json +41 -41
- data/tracks/common-lisp/exercises/etl/README.md +1 -1
- data/tracks/common-lisp/exercises/isogram/README.md +1 -1
- data/tracks/delphi/config.json +10 -0
- data/tracks/delphi/config/maintainers.json +2 -2
- data/tracks/delphi/exercises/armstrong-numbers/ArmstrongNumbers.dpr +60 -0
- data/tracks/delphi/exercises/armstrong-numbers/README.md +39 -0
- data/tracks/delphi/exercises/armstrong-numbers/uArmstrongNumbersExample.pas +24 -0
- data/tracks/delphi/exercises/armstrong-numbers/uArmstrongNumbersTests.pas +101 -0
- data/tracks/delphi/exercises/bob/README.md +2 -0
- data/tracks/delphi/exercises/bob/uBobExample.pas +12 -3
- data/tracks/delphi/exercises/bob/uBobTests.pas +80 -23
- data/tracks/go/exercises/bob/README.md +2 -0
- data/tracks/go/exercises/bob/cases_test.go +3 -3
- data/tracks/go/exercises/bob/example.go +3 -0
- data/tracks/go/exercises/book-store/cases_test.go +7 -2
- data/tracks/go/exercises/word-count/cases_test.go +6 -1
- data/tracks/groovy/exercises/linked-list/README.md +1 -1
- data/tracks/haskell/.travis.yml +1 -0
- data/tracks/haskell/bin/ensure-readmes-are-updated.sh +40 -0
- data/tracks/haskell/config.json +9 -0
- data/tracks/haskell/exercises/rail-fence-cipher/README.md +119 -0
- data/tracks/haskell/exercises/rail-fence-cipher/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/rail-fence-cipher/examples/success-standard/src/RailFenceCipher.hs +12 -0
- data/tracks/haskell/exercises/rail-fence-cipher/package.yaml +20 -0
- data/tracks/haskell/exercises/rail-fence-cipher/src/RailFenceCipher.hs +7 -0
- data/tracks/haskell/exercises/rail-fence-cipher/stack.yaml +1 -0
- data/tracks/haskell/exercises/rail-fence-cipher/test/Tests.hs +60 -0
- data/tracks/java/CONTRIBUTING.md +14 -5
- data/tracks/java/bin/run-journey-test-from-ci.sh +1 -1
- data/tracks/java/config.json +13 -0
- data/tracks/java/exercises/custom-set/.meta/src/reference/java/CustomSet.java +12 -12
- data/tracks/java/exercises/food-chain/.meta/src/reference/java/FoodChain.java +3 -3
- data/tracks/java/exercises/grade-school/.meta/src/reference/java/School.java +7 -7
- data/tracks/java/exercises/hamming/.meta/src/reference/java/Hamming.java +3 -3
- data/tracks/java/exercises/hexadecimal/.meta/src/reference/java/Hexadecimal.java +2 -4
- data/tracks/java/exercises/isogram/.meta/src/reference/java/IsogramChecker.java +2 -2
- data/tracks/java/exercises/largest-series-product/.meta/src/reference/java/LargestSeriesProductCalculator.java +3 -3
- data/tracks/java/exercises/linked-list/.meta/src/reference/java/DoublyLinkedList.java +6 -6
- data/tracks/java/exercises/markdown/.meta/src/reference/java/Markdown.java +96 -0
- data/tracks/java/exercises/markdown/.meta/version +1 -0
- data/tracks/java/exercises/markdown/README.md +30 -0
- data/tracks/java/exercises/markdown/build.gradle +18 -0
- data/tracks/java/exercises/markdown/src/main/java/Markdown.java +83 -0
- data/tracks/java/exercises/markdown/src/test/java/MarkdownTest.java +95 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/javascript/exercises/alphametics/example.js +13 -9
- data/tracks/kotlin/docs/TESTS.md +14 -11
- data/tracks/ocaml/exercises/bob/example.ml +5 -3
- data/tracks/ocaml/exercises/bob/test.ml +3 -4
- data/tracks/ocaml/exercises/word-count/test.ml +3 -0
- data/tracks/ocaml/tools/test-generator/templates/ocaml/bob/test.ml +0 -1
- data/tracks/perl6/config.json +16 -6
- data/tracks/perl6/exercises/bob/Bob.pm6 +1 -1
- data/tracks/perl6/exercises/bob/Example.pm6 +11 -7
- data/tracks/perl6/exercises/bob/README.md +2 -0
- data/tracks/perl6/exercises/bob/bob.t +3 -3
- data/tracks/perl6/exercises/bob/example.yaml +11 -7
- data/tracks/perl6/exercises/clock/clock.t +17 -17
- data/tracks/perl6/exercises/clock/example.yaml +17 -17
- data/tracks/perl6/exercises/roman-numerals/Example.pm6 +17 -0
- data/tracks/perl6/exercises/roman-numerals/RomanNumerals.pm6 +4 -0
- data/tracks/perl6/exercises/roman-numerals/example.yaml +30 -0
- data/tracks/perl6/exercises/roman-numerals/roman-numerals.t +162 -0
- data/tracks/python/exercises/book-store/book_store_test.py +7 -1
- data/tracks/ruby/config.json +11 -0
- data/tracks/ruby/exercises/isbn-verifier/.meta/.version +1 -0
- data/tracks/ruby/exercises/isbn-verifier/.meta/generator/isbn_verifier_case.rb +28 -0
- data/tracks/ruby/exercises/isbn-verifier/.meta/solutions/isbn_verifier.rb +25 -0
- data/tracks/ruby/exercises/isbn-verifier/README.md +73 -0
- data/tracks/ruby/exercises/isbn-verifier/isbn_verifier_test.rb +105 -0
- data/tracks/ruby/exercises/isogram/.meta/generator/isogram_case.rb +3 -3
- data/tracks/ruby/exercises/isogram/isogram_test.rb +18 -18
- data/tracks/rust/README.md +0 -2
- data/tracks/rust/config.json +11 -0
- data/tracks/rust/exercises/diffie-hellman/tests/diffie-hellman.rs +0 -1
- data/tracks/rust/exercises/parallel-letter-frequency/HINTS.md +2 -2
- data/tracks/rust/exercises/parallel-letter-frequency/README.md +2 -2
- data/tracks/rust/exercises/rna-transcription/example.rs +10 -10
- data/tracks/rust/exercises/rna-transcription/tests/rna-transcription.rs +10 -10
- data/tracks/rust/exercises/series/.gitignore +3 -0
- data/tracks/rust/exercises/series/Cargo.toml +5 -0
- data/tracks/rust/exercises/series/README.md +60 -0
- data/tracks/rust/exercises/series/example.rs +13 -0
- data/tracks/rust/exercises/series/src/lib.rs +3 -0
- data/tracks/rust/exercises/series/tests/series.rs +34 -0
- data/tracks/sml/exercises/nth-prime/README.md +1 -1
- data/tracks/vimscript/.travis.yml +3 -0
- data/tracks/vimscript/docs/LEARNING.md +1 -1
- metadata +38 -2
@@ -0,0 +1,95 @@
|
|
1
|
+
import org.junit.Before;
|
2
|
+
import org.junit.Ignore;
|
3
|
+
import org.junit.Test;
|
4
|
+
|
5
|
+
import static org.junit.Assert.assertEquals;
|
6
|
+
|
7
|
+
public class MarkdownTest {
|
8
|
+
|
9
|
+
private Markdown markdown;
|
10
|
+
|
11
|
+
@Before
|
12
|
+
public void setup() {
|
13
|
+
markdown = new Markdown();
|
14
|
+
}
|
15
|
+
|
16
|
+
@Test
|
17
|
+
public void normalTextAsAParagraph() {
|
18
|
+
String input = "This will be a paragraph";
|
19
|
+
String expected = "<p>This will be a paragraph</p>";
|
20
|
+
|
21
|
+
assertEquals(expected, markdown.parse(input));
|
22
|
+
}
|
23
|
+
|
24
|
+
@Ignore("Remove to run test")
|
25
|
+
@Test
|
26
|
+
public void italics() {
|
27
|
+
String input = "_This will be italic_";
|
28
|
+
String expected = "<p><em>This will be italic</em></p>";
|
29
|
+
|
30
|
+
assertEquals(expected, markdown.parse(input));
|
31
|
+
}
|
32
|
+
|
33
|
+
@Ignore("Remove to run test")
|
34
|
+
@Test
|
35
|
+
public void boldText() {
|
36
|
+
String input = "__This will be bold__";
|
37
|
+
String expected = "<p><strong>This will be bold</strong></p>";
|
38
|
+
|
39
|
+
assertEquals(expected, markdown.parse(input));
|
40
|
+
}
|
41
|
+
|
42
|
+
@Ignore("Remove to run test")
|
43
|
+
@Test
|
44
|
+
public void normalItalicsAndBoldText() {
|
45
|
+
String input = "This will _be_ __mixed__";
|
46
|
+
String expected = "<p>This will <em>be</em> <strong>mixed</strong></p>";
|
47
|
+
|
48
|
+
assertEquals(expected, markdown.parse(input));
|
49
|
+
}
|
50
|
+
|
51
|
+
@Ignore("Remove to run test")
|
52
|
+
@Test
|
53
|
+
public void withH1HeaderLevel() {
|
54
|
+
String input = "# This will be an h1";
|
55
|
+
String expected = "<h1>This will be an h1</h1>";
|
56
|
+
|
57
|
+
assertEquals(expected, markdown.parse(input));
|
58
|
+
}
|
59
|
+
|
60
|
+
@Ignore("Remove to run test")
|
61
|
+
@Test
|
62
|
+
public void withH2HeaderLevel() {
|
63
|
+
String input = "## This will be an h2";
|
64
|
+
String expected = "<h2>This will be an h2</h2>";
|
65
|
+
|
66
|
+
assertEquals(expected, markdown.parse(input));
|
67
|
+
}
|
68
|
+
|
69
|
+
@Ignore("Remove to run test")
|
70
|
+
@Test
|
71
|
+
public void withH6HeaderLevel() {
|
72
|
+
String input = "###### This will be an h6";
|
73
|
+
String expected = "<h6>This will be an h6</h6>";
|
74
|
+
|
75
|
+
assertEquals(expected, markdown.parse(input));
|
76
|
+
}
|
77
|
+
|
78
|
+
@Ignore("Remove to run test")
|
79
|
+
@Test
|
80
|
+
public void unorderedLists() {
|
81
|
+
String input = "* Item 1\n* Item 2";
|
82
|
+
String expected = "<ul><li>Item 1</li><li>Item 2</li></ul>";
|
83
|
+
|
84
|
+
assertEquals(expected, markdown.parse(input));
|
85
|
+
}
|
86
|
+
|
87
|
+
@Ignore("Remove to run test")
|
88
|
+
@Test
|
89
|
+
public void aLittleBitOfEverything() {
|
90
|
+
String input = "# Header!\n* __Bold Item__\n* _Italic Item_";
|
91
|
+
String expected = "<h1>Header!</h1><ul><li><strong>Bold Item</strong></li><li><em>Italic Item</em></li></ul>";
|
92
|
+
|
93
|
+
assertEquals(expected, markdown.parse(input));
|
94
|
+
}
|
95
|
+
}
|
@@ -53,21 +53,21 @@ function testNumbers(numbers, puzzleParts, firstLetters) {
|
|
53
53
|
}
|
54
54
|
var replaceRegex = new RegExp('[' + keys.join('') + ']', 'g');
|
55
55
|
|
56
|
-
|
56
|
+
var puzzlePartsJoined = puzzleParts.join(',')
|
57
57
|
.replace(replaceRegex, function (input) { return numbers[input]; })
|
58
58
|
.split(',')
|
59
|
-
.map(function (t) {return parseInt(t);});
|
59
|
+
.map(function (t) {return parseInt(t, 10);});
|
60
60
|
|
61
|
-
var total =
|
62
|
-
return total ===
|
63
|
-
.slice(0,
|
61
|
+
var total = puzzlePartsJoined.slice(puzzlePartsJoined.length - 1)[0];
|
62
|
+
return total === puzzlePartsJoined
|
63
|
+
.slice(0, puzzlePartsJoined.length - 1)
|
64
64
|
.reduce(function (acc, val) { return acc + val; }, 0);
|
65
65
|
}
|
66
66
|
|
67
67
|
function getPermutations(inputArr) {
|
68
68
|
var results = [];
|
69
69
|
function permute(arr, memo) {
|
70
|
-
var cur
|
70
|
+
var cur = memo;
|
71
71
|
for (var i = 0; i < arr.length; i++) {
|
72
72
|
cur = arr.splice(i, 1);
|
73
73
|
if (arr.length === 0) {
|
@@ -78,11 +78,15 @@ function getPermutations(inputArr) {
|
|
78
78
|
}
|
79
79
|
return results;
|
80
80
|
}
|
81
|
-
return permute(inputArr);
|
81
|
+
return permute(inputArr, []);
|
82
82
|
}
|
83
83
|
|
84
84
|
function getNumberCombinations(set, k) {
|
85
|
-
var i
|
85
|
+
var i;
|
86
|
+
var j;
|
87
|
+
var combs;
|
88
|
+
var head;
|
89
|
+
var tailcombs;
|
86
90
|
if (k > set.length || k <= 0) {
|
87
91
|
return [];
|
88
92
|
}
|
@@ -104,4 +108,4 @@ function getNumberCombinations(set, k) {
|
|
104
108
|
return combs;
|
105
109
|
}
|
106
110
|
|
107
|
-
module.exports = solve;
|
111
|
+
module.exports = solve;
|
data/tracks/kotlin/docs/TESTS.md
CHANGED
@@ -37,7 +37,7 @@ Choose your operating system:
|
|
37
37
|
C:\Users\JohnDoe>gradle test
|
38
38
|
```
|
39
39
|
*(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
|
40
|
-
5. Solve the exercise. Find and work through the `
|
40
|
+
5. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/kotlin/blob/master/exercises/hello-world/TUTORIAL.md)).
|
41
41
|
|
42
42
|
|
43
43
|
Good luck! Have fun!
|
@@ -57,8 +57,8 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
|
|
57
57
|
Kotlin (Etl) /Users/johndoe/exercism/kotlin/hello-world
|
58
58
|
|
59
59
|
unchanged: 0, updated: 0, new: 1
|
60
|
+
```
|
60
61
|
|
61
|
-
```
|
62
62
|
2. Change directory into the exercise:
|
63
63
|
|
64
64
|
```
|
@@ -66,11 +66,12 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
|
|
66
66
|
```
|
67
67
|
3. Run the tests:
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
```
|
70
|
+
$ gradle test
|
71
|
+
```
|
72
72
|
*(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
|
73
|
-
|
73
|
+
|
74
|
+
4. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/kotlin/blob/master/exercises/hello-world/TUTORIAL.md)).
|
74
75
|
|
75
76
|
Good luck! Have fun!
|
76
77
|
|
@@ -89,20 +90,22 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
|
|
89
90
|
Kotlin (Etl) /home/johndoe/exercism/kotlin/hello-world
|
90
91
|
|
91
92
|
unchanged: 0, updated: 0, new: 1
|
93
|
+
```
|
92
94
|
|
93
|
-
```
|
94
95
|
2. Change directory into the exercise:
|
95
96
|
|
96
97
|
```
|
97
98
|
$ cd /home/johndoe/exercism/kotlin/hello-world
|
98
99
|
```
|
100
|
+
|
99
101
|
3. Run the tests:
|
100
102
|
|
101
|
-
|
102
|
-
|
103
|
-
|
103
|
+
```
|
104
|
+
$ gradle test
|
105
|
+
```
|
104
106
|
*(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
|
105
|
-
|
107
|
+
|
108
|
+
4. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/kotlin/blob/master/exercises/hello-world/TUTORIAL.mdhttps://github.com/exercism/kotlin/blob/master/exercises/hello-world/GETTING_STARTED.mdhttps://github.com/exercism/kotlin/blob/master/exercises/hello-world/GETTING_STARTED.mdhttps://github.com/exercism/kotlin/blob/master/exercises/hello-world/GETTING_STARTED.md)).
|
106
109
|
|
107
110
|
Good luck! Have fun!
|
108
111
|
|
@@ -6,10 +6,12 @@ let is_shouting s =
|
|
6
6
|
String.exists ~f:Char.is_alpha s &&
|
7
7
|
String.for_all ~f:(fun c -> not (Char.is_alpha c) || Char.is_uppercase c) s
|
8
8
|
|
9
|
-
let is_question s = String.
|
9
|
+
let is_question s = s.[String.length s - 1] = '?'
|
10
10
|
|
11
|
-
let response_for =
|
11
|
+
let response_for s =
|
12
|
+
let s = String.strip s in
|
13
|
+
match s with
|
12
14
|
| s when is_empty s -> "Fine. Be that way!"
|
13
|
-
| s when is_shouting s -> "Whoa, chill out!"
|
15
|
+
| s when is_shouting s -> if is_question s then "Calm down, I know what I'm doing!" else "Whoa, chill out!"
|
14
16
|
| s when is_question s -> "Sure."
|
15
17
|
| _ -> "Whatever."
|
@@ -1,10 +1,9 @@
|
|
1
|
-
(* Test/exercise version: "1.
|
1
|
+
(* Test/exercise version: "1.1.0" *)
|
2
2
|
|
3
|
-
open Core
|
4
3
|
open OUnit2
|
5
4
|
open Bob
|
6
5
|
|
7
|
-
let ae exp got _test_ctxt = assert_equal ~printer:
|
6
|
+
let ae exp got _test_ctxt = assert_equal ~printer:(fun x -> x) exp got
|
8
7
|
|
9
8
|
let tests = [
|
10
9
|
"stating something" >::
|
@@ -24,7 +23,7 @@ let tests = [
|
|
24
23
|
"using acronyms in regular speech" >::
|
25
24
|
ae "Whatever." (response_for "It's OK if you don't want to go to the DMV.");
|
26
25
|
"forceful question" >::
|
27
|
-
ae "
|
26
|
+
ae "Calm down, I know what I'm doing!" (response_for "WHAT THE HELL WERE YOU THINKING?");
|
28
27
|
"shouting numbers" >::
|
29
28
|
ae "Whoa, chill out!" (response_for "1, 2, 3 GO!");
|
30
29
|
"only numbers" >::
|
@@ -41,6 +41,9 @@ let tests = [
|
|
41
41
|
"with quotations" >::
|
42
42
|
ae [("joe", 1); ("can't", 1); ("tell", 1); ("between", 1); ("large", 2); ("and", 1)]
|
43
43
|
(word_count "Joe can't tell between 'large' and large.");
|
44
|
+
"multiple spaces not detected as a word" >::
|
45
|
+
ae [("multiple", 1); ("whitespaces", 1)]
|
46
|
+
(word_count " multiple whitespaces");
|
44
47
|
]
|
45
48
|
|
46
49
|
let () =
|
data/tracks/perl6/config.json
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
]
|
20
20
|
},
|
21
21
|
{
|
22
|
-
"uuid": "
|
22
|
+
"uuid": "455dd1c8-bf10-4912-a69b-4ffada20d661",
|
23
23
|
"slug": "two-fer",
|
24
24
|
"core": false,
|
25
25
|
"unlocked_by": null,
|
@@ -49,7 +49,7 @@
|
|
49
49
|
]
|
50
50
|
},
|
51
51
|
{
|
52
|
-
"uuid": "
|
52
|
+
"uuid": "eddd942e-cb67-4ae2-b763-a11ee3640aee",
|
53
53
|
"slug": "pangram",
|
54
54
|
"core": false,
|
55
55
|
"unlocked_by": null,
|
@@ -69,7 +69,7 @@
|
|
69
69
|
]
|
70
70
|
},
|
71
71
|
{
|
72
|
-
"uuid": "
|
72
|
+
"uuid": "c18b5d07-ac1b-4411-9bd4-c6882614e8ee",
|
73
73
|
"slug": "hamming",
|
74
74
|
"core": false,
|
75
75
|
"unlocked_by": null,
|
@@ -89,7 +89,7 @@
|
|
89
89
|
]
|
90
90
|
},
|
91
91
|
{
|
92
|
-
"uuid": "
|
92
|
+
"uuid": "3bee4dc2-d747-4b4e-ac10-d7815666bbc0",
|
93
93
|
"slug": "etl",
|
94
94
|
"core": false,
|
95
95
|
"unlocked_by": null,
|
@@ -99,7 +99,7 @@
|
|
99
99
|
]
|
100
100
|
},
|
101
101
|
{
|
102
|
-
"uuid": "
|
102
|
+
"uuid": "30732526-f790-4182-bcc7-7713b685d90a",
|
103
103
|
"slug": "nucleotide-count",
|
104
104
|
"core": false,
|
105
105
|
"unlocked_by": null,
|
@@ -159,7 +159,7 @@
|
|
159
159
|
]
|
160
160
|
},
|
161
161
|
{
|
162
|
-
"uuid": "
|
162
|
+
"uuid": "b8ae569f-d0b3-44d0-a4d6-a800b20b398a",
|
163
163
|
"slug": "meetup",
|
164
164
|
"core": false,
|
165
165
|
"unlocked_by": null,
|
@@ -298,6 +298,16 @@
|
|
298
298
|
|
299
299
|
]
|
300
300
|
},
|
301
|
+
{
|
302
|
+
"uuid": "00219cdb-939f-434c-bfb4-e3d62a8542c0",
|
303
|
+
"slug": "roman-numerals",
|
304
|
+
"core": false,
|
305
|
+
"unlocked_by": null,
|
306
|
+
"difficulty": 3,
|
307
|
+
"topics": [
|
308
|
+
|
309
|
+
]
|
310
|
+
},
|
301
311
|
{
|
302
312
|
"uuid": "1d36c4df-a1c8-454c-b4ec-7bec3c1cbca3",
|
303
313
|
"slug": "binary",
|
@@ -2,13 +2,17 @@
|
|
2
2
|
Declare class 'Bob' with version and unit-scope the class
|
3
3
|
i.e. everything in this file is part of 'Bob'.
|
4
4
|
]
|
5
|
-
unit class Bob:ver<
|
5
|
+
unit class Bob:ver<2>;
|
6
6
|
|
7
|
-
method hey ($
|
8
|
-
|
9
|
-
|
10
|
-
when
|
11
|
-
|
12
|
-
|
7
|
+
method hey ( Str:D $_ --> Str:D ) {
|
8
|
+
my \shouting = /<:L>/ ^ /<:Ll>/;
|
9
|
+
given .trim {
|
10
|
+
when .ends-with: ‘?’ {
|
11
|
+
when shouting { ‘Calm down, I know what I'm doing!’ }
|
12
|
+
default { ‘Sure.’ }
|
13
|
+
}
|
14
|
+
when shouting { ‘Whoa, chill out!’ }
|
15
|
+
when .not { ‘Fine. Be that way!’ }
|
16
|
+
default { ‘Whatever.’ };
|
13
17
|
}
|
14
18
|
}
|
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
|
|
6
6
|
|
7
7
|
He answers 'Whoa, chill out!' if you yell at him.
|
8
8
|
|
9
|
+
He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
|
10
|
+
|
9
11
|
He says 'Fine. Be that way!' if you address him without actually saying
|
10
12
|
anything.
|
11
13
|
|
@@ -5,7 +5,7 @@ use lib my $dir = $?FILE.IO.dirname; #`[Look for the module inside the same dire
|
|
5
5
|
use JSON::Fast;
|
6
6
|
|
7
7
|
my Str:D $exercise := 'Bob'; #`[The name of this exercise.]
|
8
|
-
my Version:D $version =
|
8
|
+
my Version:D $version = v2; #`[The version we will be matching against the exercise.]
|
9
9
|
my Str $module //= $exercise; #`[The name of the module file to be loaded.]
|
10
10
|
plan 28; #`[This is how many tests we expect to run.]
|
11
11
|
|
@@ -37,7 +37,7 @@ is ::($exercise).?hey(.<input>), |.<expected description> for @($c-data<cases>);
|
|
37
37
|
|
38
38
|
{
|
39
39
|
"exercise": "bob",
|
40
|
-
"version": "1.
|
40
|
+
"version": "1.1.0",
|
41
41
|
"cases": [
|
42
42
|
{
|
43
43
|
"description": "stating something",
|
@@ -91,7 +91,7 @@ is ::($exercise).?hey(.<input>), |.<expected description> for @($c-data<cases>);
|
|
91
91
|
"description": "forceful question",
|
92
92
|
"property": "response",
|
93
93
|
"input": "WHAT THE HELL WERE YOU THINKING?",
|
94
|
-
"expected": "
|
94
|
+
"expected": "Calm down, I know what I'm doing!"
|
95
95
|
},
|
96
96
|
{
|
97
97
|
"description": "shouting numbers",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
exercise: Bob
|
2
|
-
version:
|
2
|
+
version: 2
|
3
3
|
plan: 28
|
4
4
|
methods: hey
|
5
5
|
tests: |-
|
@@ -23,12 +23,16 @@ unit_comment: |-
|
|
23
23
|
i.e. everything in this file is part of 'Bob'.
|
24
24
|
]
|
25
25
|
example: |-
|
26
|
-
method hey ($
|
27
|
-
|
28
|
-
|
29
|
-
when
|
30
|
-
|
31
|
-
|
26
|
+
method hey ( Str:D $_ --> Str:D ) {
|
27
|
+
my \shouting = /<:L>/ ^ /<:Ll>/;
|
28
|
+
given .trim {
|
29
|
+
when .ends-with: ‘?’ {
|
30
|
+
when shouting { ‘Calm down, I know what I'm doing!’ }
|
31
|
+
default { ‘Sure.’ }
|
32
|
+
}
|
33
|
+
when shouting { ‘Whoa, chill out!’ }
|
34
|
+
when .not { ‘Fine. Be that way!’ }
|
35
|
+
default { ‘Whatever.’ };
|
32
36
|
}
|
33
37
|
}
|
34
38
|
stub: |-
|