trackler 2.0.6.5 → 2.0.6.6
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/tracks/haskell/.travis.yml +22 -1
- data/tracks/haskell/README.md +8 -2
- data/tracks/haskell/SETUP.md +1 -1
- data/tracks/haskell/exercises/TRACK_HINTS.md +52 -0
- data/tracks/haskell/exercises/allergies/.meta/DONT-TEST-STUB +1 -0
- data/tracks/haskell/exercises/allergies/HINTS.md +3 -2
- data/tracks/haskell/exercises/allergies/src/Allergies.hs +2 -0
- data/tracks/haskell/exercises/bank-account/HINTS.md +3 -2
- data/tracks/haskell/exercises/bank-account/src/BankAccount.hs +2 -0
- data/tracks/haskell/exercises/clock/.meta/DONT-TEST-STUB +1 -0
- data/tracks/haskell/exercises/clock/HINTS.md +3 -2
- data/tracks/haskell/exercises/clock/src/Clock.hs +2 -0
- data/tracks/haskell/exercises/grade-school/.meta/DONT-TEST-STUB +2 -0
- data/tracks/haskell/exercises/grade-school/HINTS.md +4 -0
- data/tracks/haskell/exercises/grade-school/src/School.hs +2 -0
- data/tracks/haskell/exercises/largest-series-product/src/Series.hs +1 -0
- data/tracks/haskell/exercises/linked-list/HINTS.md +3 -2
- data/tracks/haskell/exercises/linked-list/src/Deque.hs +2 -0
- data/tracks/haskell/exercises/matrix/HINTS.md +3 -2
- data/tracks/haskell/exercises/matrix/src/Matrix.hs +2 -0
- data/tracks/haskell/exercises/meetup/.meta/DONT-TEST-STUB +2 -0
- data/tracks/haskell/exercises/meetup/HINTS.md +3 -2
- data/tracks/haskell/exercises/meetup/src/Meetup.hs +3 -0
- data/tracks/haskell/exercises/pythagorean-triplet/.meta/DONT-TEST-STUB +2 -0
- data/tracks/haskell/exercises/robot-name/HINTS.md +3 -2
- data/tracks/haskell/exercises/robot-name/src/Robot.hs +2 -0
- data/tracks/haskell/exercises/robot-simulator/HINTS.md +3 -2
- data/tracks/haskell/exercises/robot-simulator/src/Robot.hs +2 -0
- data/tracks/haskell/exercises/secret-handshake/.meta/DONT-TEST-STUB +1 -0
- data/tracks/haskell/exercises/simple-linked-list/HINTS.md +3 -2
- data/tracks/haskell/exercises/simple-linked-list/src/LinkedList.hs +2 -0
- data/tracks/haskell/exercises/space-age/.meta/DONT-TEST-STUB +1 -0
- data/tracks/haskell/exercises/sublist/HINTS.md +1 -2
- data/tracks/haskell/exercises/sublist/src/Sublist.hs +3 -0
- data/tracks/haskell/exercises/zipper/src/Zipper.hs +2 -0
- data/tracks/java/exercises/simple-cipher/HINT.md +6 -0
- data/tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepOneTest.java +41 -0
- data/tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java +63 -0
- data/tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepTwoTest.java +86 -0
- data/tracks/lua/exercises/ocr-numbers/example.lua +4 -0
- data/tracks/lua/exercises/ocr-numbers/ocr-numbers_spec.lua +20 -0
- data/tracks/pascal/img/icon.png +0 -0
- metadata +15 -6
- data/tracks/java/exercises/simple-cipher/src/test/java/IncorrectKeyCipherTest.java +0 -35
- data/tracks/java/exercises/simple-cipher/src/test/java/RandomKeyCipherTest.java +0 -62
- data/tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherTest.java +0 -11
- data/tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a21f979fb3f1492834008a98a524077cff2d0b2
|
4
|
+
data.tar.gz: 10ff768afd6613b122020ff2a9054101f3886244
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4626e4391ae111a17500f5eadd483a10a95a4436c9d2c9e687729821a2d80d3a3adb4de1532acb9d4227f30f880479c406b6ab85fd48e59ddc3e90b80f1bdfab
|
7
|
+
data.tar.gz: 784fc5dc94f2fefe34ce60955ff9182ed2d3599c735097b2ff3d35305c572e8ac834f659912afde3031249197172cfac7e322754cb01acb8a33be08416175e62
|
data/lib/trackler/version.rb
CHANGED
data/tracks/haskell/.travis.yml
CHANGED
@@ -49,10 +49,31 @@ script:
|
|
49
49
|
--pedantic `# Enable -Wall and -Werror. `
|
50
50
|
}
|
51
51
|
|
52
|
-
for exercise in ${TRAVIS_BUILD_DIR}/exercises
|
52
|
+
for exercise in ${TRAVIS_BUILD_DIR}/exercises/*/ ; do
|
53
53
|
exercisename=$(basename "$exercise")
|
54
54
|
pushd ${exercise}
|
55
55
|
|
56
|
+
examplename="stub"
|
57
|
+
buildfolder="${TRAVIS_BUILD_DIR}/build/${exercisename}/${examplename}"
|
58
|
+
mkdir -p "${buildfolder}"
|
59
|
+
cp -rL stack.yaml package.yaml src test "${buildfolder}"
|
60
|
+
|
61
|
+
pushd $buildfolder
|
62
|
+
|
63
|
+
examplecache="${HOME}/.foldercache/${exercisename}/${examplename}/.stack-work"
|
64
|
+
mkdir -p "$examplecache"
|
65
|
+
ln -f -s "$examplecache"
|
66
|
+
|
67
|
+
if [ -f "${exercise}/.meta/DONT-TEST-STUB" ]; then
|
68
|
+
echo "only building stub"
|
69
|
+
stack build ${SET_RESOLVER} --install-ghc --no-terminal
|
70
|
+
else
|
71
|
+
echo "testing stub"
|
72
|
+
stack test ${SET_RESOLVER} --install-ghc --no-terminal --no-run-tests
|
73
|
+
fi
|
74
|
+
|
75
|
+
popd
|
76
|
+
|
56
77
|
if ! stat -t examples/*/ > /dev/null 2>&1; then
|
57
78
|
echo "No examples for ${exercise}!"
|
58
79
|
exit 1
|
data/tracks/haskell/README.md
CHANGED
@@ -63,7 +63,6 @@ Note that the whole test suite must run with the sample solution within a couple
|
|
63
63
|
├── .travis.yml
|
64
64
|
├── LICENSE
|
65
65
|
├── README.md
|
66
|
-
├── SETUP.md
|
67
66
|
├── bin
|
68
67
|
│ └── fetch‐configlet
|
69
68
|
├── config.json
|
@@ -74,6 +73,7 @@ Note that the whole test suite must run with the sample solution within a couple
|
|
74
73
|
│ ├── RESOURCES.md
|
75
74
|
│ └── TESTS.md
|
76
75
|
└── exercises
|
76
|
+
├── TRACK_HINTS.md
|
77
77
|
└── accumulate
|
78
78
|
│ ├── HINTS.md
|
79
79
|
│ ├── package.yaml
|
@@ -116,7 +116,13 @@ To fix a bug you should [create a pull request from a fork](https://help.github.
|
|
116
116
|
You should have [Stack](http://docs.haskellstack.org/) installed in your system to make contributing to this repository easier.
|
117
117
|
|
118
118
|
### Stub solution
|
119
|
-
The stub solution
|
119
|
+
The stub solution should be as general as possible in order to not exclude any possible solutions. It should take Haskell specifics into account (for example use `Maybe` instead of a dummy return value). It should not contain any comments (people might forget to remove them), you can use the hints file instead.
|
120
|
+
|
121
|
+
The stub solution must compile by itself (with `stack build`).
|
122
|
+
Ideally, it would also compile together with the test suite (with `stack test --no-run-tests`).
|
123
|
+
These two conditions are enforced by Travis.
|
124
|
+
If the second condition cannot be met for a good reason, place the explanation in `.meta/DONT-TEST-STUB` to circumvent the check.
|
125
|
+
The first condition is always enforced and cannot be circumvented.
|
120
126
|
|
121
127
|
### Example solution
|
122
128
|
The example solution could be inspiration for other language implementors. It doesn't need to be perfect or very elegant. But it should be efficient enough for the test suite to finish in only a few seconds.
|
data/tracks/haskell/SETUP.md
CHANGED
@@ -49,4 +49,4 @@ The [exercism/xhaskell](https://github.com/exercism/xhaskell) repository on
|
|
49
49
|
GitHub is the home for all of the Haskell exercises.
|
50
50
|
|
51
51
|
If you have feedback about an exercise, or want to help implementing a new
|
52
|
-
one, head over there and create an issue.
|
52
|
+
one, head over there and create an issue. We'll do our best to help you!
|
@@ -0,0 +1,52 @@
|
|
1
|
+
|
2
|
+
## Getting Started
|
3
|
+
|
4
|
+
For installation and learning resources, refer to the
|
5
|
+
[exercism help page](http://exercism.io/languages/haskell).
|
6
|
+
|
7
|
+
## Running the tests
|
8
|
+
|
9
|
+
To run the test suite, execute the following command:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
stack test
|
13
|
+
```
|
14
|
+
|
15
|
+
#### If you get an error message like this...
|
16
|
+
|
17
|
+
```
|
18
|
+
No .cabal file found in directory
|
19
|
+
```
|
20
|
+
|
21
|
+
You are probably running an old stack version and need
|
22
|
+
to upgrade it.
|
23
|
+
|
24
|
+
#### Otherwise, if you get an error message like this...
|
25
|
+
|
26
|
+
```
|
27
|
+
No compiler found, expected minor version match with...
|
28
|
+
Try running "stack setup" to install the correct GHC...
|
29
|
+
```
|
30
|
+
|
31
|
+
Just do as it says and it will download and install
|
32
|
+
the correct compiler version:
|
33
|
+
|
34
|
+
```bash
|
35
|
+
stack setup
|
36
|
+
```
|
37
|
+
|
38
|
+
## Running *GHCi*
|
39
|
+
|
40
|
+
If you want to play with your solution in GHCi, just run the command:
|
41
|
+
|
42
|
+
```bash
|
43
|
+
stack ghci
|
44
|
+
```
|
45
|
+
|
46
|
+
## Feedback, Issues, Pull Requests
|
47
|
+
|
48
|
+
The [exercism/xhaskell](https://github.com/exercism/xhaskell) repository on
|
49
|
+
GitHub is the home for all of the Haskell exercises.
|
50
|
+
|
51
|
+
If you have feedback about an exercise, or want to help implementing a new
|
52
|
+
one, head over there and create an issue. We'll do our best to help you!
|
@@ -0,0 +1 @@
|
|
1
|
+
We would have to export all the allergens in the stub; let students figure that out.
|
@@ -6,5 +6,6 @@ with `Eq` and `Show` instances, and implement the following functions:
|
|
6
6
|
- `allergies`
|
7
7
|
- `isAllergicTo`
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
You will find a dummy data declaration and type signatures already in place,
|
10
|
+
but it is up to you to define the functions and create a meaningful data type,
|
11
|
+
newtype or type synonym.
|
@@ -11,5 +11,6 @@ The amount may be negative for a withdrawal.
|
|
11
11
|
|
12
12
|
The initial balance of the bank account should be 0.
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
You will find a dummy data declaration and type signatures already in place,
|
15
|
+
but it is up to you to define the functions and create a meaningful data type,
|
16
|
+
newtype or type synonym.
|
@@ -0,0 +1 @@
|
|
1
|
+
We ask for the Clock to be an instance of Num; let students figure this out.
|
@@ -12,5 +12,6 @@ The function `fromInteger`, from `Num`, must convert minutes
|
|
12
12
|
to 24 hour clock time. It is not necessary to have a sensible
|
13
13
|
implementation of `abs` or `signum`.
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
You will find a dummy data declaration and type signatures already in place,
|
16
|
+
but it is up to you to define the functions and create a meaningful data type,
|
17
|
+
newtype or type synonym.
|
@@ -9,5 +9,6 @@ and implement the following functions:
|
|
9
9
|
- `unshift`
|
10
10
|
- `shift`
|
11
11
|
|
12
|
-
You will find
|
13
|
-
to define the functions
|
12
|
+
You will find a dummy data declaration and type signatures already in place,
|
13
|
+
but it is up to you to define the functions and create a meaningful data type,
|
14
|
+
newtype or type synonym.
|
@@ -14,8 +14,9 @@ with `Eq` and `Show` instances, and implement the following functions:
|
|
14
14
|
- `shape`
|
15
15
|
- `transpose`
|
16
16
|
|
17
|
-
You will find
|
18
|
-
to define the functions
|
17
|
+
You will find a dummy data declaration and type signatures already in place,
|
18
|
+
but it is up to you to define the functions and create a meaningful data type,
|
19
|
+
newtype or type synonym.
|
19
20
|
|
20
21
|
No validation of input is required. Let it fail if the matrix is not
|
21
22
|
rectangular, invalid chars are encountered, etc.
|
@@ -3,5 +3,6 @@
|
|
3
3
|
To complete this exercise, you need to create the data types `Weekday`
|
4
4
|
and `Schedule`, and implement the function `meetupDay`.
|
5
5
|
|
6
|
-
You will find the type signature for `meetupDay`
|
7
|
-
but it is up to you to define the function
|
6
|
+
You will find the type signature for `meetupDay` and dummy data declarations
|
7
|
+
already in place, but it is up to you to define the function and create
|
8
|
+
meaningful data types, newtypes or type synonyms.
|
@@ -7,5 +7,6 @@ as a mutable variable, and implement the following functions:
|
|
7
7
|
- `resetName`
|
8
8
|
- `robotName`
|
9
9
|
|
10
|
-
You will find
|
11
|
-
to define the functions
|
10
|
+
You will find a dummy data declaration and type signatures already in place,
|
11
|
+
but it is up to you to define the functions and create a meaningful data type,
|
12
|
+
newtype or type synonym.
|
@@ -10,5 +10,6 @@ and implement the following functions:
|
|
10
10
|
- `turnLeft`
|
11
11
|
- `turnRight`
|
12
12
|
|
13
|
-
You will find
|
14
|
-
to define the functions
|
13
|
+
You will find a dummy data declaration and type signatures already in place,
|
14
|
+
but it is up to you to define the functions and create a meaningful data type,
|
15
|
+
newtype or type synonym.
|
@@ -0,0 +1 @@
|
|
1
|
+
No signature, so students can figure out accepting strings and ints.
|
@@ -12,5 +12,6 @@ and implement the following functions:
|
|
12
12
|
- `reverseLinkedList`
|
13
13
|
- `toList`
|
14
14
|
|
15
|
-
You will find
|
16
|
-
to define the functions
|
15
|
+
You will find a dummy data declaration and type signatures already in place,
|
16
|
+
but it is up to you to define the functions and create a meaningful data type,
|
17
|
+
newtype or type synonym.
|
@@ -0,0 +1 @@
|
|
1
|
+
We would have to export all the planets in the stub; let students figure that out.
|
@@ -0,0 +1,41 @@
|
|
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
|
+
/**
|
8
|
+
* Step 1: Make a simple shift cipher
|
9
|
+
*/
|
10
|
+
public class SimpleCipherStepOneTest {
|
11
|
+
private Cipher cipherWithDefaultKey;
|
12
|
+
|
13
|
+
@Before
|
14
|
+
public void setup() {
|
15
|
+
cipherWithDefaultKey = new Cipher();
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Here we take advantage of the fact that plaintext of "aaa..." doesn't output the key. This is a critical problem
|
20
|
+
* with shift ciphers, some characters will always output the key verbatim.
|
21
|
+
*/
|
22
|
+
@Test
|
23
|
+
public void cipherCanEncode() {
|
24
|
+
String cipherText = cipherWithDefaultKey.getKey().substring(0, 10);
|
25
|
+
assertEquals(cipherText, cipherWithDefaultKey.encode("aaaaaaaaaa"));
|
26
|
+
}
|
27
|
+
|
28
|
+
@Ignore
|
29
|
+
@Test
|
30
|
+
public void cipherCanDecode() {
|
31
|
+
String cipherText = "aaaaaaaaaa";
|
32
|
+
assertEquals(cipherText, cipherWithDefaultKey.decode(cipherWithDefaultKey.getKey().substring(0, 10)));
|
33
|
+
}
|
34
|
+
|
35
|
+
@Ignore
|
36
|
+
@Test
|
37
|
+
public void cipherIsReversible() {
|
38
|
+
String plainText = "abcdefghij";
|
39
|
+
assertEquals(plainText, cipherWithDefaultKey.decode(cipherWithDefaultKey.encode(plainText)));
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import org.junit.Ignore;
|
2
|
+
import org.junit.Rule;
|
3
|
+
import org.junit.Test;
|
4
|
+
import org.junit.rules.ExpectedException;
|
5
|
+
|
6
|
+
import static org.junit.Assert.*;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Step 3: Generate random key if key isn't specified. Check key is right format
|
10
|
+
*/
|
11
|
+
public class SimpleCipherStepThreeTest {
|
12
|
+
@Rule
|
13
|
+
public ExpectedException expectedException = ExpectedException.none();
|
14
|
+
|
15
|
+
@Ignore
|
16
|
+
@Test
|
17
|
+
public void cipherKeyIsMadeOfLetters() {
|
18
|
+
assertTrue(new Cipher().getKey().matches("[a-z]+"));
|
19
|
+
}
|
20
|
+
|
21
|
+
@Ignore
|
22
|
+
@Test
|
23
|
+
public void defaultCipherKeyIs100Characters() {
|
24
|
+
assertEquals(100, new Cipher().getKey().length());
|
25
|
+
}
|
26
|
+
|
27
|
+
@Ignore
|
28
|
+
@Test
|
29
|
+
public void cipherKeysAreRandomlyGenerated() {
|
30
|
+
String newKey = new Cipher().getKey();
|
31
|
+
assertFalse("Cipher constructor without argument should generate a random key. No two calls to the" +
|
32
|
+
" constructor should generate the same key. Two calls to the constructor " +
|
33
|
+
"both returned key: " + newKey, newKey.equals(new Cipher().getKey()));
|
34
|
+
}
|
35
|
+
|
36
|
+
@Ignore
|
37
|
+
@Test
|
38
|
+
public void cipherThrowsWithAllCapsKey() {
|
39
|
+
expectedException.expect(IllegalArgumentException.class);
|
40
|
+
new Cipher("ABCDEF");
|
41
|
+
}
|
42
|
+
|
43
|
+
@Ignore
|
44
|
+
@Test
|
45
|
+
public void cipherThrowsWithAnyCapsKey() {
|
46
|
+
expectedException.expect(IllegalArgumentException.class);
|
47
|
+
new Cipher("abcdEFg");
|
48
|
+
}
|
49
|
+
|
50
|
+
@Ignore
|
51
|
+
@Test
|
52
|
+
public void cipherThrowsWithNumericKey() {
|
53
|
+
expectedException.expect(IllegalArgumentException.class);
|
54
|
+
new Cipher("12345");
|
55
|
+
}
|
56
|
+
|
57
|
+
@Ignore
|
58
|
+
@Test
|
59
|
+
public void cipherThrowsWithAnyNumericKey() {
|
60
|
+
expectedException.expect(IllegalArgumentException.class);
|
61
|
+
new Cipher("abcd345ef");
|
62
|
+
}
|
63
|
+
}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import org.junit.Before;
|
2
|
+
import org.junit.Ignore;
|
3
|
+
import org.junit.Rule;
|
4
|
+
import org.junit.Test;
|
5
|
+
import org.junit.rules.ExpectedException;
|
6
|
+
|
7
|
+
import static org.junit.Assert.assertEquals;
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Step 2: Specify key and use that for shift distance : substitution cipher
|
11
|
+
*/
|
12
|
+
public class SimpleCipherStepTwoTest {
|
13
|
+
private Cipher cipherWithSetKey;
|
14
|
+
private static final String key = "abcdefghij";
|
15
|
+
|
16
|
+
@Rule
|
17
|
+
public ExpectedException expectedException = ExpectedException.none();
|
18
|
+
|
19
|
+
@Before
|
20
|
+
public void setup() {
|
21
|
+
cipherWithSetKey = new Cipher(key);
|
22
|
+
}
|
23
|
+
|
24
|
+
@Ignore
|
25
|
+
@Test
|
26
|
+
public void cipherKeepsTheSubmittedKey() {
|
27
|
+
assertEquals(key, cipherWithSetKey.getKey());
|
28
|
+
}
|
29
|
+
|
30
|
+
@Ignore
|
31
|
+
@Test
|
32
|
+
public void cipherThrowsWithEmptyKey() {
|
33
|
+
expectedException.expect(IllegalArgumentException.class);
|
34
|
+
new Cipher("");
|
35
|
+
}
|
36
|
+
|
37
|
+
@Ignore
|
38
|
+
@Test
|
39
|
+
public void cipherCanEncodeWithGivenKey() {
|
40
|
+
String cipherText = "abcdefghij";
|
41
|
+
assertEquals(cipherText, cipherWithSetKey.encode("aaaaaaaaaa"));
|
42
|
+
}
|
43
|
+
|
44
|
+
@Ignore
|
45
|
+
@Test
|
46
|
+
public void cipherCanDecodeWithGivenKey() {
|
47
|
+
String cipherText = "aaaaaaaaaa";
|
48
|
+
assertEquals(cipherText, cipherWithSetKey.decode("abcdefghij"));
|
49
|
+
}
|
50
|
+
|
51
|
+
@Ignore
|
52
|
+
@Test
|
53
|
+
public void cipherIsReversibleGivenKey() {
|
54
|
+
String plainText = "abcdefghij";
|
55
|
+
assertEquals(plainText, cipherWithSetKey.decode(cipherWithSetKey.encode("abcdefghij")));
|
56
|
+
}
|
57
|
+
|
58
|
+
@Ignore
|
59
|
+
@Test
|
60
|
+
public void cipherCanWrapEncode() {
|
61
|
+
String cipherText = "zabcdefghi";
|
62
|
+
assertEquals(cipherText, cipherWithSetKey.encode("zzzzzzzzzz"));
|
63
|
+
}
|
64
|
+
|
65
|
+
@Ignore
|
66
|
+
@Test
|
67
|
+
public void cipherCanEncodeMessageThatIsShorterThanTheKey() {
|
68
|
+
String cipherText = "abcde";
|
69
|
+
assertEquals(cipherText, cipherWithSetKey.encode("aaaaa"));
|
70
|
+
}
|
71
|
+
|
72
|
+
@Ignore
|
73
|
+
@Test
|
74
|
+
public void cipherCanDecodeMessageThatIsShorterThanTheKey() {
|
75
|
+
String cipherText = "aaaaa";
|
76
|
+
assertEquals(cipherText, cipherWithSetKey.decode("abcde"));
|
77
|
+
}
|
78
|
+
|
79
|
+
@Ignore
|
80
|
+
@Test
|
81
|
+
public void cipherCanDoubleShiftEncode() {
|
82
|
+
String plainText = "iamapandabear";
|
83
|
+
String cipherText = "qayaeaagaciai";
|
84
|
+
assertEquals(cipherText, new Cipher(plainText).encode(plainText));
|
85
|
+
}
|
86
|
+
}
|
@@ -66,6 +66,7 @@ local row_pattern = ('[^\n]+\n'):rep(4) .. '*'
|
|
66
66
|
local function lines(s)
|
67
67
|
local lines = {}
|
68
68
|
for line in s:gmatch('[^\n]+') do
|
69
|
+
assert(#line % 3 == 0)
|
69
70
|
table.insert(lines, line)
|
70
71
|
end
|
71
72
|
return lines
|
@@ -74,6 +75,9 @@ end
|
|
74
75
|
local function parse(row)
|
75
76
|
local result = ''
|
76
77
|
local lines = lines(row)
|
78
|
+
assert(#lines[1] == #lines[2] and
|
79
|
+
#lines[2] == #lines[3] and
|
80
|
+
#lines[3] == #lines[4])
|
77
81
|
for i = 1, #lines[1], 3 do
|
78
82
|
local character = ''
|
79
83
|
for line = 1, 4 do
|
@@ -158,4 +158,24 @@ describe('ocr-numbers', function()
|
|
158
158
|
)
|
159
159
|
assert.equal('123,456,789', actual)
|
160
160
|
end)
|
161
|
+
|
162
|
+
it('should generate error if input is incorrectly sized', function()
|
163
|
+
assert.has_error(function() ocr.convert(
|
164
|
+
' _ \n' ..
|
165
|
+
'||\n' ..
|
166
|
+
'|_|\n' ..
|
167
|
+
' ') end)
|
168
|
+
|
169
|
+
assert.has_error(function() ocr.convert(
|
170
|
+
' _ \n' ..
|
171
|
+
' | _| _|\n' ..
|
172
|
+
' |_ _|\n' ..
|
173
|
+
' \n') end)
|
174
|
+
|
175
|
+
assert.has_error(function() ocr.convert(
|
176
|
+
' _ _ \n' ..
|
177
|
+
' | _| _|\n' ..
|
178
|
+
' ||_ \n' ..
|
179
|
+
' \n') end)
|
180
|
+
end)
|
161
181
|
end)
|
Binary file
|
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.0.6.
|
4
|
+
version: 2.0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -2945,6 +2945,7 @@ files:
|
|
2945
2945
|
- tracks/haskell/docs/LEARNING.md
|
2946
2946
|
- tracks/haskell/docs/RESOURCES.md
|
2947
2947
|
- tracks/haskell/docs/TESTS.md
|
2948
|
+
- tracks/haskell/exercises/TRACK_HINTS.md
|
2948
2949
|
- tracks/haskell/exercises/accumulate/examples/success-standard/package.yaml
|
2949
2950
|
- tracks/haskell/exercises/accumulate/examples/success-standard/src/Accumulate.hs
|
2950
2951
|
- tracks/haskell/exercises/accumulate/package.yaml
|
@@ -2957,6 +2958,7 @@ files:
|
|
2957
2958
|
- tracks/haskell/exercises/all-your-base/src/Base.hs
|
2958
2959
|
- tracks/haskell/exercises/all-your-base/stack.yaml
|
2959
2960
|
- tracks/haskell/exercises/all-your-base/test/Tests.hs
|
2961
|
+
- tracks/haskell/exercises/allergies/.meta/DONT-TEST-STUB
|
2960
2962
|
- tracks/haskell/exercises/allergies/HINTS.md
|
2961
2963
|
- tracks/haskell/exercises/allergies/examples/success-standard/package.yaml
|
2962
2964
|
- tracks/haskell/exercises/allergies/examples/success-standard/src/Allergies.hs
|
@@ -3032,6 +3034,7 @@ files:
|
|
3032
3034
|
- tracks/haskell/exercises/change/src/Change.hs
|
3033
3035
|
- tracks/haskell/exercises/change/stack.yaml
|
3034
3036
|
- tracks/haskell/exercises/change/test/Tests.hs
|
3037
|
+
- tracks/haskell/exercises/clock/.meta/DONT-TEST-STUB
|
3035
3038
|
- tracks/haskell/exercises/clock/HINTS.md
|
3036
3039
|
- tracks/haskell/exercises/clock/examples/success-standard/package.yaml
|
3037
3040
|
- tracks/haskell/exercises/clock/examples/success-standard/src/Clock.hs
|
@@ -3103,6 +3106,7 @@ files:
|
|
3103
3106
|
- tracks/haskell/exercises/go-counting/src/Counting.hs
|
3104
3107
|
- tracks/haskell/exercises/go-counting/stack.yaml
|
3105
3108
|
- tracks/haskell/exercises/go-counting/test/Tests.hs
|
3109
|
+
- tracks/haskell/exercises/grade-school/.meta/DONT-TEST-STUB
|
3106
3110
|
- tracks/haskell/exercises/grade-school/HINTS.md
|
3107
3111
|
- tracks/haskell/exercises/grade-school/examples/success-standard/package.yaml
|
3108
3112
|
- tracks/haskell/exercises/grade-school/examples/success-standard/src/School.hs
|
@@ -3186,6 +3190,7 @@ files:
|
|
3186
3190
|
- tracks/haskell/exercises/matrix/src/Matrix.hs
|
3187
3191
|
- tracks/haskell/exercises/matrix/stack.yaml
|
3188
3192
|
- tracks/haskell/exercises/matrix/test/Tests.hs
|
3193
|
+
- tracks/haskell/exercises/meetup/.meta/DONT-TEST-STUB
|
3189
3194
|
- tracks/haskell/exercises/meetup/HINTS.md
|
3190
3195
|
- tracks/haskell/exercises/meetup/examples/success-standard/package.yaml
|
3191
3196
|
- tracks/haskell/exercises/meetup/examples/success-standard/src/Meetup.hs
|
@@ -3269,6 +3274,7 @@ files:
|
|
3269
3274
|
- tracks/haskell/exercises/prime-factors/src/PrimeFactors.hs
|
3270
3275
|
- tracks/haskell/exercises/prime-factors/stack.yaml
|
3271
3276
|
- tracks/haskell/exercises/prime-factors/test/Tests.hs
|
3277
|
+
- tracks/haskell/exercises/pythagorean-triplet/.meta/DONT-TEST-STUB
|
3272
3278
|
- tracks/haskell/exercises/pythagorean-triplet/examples/success-standard/package.yaml
|
3273
3279
|
- tracks/haskell/exercises/pythagorean-triplet/examples/success-standard/src/Triplet.hs
|
3274
3280
|
- tracks/haskell/exercises/pythagorean-triplet/package.yaml
|
@@ -3339,6 +3345,7 @@ files:
|
|
3339
3345
|
- tracks/haskell/exercises/scrabble-score/src/Scrabble.hs
|
3340
3346
|
- tracks/haskell/exercises/scrabble-score/stack.yaml
|
3341
3347
|
- tracks/haskell/exercises/scrabble-score/test/Tests.hs
|
3348
|
+
- tracks/haskell/exercises/secret-handshake/.meta/DONT-TEST-STUB
|
3342
3349
|
- tracks/haskell/exercises/secret-handshake/HINTS.md
|
3343
3350
|
- tracks/haskell/exercises/secret-handshake/examples/success-standard/package.yaml
|
3344
3351
|
- tracks/haskell/exercises/secret-handshake/examples/success-standard/src/SecretHandshake.hs
|
@@ -3381,6 +3388,7 @@ files:
|
|
3381
3388
|
- tracks/haskell/exercises/simple-linked-list/src/LinkedList.hs
|
3382
3389
|
- tracks/haskell/exercises/simple-linked-list/stack.yaml
|
3383
3390
|
- tracks/haskell/exercises/simple-linked-list/test/Tests.hs
|
3391
|
+
- tracks/haskell/exercises/space-age/.meta/DONT-TEST-STUB
|
3384
3392
|
- tracks/haskell/exercises/space-age/HINTS.md
|
3385
3393
|
- tracks/haskell/exercises/space-age/examples/success-double/package.yaml
|
3386
3394
|
- tracks/haskell/exercises/space-age/examples/success-double/src/SpaceAge.hs
|
@@ -3710,13 +3718,13 @@ files:
|
|
3710
3718
|
- tracks/java/exercises/sieve/src/example/java/Sieve.java
|
3711
3719
|
- tracks/java/exercises/sieve/src/main/java/.keep
|
3712
3720
|
- tracks/java/exercises/sieve/src/test/java/SieveTest.java
|
3721
|
+
- tracks/java/exercises/simple-cipher/HINT.md
|
3713
3722
|
- tracks/java/exercises/simple-cipher/build.gradle
|
3714
3723
|
- tracks/java/exercises/simple-cipher/src/example/java/Cipher.java
|
3715
3724
|
- tracks/java/exercises/simple-cipher/src/main/java/.keep
|
3716
|
-
- tracks/java/exercises/simple-cipher/src/test/java/
|
3717
|
-
- tracks/java/exercises/simple-cipher/src/test/java/
|
3718
|
-
- tracks/java/exercises/simple-cipher/src/test/java/
|
3719
|
-
- tracks/java/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java
|
3725
|
+
- tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepOneTest.java
|
3726
|
+
- tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepThreeTest.java
|
3727
|
+
- tracks/java/exercises/simple-cipher/src/test/java/SimpleCipherStepTwoTest.java
|
3720
3728
|
- tracks/java/exercises/simple-linked-list/build.gradle
|
3721
3729
|
- tracks/java/exercises/simple-linked-list/src/example/java/SimpleLinkedList.java
|
3722
3730
|
- tracks/java/exercises/simple-linked-list/src/main/java/.keep
|
@@ -5127,6 +5135,7 @@ files:
|
|
5127
5135
|
- tracks/pascal/exercises/phone-number/uPhoneNumberExample.pas
|
5128
5136
|
- tracks/pascal/exercises/phone-number/uPhoneNumberTests.pas
|
5129
5137
|
- tracks/pascal/img/.keep
|
5138
|
+
- tracks/pascal/img/icon.png
|
5130
5139
|
- tracks/perl5/.git
|
5131
5140
|
- tracks/perl5/.gitignore
|
5132
5141
|
- tracks/perl5/.travis.yml
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import org.junit.Test;
|
2
|
-
import org.junit.Ignore;
|
3
|
-
|
4
|
-
public class IncorrectKeyCipherTest {
|
5
|
-
|
6
|
-
|
7
|
-
@Test(expected = IllegalArgumentException.class)
|
8
|
-
public void cipherThrowsWithAllCapsKey() {
|
9
|
-
new Cipher("ABCDEF");
|
10
|
-
}
|
11
|
-
|
12
|
-
@Ignore
|
13
|
-
@Test(expected = IllegalArgumentException.class)
|
14
|
-
public void cipherThrowsWithAnyCapsKey() {
|
15
|
-
new Cipher("abcdEFg");
|
16
|
-
}
|
17
|
-
|
18
|
-
@Ignore
|
19
|
-
@Test(expected = IllegalArgumentException.class)
|
20
|
-
public void cipherThrowsWithNumericKey() {
|
21
|
-
new Cipher("12345");
|
22
|
-
}
|
23
|
-
|
24
|
-
@Ignore
|
25
|
-
@Test(expected = IllegalArgumentException.class)
|
26
|
-
public void cipherThrowsWithAnyNumericKey() {
|
27
|
-
new Cipher("abcd345ef");
|
28
|
-
}
|
29
|
-
|
30
|
-
@Ignore
|
31
|
-
@Test(expected = IllegalArgumentException.class)
|
32
|
-
public void cipherThrowsWithEmptyKey() {
|
33
|
-
new Cipher("");
|
34
|
-
}
|
35
|
-
}
|
@@ -1,62 +0,0 @@
|
|
1
|
-
import org.junit.Before;
|
2
|
-
import org.junit.Test;
|
3
|
-
import org.junit.Ignore;
|
4
|
-
|
5
|
-
import static org.junit.Assert.assertEquals;
|
6
|
-
import static org.junit.Assert.assertTrue;
|
7
|
-
|
8
|
-
public class RandomKeyCipherTest {
|
9
|
-
|
10
|
-
private Cipher cipher;
|
11
|
-
|
12
|
-
@Before
|
13
|
-
public void setup() {
|
14
|
-
this.cipher = new Cipher();
|
15
|
-
}
|
16
|
-
|
17
|
-
|
18
|
-
@Test
|
19
|
-
public void cipherKeyIsMadeOfLetters() {
|
20
|
-
assertTrue(cipher.getKey().matches("[a-z]+"));
|
21
|
-
}
|
22
|
-
|
23
|
-
@Ignore
|
24
|
-
@Test
|
25
|
-
public void defaultCipherKeyIs100Characters() {
|
26
|
-
assertEquals(100, cipher.getKey().length());
|
27
|
-
}
|
28
|
-
|
29
|
-
@Ignore
|
30
|
-
@Test
|
31
|
-
public void cipherKeysAreRandomlyGenerated() {
|
32
|
-
assertTrue(!(new Cipher().getKey().equals(cipher.getKey())));
|
33
|
-
}
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Here we take advantage of the fact that plaintext of "aaa..." doesn't output the key. This is a critical problem
|
37
|
-
* with shift ciphers, some characters will always output the key verbatim.
|
38
|
-
*/
|
39
|
-
@Ignore
|
40
|
-
@Test
|
41
|
-
public void cipherCanEncode() {
|
42
|
-
String expectedOutput = cipher.getKey().substring(0, 10);
|
43
|
-
|
44
|
-
assertEquals(expectedOutput, cipher.encode("aaaaaaaaaa"));
|
45
|
-
}
|
46
|
-
|
47
|
-
@Ignore
|
48
|
-
@Test
|
49
|
-
public void cipherCanDecode() {
|
50
|
-
String expectedOutput = "aaaaaaaaaa";
|
51
|
-
|
52
|
-
assertEquals(expectedOutput, cipher.decode(cipher.getKey().substring(0, 10)));
|
53
|
-
}
|
54
|
-
|
55
|
-
@Ignore
|
56
|
-
@Test
|
57
|
-
public void cipherIsReversible() {
|
58
|
-
String plainText = "abcdefghij";
|
59
|
-
|
60
|
-
assertEquals(plainText, cipher.decode(cipher.encode(plainText)));
|
61
|
-
}
|
62
|
-
}
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import org.junit.Before;
|
2
|
-
import org.junit.Test;
|
3
|
-
import org.junit.Ignore;
|
4
|
-
|
5
|
-
import static org.junit.Assert.assertEquals;
|
6
|
-
|
7
|
-
public class SubstitutionCipherTest {
|
8
|
-
|
9
|
-
private static final String KEY = "abcdefghij";
|
10
|
-
private Cipher cipher;
|
11
|
-
|
12
|
-
@Before
|
13
|
-
public void setup() {
|
14
|
-
this.cipher = new Cipher(KEY);
|
15
|
-
}
|
16
|
-
|
17
|
-
|
18
|
-
@Test
|
19
|
-
public void cipherKeepsTheSubmittedKey() {
|
20
|
-
assertEquals(KEY, cipher.getKey());
|
21
|
-
}
|
22
|
-
|
23
|
-
@Ignore
|
24
|
-
@Test
|
25
|
-
public void cipherCanEncodeWithGivenKey() {
|
26
|
-
String expectedOutput = "abcdefghij";
|
27
|
-
|
28
|
-
assertEquals(expectedOutput, cipher.encode("aaaaaaaaaa"));
|
29
|
-
}
|
30
|
-
|
31
|
-
@Ignore
|
32
|
-
@Test
|
33
|
-
public void cipherCanDecodeWithGivenKey() {
|
34
|
-
String expectedOutput = "aaaaaaaaaa";
|
35
|
-
|
36
|
-
assertEquals(expectedOutput, cipher.decode("abcdefghij"));
|
37
|
-
}
|
38
|
-
|
39
|
-
@Ignore
|
40
|
-
@Test
|
41
|
-
public void cipherIsReversibleGivenKey() {
|
42
|
-
String plainText = "abcdefghij";
|
43
|
-
|
44
|
-
assertEquals(plainText, cipher.decode(cipher.encode("abcdefghij")));
|
45
|
-
}
|
46
|
-
|
47
|
-
@Ignore
|
48
|
-
@Test
|
49
|
-
public void cipherCanDoubleShiftEncode() {
|
50
|
-
String plainText = "iamapandabear";
|
51
|
-
String expectedOutput = "qayaeaagaciai";
|
52
|
-
|
53
|
-
assertEquals(expectedOutput, new Cipher(plainText).encode(plainText));
|
54
|
-
}
|
55
|
-
|
56
|
-
@Ignore
|
57
|
-
@Test
|
58
|
-
public void cipherCanWrapEncode() {
|
59
|
-
String expectedOutput = "zabcdefghi";
|
60
|
-
|
61
|
-
assertEquals(expectedOutput, cipher.encode("zzzzzzzzzz"));
|
62
|
-
}
|
63
|
-
|
64
|
-
@Ignore
|
65
|
-
@Test
|
66
|
-
public void cipherCanEncodeMessageThatIsShorterThanTheKey() {
|
67
|
-
String expectedOutput = "abcde";
|
68
|
-
|
69
|
-
assertEquals(expectedOutput, cipher.encode("aaaaa"));
|
70
|
-
}
|
71
|
-
|
72
|
-
@Ignore
|
73
|
-
@Test
|
74
|
-
public void cipherCanDecodeMessageThatIsShorterThanTheKey() {
|
75
|
-
String expectedOutput = "aaaaa";
|
76
|
-
|
77
|
-
assertEquals(expectedOutput, cipher.decode("abcde"));
|
78
|
-
}
|
79
|
-
}
|