trackler 2.2.1.94 → 2.2.1.95
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 +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/anagram/canonical-data.json +1 -37
- data/tracks/crystal/exercises/hello-world/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/java/exercises/prime-factors/.meta/hints.md +58 -0
- data/tracks/java/exercises/prime-factors/README.md +62 -0
- data/tracks/java/exercises/robot-name/.meta/hints.md +58 -0
- data/tracks/java/exercises/robot-name/README.md +62 -0
- data/tracks/java/exercises/robot-simulator/src/test/java/RobotTest.java +9 -5
- data/tracks/java/exercises/run-length-encoding/.meta/hints.md +58 -0
- data/tracks/java/exercises/run-length-encoding/README.md +62 -0
- data/tracks/javascript/config/exercise_readme.go.tmpl +26 -4
- data/tracks/javascript/exercises/accumulate/README.md +16 -16
- data/tracks/javascript/exercises/acronym/README.md +15 -13
- data/tracks/javascript/exercises/all-your-base/README.md +16 -14
- data/tracks/javascript/exercises/allergies/README.md +15 -13
- data/tracks/javascript/exercises/alphametics/README.md +17 -15
- data/tracks/javascript/exercises/anagram/README.md +15 -12
- data/tracks/javascript/exercises/atbash-cipher/README.md +17 -13
- data/tracks/javascript/exercises/beer-song/README.md +17 -14
- data/tracks/javascript/exercises/binary/README.md +17 -12
- data/tracks/javascript/exercises/binary-search/README.md +15 -12
- data/tracks/javascript/exercises/binary-search-tree/README.md +15 -12
- data/tracks/javascript/exercises/bob/README.md +17 -12
- data/tracks/javascript/exercises/bowling/README.md +38 -21
- data/tracks/javascript/exercises/bracket-push/README.md +15 -12
- data/tracks/javascript/exercises/change/README.md +31 -17
- data/tracks/javascript/exercises/circular-buffer/README.md +28 -18
- data/tracks/javascript/exercises/clock/README.md +15 -12
- data/tracks/javascript/exercises/collatz-conjecture/README.md +15 -12
- data/tracks/javascript/exercises/connect/README.md +17 -16
- data/tracks/javascript/exercises/crypto-square/README.md +25 -20
- data/tracks/javascript/exercises/custom-set/README.md +15 -13
- data/tracks/javascript/exercises/diamond/README.md +21 -18
- data/tracks/javascript/exercises/difference-of-squares/README.md +16 -13
- data/tracks/javascript/exercises/diffie-hellman/README.md +15 -17
- data/tracks/javascript/exercises/etl/README.md +18 -13
- data/tracks/javascript/exercises/flatten-array/README.md +16 -14
- data/tracks/javascript/exercises/food-chain/README.md +16 -13
- data/tracks/javascript/exercises/forth/README.md +17 -18
- data/tracks/javascript/exercises/gigasecond/README.md +15 -12
- data/tracks/javascript/exercises/grade-school/README.md +15 -13
- data/tracks/javascript/exercises/grains/README.md +15 -13
- data/tracks/javascript/exercises/hamming/README.md +15 -12
- data/tracks/javascript/exercises/hello-world/README.md +15 -12
- data/tracks/javascript/exercises/hexadecimal/README.md +15 -12
- data/tracks/javascript/exercises/isbn-verifier/README.md +44 -36
- data/tracks/javascript/exercises/isogram/README.md +17 -13
- data/tracks/javascript/exercises/kindergarten-garden/README.md +28 -25
- data/tracks/javascript/exercises/largest-series-product/README.md +15 -12
- data/tracks/javascript/exercises/leap/README.md +16 -13
- data/tracks/javascript/exercises/linked-list/README.md +25 -22
- data/tracks/javascript/exercises/list-ops/README.md +15 -13
- data/tracks/javascript/exercises/luhn/README.md +22 -19
- data/tracks/javascript/exercises/matrix/README.md +21 -16
- data/tracks/javascript/exercises/meetup/README.md +31 -25
- data/tracks/javascript/exercises/minesweeper/README.md +15 -13
- data/tracks/javascript/exercises/nth-prime/README.md +15 -12
- data/tracks/javascript/exercises/nucleotide-count/README.md +23 -34
- data/tracks/javascript/exercises/ocr-numbers/README.md +21 -18
- data/tracks/javascript/exercises/octal/README.md +21 -14
- data/tracks/javascript/exercises/palindrome-products/README.md +29 -27
- data/tracks/javascript/exercises/pangram/README.md +16 -13
- data/tracks/javascript/exercises/pascals-triangle/README.md +17 -14
- data/tracks/javascript/exercises/perfect-numbers/README.md +17 -14
- data/tracks/javascript/exercises/phone-number/README.md +19 -15
- data/tracks/javascript/exercises/pig-latin/README.md +15 -12
- data/tracks/javascript/exercises/point-mutations/README.md +15 -12
- data/tracks/javascript/exercises/prime-factors/README.md +15 -12
- data/tracks/javascript/exercises/protein-translation/README.md +19 -17
- data/tracks/javascript/exercises/proverb/README.md +29 -21
- data/tracks/javascript/exercises/pythagorean-triplet/README.md +18 -15
- data/tracks/javascript/exercises/queen-attack/README.md +16 -13
- data/tracks/javascript/exercises/raindrops/README.md +15 -12
- data/tracks/javascript/exercises/reverse-string/README.md +19 -15
- data/tracks/javascript/exercises/rna-transcription/README.md +16 -13
- data/tracks/javascript/exercises/robot-name/README.md +15 -12
- data/tracks/javascript/exercises/robot-simulator/README.md +15 -12
- data/tracks/javascript/exercises/roman-numerals/README.md +16 -13
- data/tracks/javascript/exercises/run-length-encoding/README.md +19 -16
- data/tracks/javascript/exercises/saddle-points/README.md +16 -13
- data/tracks/javascript/exercises/say/README.md +15 -12
- data/tracks/javascript/exercises/scrabble-score/README.md +18 -13
- data/tracks/javascript/exercises/secret-handshake/README.md +16 -13
- data/tracks/javascript/exercises/series/README.md +15 -12
- data/tracks/javascript/exercises/sieve/README.md +15 -12
- data/tracks/javascript/exercises/simple-cipher/README.md +19 -18
- data/tracks/javascript/exercises/simple-linked-list/README.md +15 -12
- data/tracks/javascript/exercises/space-age/README.md +16 -13
- data/tracks/javascript/exercises/strain/README.md +15 -12
- data/tracks/javascript/exercises/sublist/README.md +14 -17
- data/tracks/javascript/exercises/sum-of-multiples/README.md +19 -19
- data/tracks/javascript/exercises/transpose/README.md +15 -12
- data/tracks/javascript/exercises/triangle/README.md +24 -18
- data/tracks/javascript/exercises/trinary/README.md +16 -13
- data/tracks/javascript/exercises/twelve-days/README.md +17 -16
- data/tracks/javascript/exercises/two-bucket/README.md +25 -22
- data/tracks/javascript/exercises/two-fer/README.md +19 -14
- data/tracks/javascript/exercises/word-count/README.md +16 -14
- data/tracks/javascript/exercises/wordy/README.md +15 -17
- data/tracks/javascript/exercises/zipper/README.md +20 -18
- data/tracks/perl6/docs/ABOUT.md +12 -21
- metadata +6 -4
- data/tracks/javascript/docs/EXERCISE_README_INSERT.md +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe25bae56189cb9dd2f98c3dd8a9e08f1de442c7
|
|
4
|
+
data.tar.gz: cf7251e1202e956a8c2d8bde50aea6b834f78785
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5bc03f80fd2457525a2bc01b1e225926c1d521c601114892130859c891eb2f3847f2082fe1e741793b1c2af534d3c3b70aea8419e33301fbaa6aa5db503d514
|
|
7
|
+
data.tar.gz: 600e433bf221bd210e9bdada5c051c8725fc41e6326b4e14904f72ad043249934c93f485408e1502a01367efb8e2925c9d1df75cecb291d9622a8303d81660b8
|
data/lib/trackler/version.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"exercise": "anagram",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"comments": [
|
|
5
5
|
"The string argument cases possible matches are passed in as",
|
|
6
6
|
"individual arguments rather than arrays. Languages can include",
|
|
@@ -17,24 +17,6 @@
|
|
|
17
17
|
},
|
|
18
18
|
"expected": []
|
|
19
19
|
},
|
|
20
|
-
{
|
|
21
|
-
"description": "detects simple anagram",
|
|
22
|
-
"property": "anagrams",
|
|
23
|
-
"input": {
|
|
24
|
-
"subject": "ant",
|
|
25
|
-
"candidates": ["tan", "stand", "at"]
|
|
26
|
-
},
|
|
27
|
-
"expected": ["tan"]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"description": "does not detect false positives",
|
|
31
|
-
"property": "anagrams",
|
|
32
|
-
"input": {
|
|
33
|
-
"subject": "galea",
|
|
34
|
-
"candidates": ["eagle"]
|
|
35
|
-
},
|
|
36
|
-
"expected": []
|
|
37
|
-
},
|
|
38
20
|
{
|
|
39
21
|
"description": "detects two anagrams",
|
|
40
22
|
"property": "anagrams",
|
|
@@ -78,15 +60,6 @@
|
|
|
78
60
|
},
|
|
79
61
|
"expected": ["gallery", "regally", "largely"]
|
|
80
62
|
},
|
|
81
|
-
{
|
|
82
|
-
"description": "does not detect identical words",
|
|
83
|
-
"property": "anagrams",
|
|
84
|
-
"input": {
|
|
85
|
-
"subject": "corn",
|
|
86
|
-
"candidates": ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"]
|
|
87
|
-
},
|
|
88
|
-
"expected": ["cron"]
|
|
89
|
-
},
|
|
90
63
|
{
|
|
91
64
|
"description": "does not detect non-anagrams with identical checksum",
|
|
92
65
|
"property": "anagrams",
|
|
@@ -123,15 +96,6 @@
|
|
|
123
96
|
},
|
|
124
97
|
"expected": ["Carthorse"]
|
|
125
98
|
},
|
|
126
|
-
{
|
|
127
|
-
"description": "does not detect a word as its own anagram",
|
|
128
|
-
"property": "anagrams",
|
|
129
|
-
"input": {
|
|
130
|
-
"subject": "banana",
|
|
131
|
-
"candidates": ["Banana"]
|
|
132
|
-
},
|
|
133
|
-
"expected": []
|
|
134
|
-
},
|
|
135
99
|
{
|
|
136
100
|
"description": "does not detect a anagram if the original word is repeated",
|
|
137
101
|
"property": "anagrams",
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Since this exercise has difficulty 5 it doesn't come with any starter implementation.
|
|
2
|
+
This is so that you get to practice creating classes and methods which is an important part of programming in Java.
|
|
3
|
+
It does mean that when you first try to run the tests, they won't compile.
|
|
4
|
+
They will give you an error similar to:
|
|
5
|
+
```
|
|
6
|
+
path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
|
|
7
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName();
|
|
8
|
+
^
|
|
9
|
+
symbol: class ExerciseClassName
|
|
10
|
+
location: class ExerciseClassNameTest
|
|
11
|
+
```
|
|
12
|
+
This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
|
|
13
|
+
To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
|
|
14
|
+
For example, for the error above you would add a file called `ExerciseClassName.java`.
|
|
15
|
+
|
|
16
|
+
When you try to run the tests again you will get slightly different errors.
|
|
17
|
+
You might get an error similar to:
|
|
18
|
+
```
|
|
19
|
+
constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
|
|
20
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
|
|
21
|
+
^
|
|
22
|
+
required: no arguments
|
|
23
|
+
found: String
|
|
24
|
+
reason: actual and formal argument lists differ in length
|
|
25
|
+
```
|
|
26
|
+
This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
|
|
27
|
+
If you don't add a constructor, Java will add a default one for you.
|
|
28
|
+
This default constructor takes no arguments.
|
|
29
|
+
So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
|
|
30
|
+
In the example above you could add:
|
|
31
|
+
```
|
|
32
|
+
ExerciseClassName(String input) {
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
|
|
37
|
+
|
|
38
|
+
You might also get an error similar to:
|
|
39
|
+
```
|
|
40
|
+
error: cannot find symbol
|
|
41
|
+
assertEquals(expectedOutput, exerciseClassName.someMethod());
|
|
42
|
+
^
|
|
43
|
+
symbol: method someMethod()
|
|
44
|
+
location: variable exerciseClassName of type ExerciseClassName
|
|
45
|
+
```
|
|
46
|
+
This error means that you need to add a method called `someMethod` to your new class.
|
|
47
|
+
In the example above you would add:
|
|
48
|
+
```
|
|
49
|
+
String someMethod() {
|
|
50
|
+
return "";
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
Make sure the return type matches what the test is expecting.
|
|
54
|
+
You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
|
|
55
|
+
Or you could set your method to return some random type (e.g. `void`), and run the tests again.
|
|
56
|
+
The new error should tell you which type it's expecting.
|
|
57
|
+
|
|
58
|
+
After having resolved these errors you should be ready to start making the tests pass!
|
|
@@ -29,6 +29,68 @@ You can check this yourself:
|
|
|
29
29
|
- = 60
|
|
30
30
|
- Success!
|
|
31
31
|
|
|
32
|
+
# Java Tips
|
|
33
|
+
|
|
34
|
+
Since this exercise has difficulty 5 it doesn't come with any starter implementation.
|
|
35
|
+
This is so that you get to practice creating classes and methods which is an important part of programming in Java.
|
|
36
|
+
It does mean that when you first try to run the tests, they won't compile.
|
|
37
|
+
They will give you an error similar to:
|
|
38
|
+
```
|
|
39
|
+
path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
|
|
40
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName();
|
|
41
|
+
^
|
|
42
|
+
symbol: class ExerciseClassName
|
|
43
|
+
location: class ExerciseClassNameTest
|
|
44
|
+
```
|
|
45
|
+
This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
|
|
46
|
+
To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
|
|
47
|
+
For example, for the error above you would add a file called `ExerciseClassName.java`.
|
|
48
|
+
|
|
49
|
+
When you try to run the tests again you will get slightly different errors.
|
|
50
|
+
You might get an error similar to:
|
|
51
|
+
```
|
|
52
|
+
constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
|
|
53
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
|
|
54
|
+
^
|
|
55
|
+
required: no arguments
|
|
56
|
+
found: String
|
|
57
|
+
reason: actual and formal argument lists differ in length
|
|
58
|
+
```
|
|
59
|
+
This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
|
|
60
|
+
If you don't add a constructor, Java will add a default one for you.
|
|
61
|
+
This default constructor takes no arguments.
|
|
62
|
+
So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
|
|
63
|
+
In the example above you could add:
|
|
64
|
+
```
|
|
65
|
+
ExerciseClassName(String input) {
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
|
|
70
|
+
|
|
71
|
+
You might also get an error similar to:
|
|
72
|
+
```
|
|
73
|
+
error: cannot find symbol
|
|
74
|
+
assertEquals(expectedOutput, exerciseClassName.someMethod());
|
|
75
|
+
^
|
|
76
|
+
symbol: method someMethod()
|
|
77
|
+
location: variable exerciseClassName of type ExerciseClassName
|
|
78
|
+
```
|
|
79
|
+
This error means that you need to add a method called `someMethod` to your new class.
|
|
80
|
+
In the example above you would add:
|
|
81
|
+
```
|
|
82
|
+
String someMethod() {
|
|
83
|
+
return "";
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
Make sure the return type matches what the test is expecting.
|
|
87
|
+
You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
|
|
88
|
+
Or you could set your method to return some random type (e.g. `void`), and run the tests again.
|
|
89
|
+
The new error should tell you which type it's expecting.
|
|
90
|
+
|
|
91
|
+
After having resolved these errors you should be ready to start making the tests pass!
|
|
92
|
+
|
|
93
|
+
|
|
32
94
|
# Running the tests
|
|
33
95
|
|
|
34
96
|
You can run all the tests for an exercise by entering
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Since this exercise has difficulty 5 it doesn't come with any starter implementation.
|
|
2
|
+
This is so that you get to practice creating classes and methods which is an important part of programming in Java.
|
|
3
|
+
It does mean that when you first try to run the tests, they won't compile.
|
|
4
|
+
They will give you an error similar to:
|
|
5
|
+
```
|
|
6
|
+
path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
|
|
7
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName();
|
|
8
|
+
^
|
|
9
|
+
symbol: class ExerciseClassName
|
|
10
|
+
location: class ExerciseClassNameTest
|
|
11
|
+
```
|
|
12
|
+
This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
|
|
13
|
+
To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
|
|
14
|
+
For example, for the error above you would add a file called `ExerciseClassName.java`.
|
|
15
|
+
|
|
16
|
+
When you try to run the tests again you will get slightly different errors.
|
|
17
|
+
You might get an error similar to:
|
|
18
|
+
```
|
|
19
|
+
constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
|
|
20
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
|
|
21
|
+
^
|
|
22
|
+
required: no arguments
|
|
23
|
+
found: String
|
|
24
|
+
reason: actual and formal argument lists differ in length
|
|
25
|
+
```
|
|
26
|
+
This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
|
|
27
|
+
If you don't add a constructor, Java will add a default one for you.
|
|
28
|
+
This default constructor takes no arguments.
|
|
29
|
+
So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
|
|
30
|
+
In the example above you could add:
|
|
31
|
+
```
|
|
32
|
+
ExerciseClassName(String input) {
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
|
|
37
|
+
|
|
38
|
+
You might also get an error similar to:
|
|
39
|
+
```
|
|
40
|
+
error: cannot find symbol
|
|
41
|
+
assertEquals(expectedOutput, exerciseClassName.someMethod());
|
|
42
|
+
^
|
|
43
|
+
symbol: method someMethod()
|
|
44
|
+
location: variable exerciseClassName of type ExerciseClassName
|
|
45
|
+
```
|
|
46
|
+
This error means that you need to add a method called `someMethod` to your new class.
|
|
47
|
+
In the example above you would add:
|
|
48
|
+
```
|
|
49
|
+
String someMethod() {
|
|
50
|
+
return "";
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
Make sure the return type matches what the test is expecting.
|
|
54
|
+
You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
|
|
55
|
+
Or you could set your method to return some random type (e.g. `void`), and run the tests again.
|
|
56
|
+
The new error should tell you which type it's expecting.
|
|
57
|
+
|
|
58
|
+
After having resolved these errors you should be ready to start making the tests pass!
|
|
@@ -15,6 +15,68 @@ The names must be random: they should not follow a predictable sequence.
|
|
|
15
15
|
Random names means a risk of collisions. Your solution must ensure that
|
|
16
16
|
every existing robot has a unique name.
|
|
17
17
|
|
|
18
|
+
# Java Tips
|
|
19
|
+
|
|
20
|
+
Since this exercise has difficulty 5 it doesn't come with any starter implementation.
|
|
21
|
+
This is so that you get to practice creating classes and methods which is an important part of programming in Java.
|
|
22
|
+
It does mean that when you first try to run the tests, they won't compile.
|
|
23
|
+
They will give you an error similar to:
|
|
24
|
+
```
|
|
25
|
+
path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
|
|
26
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName();
|
|
27
|
+
^
|
|
28
|
+
symbol: class ExerciseClassName
|
|
29
|
+
location: class ExerciseClassNameTest
|
|
30
|
+
```
|
|
31
|
+
This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
|
|
32
|
+
To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
|
|
33
|
+
For example, for the error above you would add a file called `ExerciseClassName.java`.
|
|
34
|
+
|
|
35
|
+
When you try to run the tests again you will get slightly different errors.
|
|
36
|
+
You might get an error similar to:
|
|
37
|
+
```
|
|
38
|
+
constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
|
|
39
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
|
|
40
|
+
^
|
|
41
|
+
required: no arguments
|
|
42
|
+
found: String
|
|
43
|
+
reason: actual and formal argument lists differ in length
|
|
44
|
+
```
|
|
45
|
+
This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
|
|
46
|
+
If you don't add a constructor, Java will add a default one for you.
|
|
47
|
+
This default constructor takes no arguments.
|
|
48
|
+
So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
|
|
49
|
+
In the example above you could add:
|
|
50
|
+
```
|
|
51
|
+
ExerciseClassName(String input) {
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
|
|
56
|
+
|
|
57
|
+
You might also get an error similar to:
|
|
58
|
+
```
|
|
59
|
+
error: cannot find symbol
|
|
60
|
+
assertEquals(expectedOutput, exerciseClassName.someMethod());
|
|
61
|
+
^
|
|
62
|
+
symbol: method someMethod()
|
|
63
|
+
location: variable exerciseClassName of type ExerciseClassName
|
|
64
|
+
```
|
|
65
|
+
This error means that you need to add a method called `someMethod` to your new class.
|
|
66
|
+
In the example above you would add:
|
|
67
|
+
```
|
|
68
|
+
String someMethod() {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
Make sure the return type matches what the test is expecting.
|
|
73
|
+
You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
|
|
74
|
+
Or you could set your method to return some random type (e.g. `void`), and run the tests again.
|
|
75
|
+
The new error should tell you which type it's expecting.
|
|
76
|
+
|
|
77
|
+
After having resolved these errors you should be ready to start making the tests pass!
|
|
78
|
+
|
|
79
|
+
|
|
18
80
|
# Running the tests
|
|
19
81
|
|
|
20
82
|
You can run all the tests for an exercise by entering
|
|
@@ -6,20 +6,24 @@ import static org.junit.Assert.assertEquals;
|
|
|
6
6
|
public class RobotTest {
|
|
7
7
|
|
|
8
8
|
@Test
|
|
9
|
-
public void
|
|
9
|
+
public void testRobotIsCreatedWithCorrectInitialPositionAndOrientation() {
|
|
10
|
+
final Orientation initialOrientation = Orientation.NORTH;
|
|
10
11
|
final GridPosition initialGridPosition = new GridPosition(0, 0);
|
|
11
|
-
final Robot robot = new Robot(initialGridPosition,
|
|
12
|
+
final Robot robot = new Robot(initialGridPosition, initialOrientation);
|
|
12
13
|
|
|
14
|
+
assertEquals(robot.getOrientation(), initialOrientation);
|
|
13
15
|
assertEquals(robot.getGridPosition(), initialGridPosition);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
@Ignore("Remove to run test")
|
|
17
19
|
@Test
|
|
18
|
-
public void
|
|
19
|
-
final
|
|
20
|
-
final
|
|
20
|
+
public void testNegativePositionsAreAllowed() {
|
|
21
|
+
final GridPosition initialGridPosition = new GridPosition(-1, -1);
|
|
22
|
+
final Orientation initialOrientation = Orientation.SOUTH;
|
|
23
|
+
final Robot robot = new Robot(initialGridPosition, initialOrientation);
|
|
21
24
|
|
|
22
25
|
assertEquals(robot.getOrientation(), initialOrientation);
|
|
26
|
+
assertEquals(robot.getGridPosition(), initialGridPosition);
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
@Ignore("Remove to run test")
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Since this exercise has difficulty 5 it doesn't come with any starter implementation.
|
|
2
|
+
This is so that you get to practice creating classes and methods which is an important part of programming in Java.
|
|
3
|
+
It does mean that when you first try to run the tests, they won't compile.
|
|
4
|
+
They will give you an error similar to:
|
|
5
|
+
```
|
|
6
|
+
path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
|
|
7
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName();
|
|
8
|
+
^
|
|
9
|
+
symbol: class ExerciseClassName
|
|
10
|
+
location: class ExerciseClassNameTest
|
|
11
|
+
```
|
|
12
|
+
This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
|
|
13
|
+
To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
|
|
14
|
+
For example, for the error above you would add a file called `ExerciseClassName.java`.
|
|
15
|
+
|
|
16
|
+
When you try to run the tests again you will get slightly different errors.
|
|
17
|
+
You might get an error similar to:
|
|
18
|
+
```
|
|
19
|
+
constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
|
|
20
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
|
|
21
|
+
^
|
|
22
|
+
required: no arguments
|
|
23
|
+
found: String
|
|
24
|
+
reason: actual and formal argument lists differ in length
|
|
25
|
+
```
|
|
26
|
+
This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
|
|
27
|
+
If you don't add a constructor, Java will add a default one for you.
|
|
28
|
+
This default constructor takes no arguments.
|
|
29
|
+
So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
|
|
30
|
+
In the example above you could add:
|
|
31
|
+
```
|
|
32
|
+
ExerciseClassName(String input) {
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
|
|
37
|
+
|
|
38
|
+
You might also get an error similar to:
|
|
39
|
+
```
|
|
40
|
+
error: cannot find symbol
|
|
41
|
+
assertEquals(expectedOutput, exerciseClassName.someMethod());
|
|
42
|
+
^
|
|
43
|
+
symbol: method someMethod()
|
|
44
|
+
location: variable exerciseClassName of type ExerciseClassName
|
|
45
|
+
```
|
|
46
|
+
This error means that you need to add a method called `someMethod` to your new class.
|
|
47
|
+
In the example above you would add:
|
|
48
|
+
```
|
|
49
|
+
String someMethod() {
|
|
50
|
+
return "";
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
Make sure the return type matches what the test is expecting.
|
|
54
|
+
You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
|
|
55
|
+
Or you could set your method to return some random type (e.g. `void`), and run the tests again.
|
|
56
|
+
The new error should tell you which type it's expecting.
|
|
57
|
+
|
|
58
|
+
After having resolved these errors you should be ready to start making the tests pass!
|
|
@@ -23,6 +23,68 @@ the letters A through Z (either lower or upper case) and whitespace. This way
|
|
|
23
23
|
data to be encoded will never contain any numbers and numbers inside data to
|
|
24
24
|
be decoded always represent the count for the following character.
|
|
25
25
|
|
|
26
|
+
# Java Tips
|
|
27
|
+
|
|
28
|
+
Since this exercise has difficulty 5 it doesn't come with any starter implementation.
|
|
29
|
+
This is so that you get to practice creating classes and methods which is an important part of programming in Java.
|
|
30
|
+
It does mean that when you first try to run the tests, they won't compile.
|
|
31
|
+
They will give you an error similar to:
|
|
32
|
+
```
|
|
33
|
+
path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
|
|
34
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName();
|
|
35
|
+
^
|
|
36
|
+
symbol: class ExerciseClassName
|
|
37
|
+
location: class ExerciseClassNameTest
|
|
38
|
+
```
|
|
39
|
+
This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
|
|
40
|
+
To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
|
|
41
|
+
For example, for the error above you would add a file called `ExerciseClassName.java`.
|
|
42
|
+
|
|
43
|
+
When you try to run the tests again you will get slightly different errors.
|
|
44
|
+
You might get an error similar to:
|
|
45
|
+
```
|
|
46
|
+
constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
|
|
47
|
+
ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
|
|
48
|
+
^
|
|
49
|
+
required: no arguments
|
|
50
|
+
found: String
|
|
51
|
+
reason: actual and formal argument lists differ in length
|
|
52
|
+
```
|
|
53
|
+
This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
|
|
54
|
+
If you don't add a constructor, Java will add a default one for you.
|
|
55
|
+
This default constructor takes no arguments.
|
|
56
|
+
So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
|
|
57
|
+
In the example above you could add:
|
|
58
|
+
```
|
|
59
|
+
ExerciseClassName(String input) {
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
|
|
64
|
+
|
|
65
|
+
You might also get an error similar to:
|
|
66
|
+
```
|
|
67
|
+
error: cannot find symbol
|
|
68
|
+
assertEquals(expectedOutput, exerciseClassName.someMethod());
|
|
69
|
+
^
|
|
70
|
+
symbol: method someMethod()
|
|
71
|
+
location: variable exerciseClassName of type ExerciseClassName
|
|
72
|
+
```
|
|
73
|
+
This error means that you need to add a method called `someMethod` to your new class.
|
|
74
|
+
In the example above you would add:
|
|
75
|
+
```
|
|
76
|
+
String someMethod() {
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
Make sure the return type matches what the test is expecting.
|
|
81
|
+
You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
|
|
82
|
+
Or you could set your method to return some random type (e.g. `void`), and run the tests again.
|
|
83
|
+
The new error should tell you which type it's expecting.
|
|
84
|
+
|
|
85
|
+
After having resolved these errors you should be ready to start making the tests pass!
|
|
86
|
+
|
|
87
|
+
|
|
26
88
|
# Running the tests
|
|
27
89
|
|
|
28
90
|
You can run all the tests for an exercise by entering
|
|
@@ -4,10 +4,32 @@
|
|
|
4
4
|
{{- with .Hints }}
|
|
5
5
|
{{ . }}
|
|
6
6
|
{{ end }}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
Go through the setup instructions for JavaScript to install the
|
|
10
|
+
necessary dependencies:
|
|
11
|
+
|
|
12
|
+
http://exercism.io/languages/javascript/installation
|
|
13
|
+
|
|
14
|
+
## Running the test suite
|
|
15
|
+
|
|
16
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
|
17
|
+
You can install it by opening a terminal window and running the
|
|
18
|
+
following command:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install -g jasmine
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Run the test suite from the exercise directory with:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
jasmine {{ .Spec.Slug }}.spec.js
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
In many test suites all but the first test have been marked "pending".
|
|
31
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
|
32
|
+
{{ with .Spec.Credits }}
|
|
11
33
|
## Source
|
|
12
34
|
|
|
13
35
|
{{ . }}
|
|
@@ -25,31 +25,31 @@ Keep your hands off that collect/map/fmap/whatchamacallit functionality
|
|
|
25
25
|
provided by your standard library!
|
|
26
26
|
Solve this one yourself using other basic tools instead.
|
|
27
27
|
|
|
28
|
-
Lisp specific: it's perfectly fine to use `MAPCAR` or the equivalent,
|
|
29
|
-
as this is idiomatic Lisp, not a library function.
|
|
30
|
-
|
|
31
28
|
## Setup
|
|
32
29
|
|
|
33
|
-
Go through the setup instructions for JavaScript to
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
http://exercism.io/languages/javascript
|
|
30
|
+
Go through the setup instructions for JavaScript to install the
|
|
31
|
+
necessary dependencies:
|
|
37
32
|
|
|
38
|
-
|
|
33
|
+
http://exercism.io/languages/javascript/installation
|
|
39
34
|
|
|
40
|
-
|
|
35
|
+
## Running the test suite
|
|
41
36
|
|
|
42
|
-
|
|
37
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
|
38
|
+
You can install it by opening a terminal window and running the
|
|
39
|
+
following command:
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
```sh
|
|
42
|
+
npm install -g jasmine
|
|
43
|
+
```
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
Run the test suite from the exercise directory with:
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
```sh
|
|
48
|
+
jasmine accumulate.spec.js
|
|
49
|
+
```
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
changing `xit` to `it`.
|
|
51
|
+
In many test suites all but the first test have been marked "pending".
|
|
52
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
|
53
53
|
|
|
54
54
|
## Source
|
|
55
55
|
|
|
@@ -7,29 +7,31 @@ Techies love their TLA (Three Letter Acronyms)!
|
|
|
7
7
|
Help generate some jargon by writing a program that converts a long name
|
|
8
8
|
like Portable Network Graphics to its acronym (PNG).
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
## Setup
|
|
12
11
|
|
|
13
|
-
Go through the setup instructions for JavaScript to
|
|
14
|
-
|
|
12
|
+
Go through the setup instructions for JavaScript to install the
|
|
13
|
+
necessary dependencies:
|
|
15
14
|
|
|
16
15
|
http://exercism.io/languages/javascript/installation
|
|
17
16
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
Execute the tests with:
|
|
17
|
+
## Running the test suite
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
|
20
|
+
You can install it by opening a terminal window and running the
|
|
21
|
+
following command:
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
```sh
|
|
24
|
+
npm install -g jasmine
|
|
25
|
+
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Run the test suite from the exercise directory with:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
```sh
|
|
30
|
+
jasmine acronym.spec.js
|
|
31
|
+
```
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
changing `xit` to `it`.
|
|
33
|
+
In many test suites all but the first test have been marked "pending".
|
|
34
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
|
33
35
|
|
|
34
36
|
## Source
|
|
35
37
|
|