Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import static java.util.stream.Collectors.joining;
import static java.util.stream.IntStream.range;

interface ForemanPig {
interface MewCipher {
static String decipher(String[] code) {
return range(0, code[0].length())
.map(i -> range(0, code.length).reduce(0, (s, j) -> s + (code[j].charAt(i) & 31)) / code.length)
Expand Down
14 changes: 0 additions & 14 deletions kata/7-kyu/mew-cipher/test/ForemanPigTest.java

This file was deleted.

14 changes: 14 additions & 0 deletions kata/7-kyu/mew-cipher/test/MewCipherTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

class MewCipherTest {
@Test
void sample() {
assertEquals("walk your dog at nine", MewCipher.decipher(new String[]{"u lk zxuq hfk as fouh", "y l zpuv xe at sicd", "welvayfuqbfpeaauaqcrc"}));
assertEquals("hello world", MewCipher.decipher(new String[]{"hello world"}));
assertEquals("", MewCipher.decipher(new String[]{"", "", "", "", ""}));
assertEquals(" ", MewCipher.decipher(new String[]{"a ", " b ", " c", " ", " "}));
assertEquals("foreman pig", MewCipher.decipher(new String[]{"foreman pig", "foreman pig"}));
}
}