-
Notifications
You must be signed in to change notification settings - Fork 2
/
CodeDecodeTest.java
41 lines (33 loc) · 2.01 KB
/
CodeDecodeTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import static org.junit.Assert.*;
import org.junit.Test;
public class CodeDecodeTest {
String data1 = "What do you remember? When I looked at his streaky glasses, I wanted " +
"to leave him. And before that? He stole those cherries for me at midnight. We were walking " +
"in the rain and I loved him. And before that? I saw him coming " +
"toward me that time at the picnic, edgy, foreign.";
String data2 = "Some say the world will end in fire, Some say in ice. From what I've tasted of desire " +
"I hold with those who favor fire. But if it had to perish twice, I think I know enough of hate" +
" To say that for destruction ice Is also great And would suffice.";
String data1Sol =
"\013ctg?.nadr d gdbW\n\013,i lnis tl eh\n\013 mtIAakietboaara\n\013eeo nnigsoe st?t\n\013d wsddnh lfls \n\013gaaa gtfeoeehWd\n" +
"\013ytrwbI .o rasiho\n\013, d e i rtev,se \n\013 t hflnW h e ny\n\013fhmioo emot Is o\n\013oeemrvt eshh tIu\n\013r eehw eaiwr \n" +
"\013eptc deea tmaelr\n\013iihot rtc?.naoe\n\013gcamhhre h tkom\n\013nntiaia meHAeyke\n\013.i ntmiwirend em";
String data2Sol =
"fa h ttrheI ilS\nitifakw s'irdo\nc cotnihftivce m\neAereocaihree,we\n.n wedroe . i \n\013dIdT , es t Sls\n\013 seoe t.eIaFola\n" +
"\013w s nIo srm y\n\013oatso Bwhtoee \n\013ulrautpuhoem nt\n\013lsuyghetold sdh\n\013doc hir d wa e\n\013 tt niif ohyi \n\013sgihoksfawfa nw\n" +
"\013uroaf h vi ti o\n\013fent I iotd nfr";
private static void testing(String actual, String expected) {
assertEquals(expected, actual);
}
@Test
public void test() {
System.out.println("Fixed Tests code decode");
// testing(CodeDecode.code("123456789012345678901"), "1");
testing(CodeDecode.code(data1), data1Sol);
testing(CodeDecode.code(data2), data2Sol);
testing(CodeDecode.code(""), "");
testing(CodeDecode.decode(""), "");
testing(CodeDecode.decode(data1Sol), data1);
testing(CodeDecode.decode(data2Sol), data2);
}
}