blob: 9a74167213318b6562f52dfbb405f602d4a9c48a (
plain)
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
|
package cgeo.geocaching.utils;
import cgeo.geocaching.connector.gc.GCConstants;
import junit.framework.TestCase;
public class CryptUtilsTest extends TestCase {
public static void testROT13() {
assertEquals("", CryptUtils.rot13(""));
assertEquals("", CryptUtils.rot13((String) null));
assertEquals("Pnpur uvag", CryptUtils.rot13("Cache hint"));
assertEquals("Pnpur [plain] uvag", CryptUtils.rot13("Cache [plain] hint"));
assertEquals("[all plain]", CryptUtils.rot13("[all plain]"));
assertEquals("123", CryptUtils.rot13("123"));
}
public static void testConvertToGcBase31() {
assertEquals(1186660, GCConstants.gccodeToGCId("GC1PKK9"));
assertEquals(4660, GCConstants.gccodeToGCId("GC1234"));
assertEquals(61731, GCConstants.gccodeToGCId("GCF123"));
}
public static void testIssue1902() {
assertEquals("ƖƖlƖƖƖƖ", CryptUtils.rot13("ƖƖyƖƖƖƖ"));
}
public static void testMd5() {
assertEquals("d41d8cd98f00b204e9800998ecf8427e", CryptUtils.md5(""));
// expected value taken from debugger. should assure every developer uses UTF-8
assertEquals("a7f4e3ec08f09be2ef7ecb4eea5f8981", CryptUtils.md5("äöü"));
}
}
|