trackler 2.2.1.66 → 2.2.1.67
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/README.md +1 -0
- data/tracks/bash/exercises/anagram/anagram_tests.sh +16 -0
- data/tracks/bash/exercises/bob/bob_test.sh +28 -0
- data/tracks/bash/exercises/difference-of-squares/difference_of_squares_test.sh +3 -0
- data/tracks/bash/exercises/error-handling/error_handling_test.sh +5 -0
- data/tracks/bash/exercises/gigasecond/gigasecond_test.sh +10 -0
- data/tracks/bash/exercises/hamming/hamming_test.sh +15 -0
- data/tracks/bash/exercises/leap/leap_test.sh +10 -0
- data/tracks/bash/exercises/nucleotide-count/nucleotide_count_test.sh +4 -0
- data/tracks/bash/exercises/pangram/pangram_tests.sh +9 -0
- data/tracks/bash/exercises/phone-number/phone_number_tests.sh +13 -1
- data/tracks/bash/exercises/raindrops/raindrops_test.sh +16 -0
- data/tracks/bash/exercises/rna-transcription/rna_transcription_test.sh +8 -0
- data/tracks/bash/exercises/two-fer/two_fer_test.sh +3 -0
- data/tracks/bash/exercises/word-count/word_count_test.sh +9 -1
- data/tracks/c/exercises/hello-world/src/hello_world.c +0 -2
- data/tracks/c/exercises/sieve/test/test_sieve.c +13 -16
- data/tracks/erlang/config.json +4 -4
- data/tracks/fsharp/config.json +12 -0
- data/tracks/fsharp/exercises/Exercises.sln +6 -0
- data/tracks/fsharp/exercises/rotational-cipher/Example.fs +29 -0
- data/tracks/fsharp/exercises/rotational-cipher/Program.fs +1 -0
- data/tracks/fsharp/exercises/rotational-cipher/README.md +29 -0
- data/tracks/fsharp/exercises/rotational-cipher/RotationalCipher.fs +3 -0
- data/tracks/fsharp/exercises/rotational-cipher/RotationalCipher.fsproj +23 -0
- data/tracks/fsharp/exercises/rotational-cipher/RotationalCipherTest.fs +49 -0
- data/tracks/fsharp/generators/Generators.fs +3 -0
- data/tracks/go/exercises/grains/.meta/gen.go +99 -0
- data/tracks/go/exercises/grains/cases_test.go +64 -0
- data/tracks/go/exercises/grains/grains_test.go +4 -20
- data/tracks/go/exercises/space-age/space_age_test.go +3 -1
- data/tracks/java/config.json +12 -0
- data/tracks/java/exercises/beer-song/.meta/src/reference/java/BeerSong.java +4 -4
- data/tracks/java/exercises/diamond/src/main/java/DiamondPrinter.java +9 -0
- data/tracks/java/exercises/isbn-verifier/.meta/src/reference/java/IsbnVerifier.java +35 -0
- data/tracks/java/exercises/isbn-verifier/.meta/version +1 -0
- data/tracks/java/exercises/isbn-verifier/README.md +53 -0
- data/tracks/java/exercises/isbn-verifier/build.gradle +18 -0
- data/tracks/java/exercises/isbn-verifier/src/main/java/IsbnVerifier.java +7 -0
- data/tracks/java/exercises/isbn-verifier/src/test/java/IsbnVerifierTest.java +94 -0
- data/tracks/java/exercises/isogram/src/main/java/IsogramChecker.java +7 -0
- data/tracks/java/exercises/saddle-points/src/main/java/Matrix.java +13 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/kotlin/config.json +1 -1
- data/tracks/ocaml/exercises/all-your-base/example.ml +1 -1
- data/tracks/ocaml/exercises/all-your-base/test.ml +9 -9
- data/tracks/perl6/config.json +1 -1
- data/tracks/perl6/docs/SNIPPET.txt +2 -2
- data/tracks/perl6/exercises/anagram/Anagram.pm6 +4 -1
- data/tracks/perl6/exercises/anagram/Example.pm6 +4 -15
- data/tracks/perl6/exercises/anagram/anagram.t +2 -2
- data/tracks/perl6/exercises/anagram/example.yaml +7 -15
- data/tracks/php/config.json +12 -0
- data/tracks/php/exercises/run-length-encoding/README.md +42 -0
- data/tracks/php/exercises/run-length-encoding/example.php +60 -0
- data/tracks/php/exercises/run-length-encoding/run-length-encoding.php +20 -0
- data/tracks/php/exercises/run-length-encoding/run-length-encoding_test.php +65 -0
- data/tracks/purescript/.travis.yml +1 -1
- data/tracks/purescript/bin/test.sh +9 -2
- data/tracks/python/config.json +7 -16
- data/tracks/r/exercises/hello-world/test_hello-world.R +0 -8
- data/tracks/racket/config.json +1 -1
- data/tracks/swift/config.json +12 -2
- data/tracks/swift/exercises/diamond/Package.swift +5 -0
- data/tracks/swift/exercises/diamond/README.md +64 -0
- data/tracks/swift/exercises/diamond/Sources/Diamond.swift +1 -0
- data/tracks/swift/exercises/diamond/Sources/DiamondExample.swift +30 -0
- data/tracks/swift/exercises/diamond/Tests/DiamondTests/DiamondTests.swift +98 -0
- data/tracks/swift/exercises/diamond/Tests/LinuxMain.swift +6 -0
- metadata +29 -8
- data/tracks/java/exercises/diamond/src/main/java/.keep +0 -0
- data/tracks/java/exercises/isogram/src/main/java/.keep +0 -0
- data/tracks/python/exercises/parallel-letter-frequency/README.md +0 -24
- data/tracks/python/exercises/parallel-letter-frequency/example.py +0 -56
- data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency.py +0 -2
- data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency_test.py +0 -61
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bats
|
|
2
2
|
|
|
3
3
|
@test 'Complement of cytosine is guanine' {
|
|
4
|
+
#skip
|
|
4
5
|
run bash rna_transcription.sh C
|
|
5
6
|
|
|
6
7
|
[ "$status" -eq 0 ]
|
|
@@ -8,6 +9,7 @@
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
@test 'Complement of guanine is cytosine' {
|
|
12
|
+
skip
|
|
11
13
|
run bash rna_transcription.sh G
|
|
12
14
|
|
|
13
15
|
[ "$status" -eq 0 ]
|
|
@@ -15,6 +17,7 @@
|
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
@test 'Complement of thymine is adenine' {
|
|
20
|
+
skip
|
|
18
21
|
run bash rna_transcription.sh T
|
|
19
22
|
|
|
20
23
|
[ "$status" -eq 0 ]
|
|
@@ -22,6 +25,7 @@
|
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
@test 'Complement of adenine is uracil' {
|
|
28
|
+
skip
|
|
25
29
|
run bash rna_transcription.sh A
|
|
26
30
|
|
|
27
31
|
[ "$status" -eq 0 ]
|
|
@@ -29,6 +33,7 @@
|
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
@test 'Complement of long string' {
|
|
36
|
+
skip
|
|
32
37
|
run bash rna_transcription.sh ACGTGGTCTTAA
|
|
33
38
|
|
|
34
39
|
[ "$status" -eq 0 ]
|
|
@@ -36,6 +41,7 @@
|
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
@test 'Handles invalid character' {
|
|
44
|
+
skip
|
|
39
45
|
run bash rna_transcription.sh U
|
|
40
46
|
|
|
41
47
|
[ "$status" -eq 1 ]
|
|
@@ -43,6 +49,7 @@
|
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
@test 'Handles completely invalid string' {
|
|
52
|
+
skip
|
|
46
53
|
run bash rna_transcription.sh XXXX
|
|
47
54
|
|
|
48
55
|
[ "$status" -eq 1 ]
|
|
@@ -50,6 +57,7 @@
|
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
@test 'Handles partially invalid string' {
|
|
60
|
+
skip
|
|
53
61
|
run bash rna_transcription.sh ACGTXCTTAA
|
|
54
62
|
|
|
55
63
|
[ "$status" -eq 1 ]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bats
|
|
2
2
|
|
|
3
3
|
@test "When given no name, it should have one for you!" {
|
|
4
|
+
#skip
|
|
4
5
|
run bash two_fer.sh
|
|
5
6
|
|
|
6
7
|
[ "$status" -eq 0 ]
|
|
@@ -8,6 +9,7 @@
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
@test 'When given "Alice" it should have one for Alice!' {
|
|
12
|
+
skip
|
|
11
13
|
run bash two_fer.sh Alice
|
|
12
14
|
|
|
13
15
|
[ "$status" -eq 0 ]
|
|
@@ -15,6 +17,7 @@
|
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
@test 'When given "Bob" it should have one for Bob!' {
|
|
20
|
+
skip
|
|
18
21
|
run bash two_fer.sh Bob
|
|
19
22
|
|
|
20
23
|
[ "$status" -eq 0 ]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bats
|
|
2
2
|
|
|
3
3
|
@test "count one word" {
|
|
4
|
+
#skip
|
|
4
5
|
run ./word_count.sh "word"
|
|
5
6
|
|
|
6
7
|
[ "$status" -eq 0 ]
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
@test "count one of each word" {
|
|
13
|
+
skip
|
|
12
14
|
run ./word_count.sh "one of each"
|
|
13
15
|
|
|
14
16
|
[ "$status" -eq 0 ]
|
|
@@ -19,6 +21,7 @@
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
@test "multiple occurrences of a word" {
|
|
24
|
+
skip
|
|
22
25
|
run ./word_count.sh "one fish two fish red fish blue fish"
|
|
23
26
|
|
|
24
27
|
[ "$status" -eq 0 ]
|
|
@@ -31,6 +34,7 @@
|
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
@test "handle cramped lists" {
|
|
37
|
+
skip
|
|
34
38
|
run ./word_count.sh "one,two,three"
|
|
35
39
|
|
|
36
40
|
[ "$status" -eq 0 ]
|
|
@@ -41,6 +45,7 @@
|
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
@test "ignore punctuation" {
|
|
48
|
+
skip
|
|
44
49
|
run ./word_count.sh "car: carpet as java: javascript!!&@$%^&"
|
|
45
50
|
|
|
46
51
|
[ "$status" -eq 0 ]
|
|
@@ -53,6 +58,7 @@
|
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
@test "include numbers" {
|
|
61
|
+
skip
|
|
56
62
|
run ./word_count.sh "testing, 1, 2 testing"
|
|
57
63
|
|
|
58
64
|
[ "$status" -eq 0 ]
|
|
@@ -63,6 +69,7 @@
|
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
@test "normalize case" {
|
|
72
|
+
skip
|
|
66
73
|
run ./word_count.sh "go Go GO Stop stop"
|
|
67
74
|
|
|
68
75
|
[ "$status" -eq 0 ]
|
|
@@ -72,6 +79,7 @@
|
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
@test "handle apostrophes" {
|
|
82
|
+
skip
|
|
75
83
|
run ./word_count.sh "First: don't laugh. Then: don't cry."
|
|
76
84
|
|
|
77
85
|
[ "$status" -eq 0 ]
|
|
@@ -81,4 +89,4 @@
|
|
|
81
89
|
echo $output | grep "then: 1"
|
|
82
90
|
echo $output | grep "cry: 1"
|
|
83
91
|
echo $output | wc -w | grep "10"
|
|
84
|
-
}
|
|
92
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
#include "../src/sieve.h"
|
|
4
4
|
|
|
5
5
|
static primes_array_t result_array;
|
|
6
|
+
#define ARRAY_LENGTH(x) sizeof(x)/sizeof(x[0])
|
|
6
7
|
|
|
7
8
|
void setUp(void)
|
|
8
9
|
{
|
|
@@ -15,7 +16,6 @@ void tearDown(void)
|
|
|
15
16
|
void test_no_primes_under_two(void)
|
|
16
17
|
{
|
|
17
18
|
const unsigned int limit = 1;
|
|
18
|
-
const primes_array_t expected_prime_array = { 0 };
|
|
19
19
|
const unsigned int expected_prime_count = 0;
|
|
20
20
|
unsigned int result_prime_count;
|
|
21
21
|
|
|
@@ -23,9 +23,6 @@ void test_no_primes_under_two(void)
|
|
|
23
23
|
|
|
24
24
|
result_prime_count = sieve(limit, result_array);
|
|
25
25
|
TEST_ASSERT_EQUAL(expected_prime_count, result_prime_count);
|
|
26
|
-
TEST_ASSERT_EQUAL(0,
|
|
27
|
-
memcmp(expected_prime_array, result_array,
|
|
28
|
-
sizeof(result_array)));
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
void test_find_first_prime(void)
|
|
@@ -40,9 +37,9 @@ void test_find_first_prime(void)
|
|
|
40
37
|
|
|
41
38
|
result_prime_count = sieve(limit, result_array);
|
|
42
39
|
TEST_ASSERT_EQUAL(expected_prime_count, result_prime_count);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
TEST_ASSERT_EQUAL_UINT_ARRAY(expected_prime_array, result_array,
|
|
41
|
+
ARRAY_LENGTH(expected_prime_array));
|
|
42
|
+
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
void test_find_primes_up_to_10(void)
|
|
@@ -57,9 +54,9 @@ void test_find_primes_up_to_10(void)
|
|
|
57
54
|
|
|
58
55
|
result_prime_count = sieve(limit, result_array);
|
|
59
56
|
TEST_ASSERT_EQUAL(expected_prime_count, result_prime_count);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
TEST_ASSERT_EQUAL_UINT_ARRAY(expected_prime_array, result_array,
|
|
58
|
+
ARRAY_LENGTH(expected_prime_array));
|
|
59
|
+
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
void test_limit_is_prime(void)
|
|
@@ -74,9 +71,9 @@ void test_limit_is_prime(void)
|
|
|
74
71
|
|
|
75
72
|
result_prime_count = sieve(limit, result_array);
|
|
76
73
|
TEST_ASSERT_EQUAL(expected_prime_count, result_prime_count);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
TEST_ASSERT_EQUAL_UINT_ARRAY(expected_prime_array, result_array,
|
|
75
|
+
ARRAY_LENGTH(expected_prime_array));
|
|
76
|
+
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
void test_find_primes_up_to_1000(void)
|
|
@@ -105,9 +102,9 @@ void test_find_primes_up_to_1000(void)
|
|
|
105
102
|
|
|
106
103
|
result_prime_count = sieve(limit, result_array);
|
|
107
104
|
TEST_ASSERT_EQUAL(expected_prime_count, result_prime_count);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
TEST_ASSERT_EQUAL_UINT_ARRAY(expected_prime_array, result_array,
|
|
106
|
+
ARRAY_LENGTH(expected_prime_array));
|
|
107
|
+
|
|
111
108
|
}
|
|
112
109
|
|
|
113
110
|
int main(void)
|
data/tracks/erlang/config.json
CHANGED
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
]
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
|
-
"uuid": "
|
|
106
|
+
"uuid": "94b997bb-8e8d-4519-ba97-199d0f35a80a",
|
|
107
107
|
"slug": "isogram",
|
|
108
108
|
"core": false,
|
|
109
109
|
"unlocked_by": null,
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
]
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
|
-
"uuid": "
|
|
116
|
+
"uuid": "9c092a14-475b-4b1b-ac4b-fb19467367ff",
|
|
117
117
|
"slug": "pangram",
|
|
118
118
|
"core": false,
|
|
119
119
|
"unlocked_by": null,
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
]
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
|
-
"uuid": "
|
|
216
|
+
"uuid": "ea369b85-b180-48ca-b602-c40811fc865f",
|
|
217
217
|
"slug": "two-fer",
|
|
218
218
|
"core": false,
|
|
219
219
|
"unlocked_by": null,
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
]
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
|
-
"uuid": "
|
|
316
|
+
"uuid": "9cfae4bf-cff8-49bc-aee9-a37d553cef81",
|
|
317
317
|
"slug": "sieve",
|
|
318
318
|
"core": false,
|
|
319
319
|
"unlocked_by": null,
|
data/tracks/fsharp/config.json
CHANGED
|
@@ -696,6 +696,18 @@
|
|
|
696
696
|
"unlocked_by": "beer-song",
|
|
697
697
|
"uuid": "df6f311b-9deb-4d07-9a29-3d881556513e"
|
|
698
698
|
},
|
|
699
|
+
{
|
|
700
|
+
"core": false,
|
|
701
|
+
"difficulty": 5,
|
|
702
|
+
"slug": "rotational-cipher",
|
|
703
|
+
"topics": [
|
|
704
|
+
"algorithms",
|
|
705
|
+
"strings",
|
|
706
|
+
"transforming"
|
|
707
|
+
],
|
|
708
|
+
"unlocked_by": "beer-song",
|
|
709
|
+
"uuid": "26b00c8d-6282-48a8-b017-2ed3e6d48267"
|
|
710
|
+
},
|
|
699
711
|
{
|
|
700
712
|
"core": false,
|
|
701
713
|
"difficulty": 5,
|
|
@@ -216,6 +216,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "CollatzConjecture", "collat
|
|
|
216
216
|
EndProject
|
|
217
217
|
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ReverseString", "reverse-string\ReverseString.fsproj", "{A996AAE3-E54D-41F2-9B6A-99EACD6DAAB7}"
|
|
218
218
|
EndProject
|
|
219
|
+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "RotationalCipher", "rotational-cipher\RotationalCipher.fsproj", "{91D0A5E0-E39C-472B-87FB-6DD17336AA22}"
|
|
220
|
+
EndProject
|
|
219
221
|
Global
|
|
220
222
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
221
223
|
Debug|Any CPU = Debug|Any CPU
|
|
@@ -650,6 +652,10 @@ Global
|
|
|
650
652
|
{A996AAE3-E54D-41F2-9B6A-99EACD6DAAB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
651
653
|
{A996AAE3-E54D-41F2-9B6A-99EACD6DAAB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
652
654
|
{A996AAE3-E54D-41F2-9B6A-99EACD6DAAB7}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
655
|
+
{91D0A5E0-E39C-472B-87FB-6DD17336AA22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
656
|
+
{91D0A5E0-E39C-472B-87FB-6DD17336AA22}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
657
|
+
{91D0A5E0-E39C-472B-87FB-6DD17336AA22}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
658
|
+
{91D0A5E0-E39C-472B-87FB-6DD17336AA22}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
653
659
|
EndGlobalSection
|
|
654
660
|
GlobalSection(SolutionProperties) = preSolution
|
|
655
661
|
HideSolutionNode = FALSE
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module RotationalCipher
|
|
2
|
+
|
|
3
|
+
open System
|
|
4
|
+
|
|
5
|
+
let private alphabet = ['a' .. 'z']
|
|
6
|
+
|
|
7
|
+
let private createKey shiftKey =
|
|
8
|
+
alphabet @ alphabet
|
|
9
|
+
|> List.skip shiftKey
|
|
10
|
+
|> List.take (List.length alphabet)
|
|
11
|
+
|
|
12
|
+
let private rotateLetter key c =
|
|
13
|
+
let index = List.findIndex (fun x -> x = Char.ToLower(c)) alphabet
|
|
14
|
+
let rotatedLetter = List.item index key
|
|
15
|
+
|
|
16
|
+
match Char.IsUpper(c) with
|
|
17
|
+
| false -> rotatedLetter
|
|
18
|
+
| true -> Char.ToUpper(rotatedLetter)
|
|
19
|
+
|
|
20
|
+
let private rotateChar shiftKey =
|
|
21
|
+
let key = createKey shiftKey
|
|
22
|
+
let rotate = rotateLetter key
|
|
23
|
+
|
|
24
|
+
fun (c: char) ->
|
|
25
|
+
match Char.IsLetter(c) with
|
|
26
|
+
| false -> c
|
|
27
|
+
| true -> rotate c
|
|
28
|
+
|
|
29
|
+
let rotate shiftKey input = String.map (rotateChar shiftKey) input
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module Program = let [<EntryPoint>] main _ = 0
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.
|
|
2
|
+
|
|
3
|
+
The Caesar cipher is a simple shift cipher that relies on
|
|
4
|
+
transposing all the letters in the alphabet using an integer key
|
|
5
|
+
between `0` and `26`. Using a key of `0` or `26` will always yield
|
|
6
|
+
the same output due to modular arithmetic. The letter is shifted
|
|
7
|
+
for as many values as the value of the key.
|
|
8
|
+
|
|
9
|
+
The general notation for rotational ciphers is `ROT + <key>`.
|
|
10
|
+
The most commonly used rotational cipher is `ROT13`.
|
|
11
|
+
|
|
12
|
+
A `ROT13` on the Latin alphabet would be as follows:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
Plain: abcdefghijklmnopqrstuvwxyz
|
|
16
|
+
Cipher: nopqrstuvwxyzabcdefghijklm
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
It is stronger than the Atbash cipher because it has 27 possible keys, and 25 usable keys.
|
|
20
|
+
|
|
21
|
+
Ciphertext is written out in the same formatting as the input including spaces and punctuation.
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
- ROT5 `omg` gives `trl`
|
|
26
|
+
- ROT0 `c` gives `c`
|
|
27
|
+
- ROT26 `Cool` gives `Cool`
|
|
28
|
+
- ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.`
|
|
29
|
+
- ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.`
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
+
|
|
3
|
+
<PropertyGroup>
|
|
4
|
+
<TargetFramework>netcoreapp2.0</TargetFramework>
|
|
5
|
+
|
|
6
|
+
<IsPackable>false</IsPackable>
|
|
7
|
+
</PropertyGroup>
|
|
8
|
+
|
|
9
|
+
<ItemGroup>
|
|
10
|
+
<Compile Include="RotationalCipher.fs" />
|
|
11
|
+
<Compile Include="RotationalCipherTest.fs" />
|
|
12
|
+
<Compile Include="Program.fs" />
|
|
13
|
+
</ItemGroup>
|
|
14
|
+
|
|
15
|
+
<ItemGroup>
|
|
16
|
+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
|
|
17
|
+
<PackageReference Include="xunit" Version="2.3.1" />
|
|
18
|
+
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
|
19
|
+
<PackageReference Include="FsUnit.xUnit" Version="3.0.0" />
|
|
20
|
+
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
|
21
|
+
</ItemGroup>
|
|
22
|
+
|
|
23
|
+
</Project>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// This file was auto-generated based on version 1.1.0 of the canonical data.
|
|
2
|
+
|
|
3
|
+
module RotationalCipherTest
|
|
4
|
+
|
|
5
|
+
open FsUnit.Xunit
|
|
6
|
+
open Xunit
|
|
7
|
+
|
|
8
|
+
open RotationalCipher
|
|
9
|
+
|
|
10
|
+
[<Fact>]
|
|
11
|
+
let ``Rotate a by 0, same output as input`` () =
|
|
12
|
+
rotate 0 "a" |> should equal "a"
|
|
13
|
+
|
|
14
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
15
|
+
let ``Rotate a by 1`` () =
|
|
16
|
+
rotate 1 "a" |> should equal "b"
|
|
17
|
+
|
|
18
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
19
|
+
let ``Rotate a by 26, same output as input`` () =
|
|
20
|
+
rotate 26 "a" |> should equal "a"
|
|
21
|
+
|
|
22
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
23
|
+
let ``Rotate m by 13`` () =
|
|
24
|
+
rotate 13 "m" |> should equal "z"
|
|
25
|
+
|
|
26
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
27
|
+
let ``Rotate n by 13 with wrap around alphabet`` () =
|
|
28
|
+
rotate 13 "n" |> should equal "a"
|
|
29
|
+
|
|
30
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
31
|
+
let ``Rotate capital letters`` () =
|
|
32
|
+
rotate 5 "OMG" |> should equal "TRL"
|
|
33
|
+
|
|
34
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
35
|
+
let ``Rotate spaces`` () =
|
|
36
|
+
rotate 5 "O M G" |> should equal "T R L"
|
|
37
|
+
|
|
38
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
39
|
+
let ``Rotate numbers`` () =
|
|
40
|
+
rotate 4 "Testing 1 2 3 testing" |> should equal "Xiwxmrk 1 2 3 xiwxmrk"
|
|
41
|
+
|
|
42
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
43
|
+
let ``Rotate punctuation`` () =
|
|
44
|
+
rotate 21 "Let's eat, Grandma!" |> should equal "Gzo'n zvo, Bmviyhv!"
|
|
45
|
+
|
|
46
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
47
|
+
let ``Rotate all letters`` () =
|
|
48
|
+
rotate 13 "The quick brown fox jumps over the lazy dog." |> should equal "Gur dhvpx oebja sbk whzcf bire gur ynml qbt."
|
|
49
|
+
|