|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+import org.junit.Test;
|
|
|
2
|
+import org.junit.runner.RunWith;
|
|
|
3
|
+import org.junit.runners.Parameterized;
|
|
|
4
|
+
|
|
|
5
|
+import java.util.Arrays;
|
|
|
6
|
+import java.util.Collection;
|
|
|
7
|
+
|
|
|
8
|
+import static org.junit.Assert.assertEquals;
|
|
|
9
|
+
|
|
|
10
|
+@RunWith(Parameterized.class)
|
|
|
11
|
+public class AtbashTest {
|
|
|
12
|
+
|
|
|
13
|
+ private String input;
|
|
|
14
|
+ private String expectedOutput;
|
|
|
15
|
+
|
|
|
16
|
+ @Parameterized.Parameters
|
|
|
17
|
+ public static Collection<Object[]> data() {
|
|
|
18
|
+ return Arrays.asList(new Object[][]{
|
|
|
19
|
+ {"no", "ml"},
|
|
|
20
|
+ {"yes", "bvh"},
|
|
|
21
|
+ {"OMG", "lnt"},
|
|
|
22
|
+ {"mindblowingly", "nrmwy oldrm tob"},
|
|
|
23
|
+ {"Testing, 1 2 3, testing.", "gvhgr mt123 gvhgr mt"},
|
|
|
24
|
+ {"Truth is fiction.", "gifgs rhurx grlm"},
|
|
|
25
|
+ {"The quick brown fox jumps over the lazy dog.", "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"}
|
|
|
26
|
+ });
|
|
|
27
|
+ }
|
|
|
28
|
+
|
|
|
29
|
+ public AtbashTest(String input, String expectedOutput) {
|
|
|
30
|
+ this.input = input;
|
|
|
31
|
+ this.expectedOutput = expectedOutput;
|
|
|
32
|
+ }
|
|
|
33
|
+
|
|
|
34
|
+ @Test
|
|
|
35
|
+ public void test() {
|
|
|
36
|
+ assertEquals(expectedOutput, Atbash.encode(input));
|
|
|
37
|
+ }
|
|
|
38
|
+}
|