Atbash cipher implemented

This commit is contained in:
2021-07-25 16:59:48 -04:00
parent 23c58a6fdc
commit 300a3acd06
2 changed files with 110 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
//CipherStreamJava/src/main/java/mattrixwv/CipherStreamJava/TestAtbash.java
//Matthew Ellison
// Created: 07-25-21
//Modified: 07-25-21
//These are the tests for the Atbash class
package mattrixwv.CipherStreamJava;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class TestAtbash{
@Test
public void TestDecode(){
Atbash cipher = new Atbash();
//Test 1
String input = "zyx";
String correctOutput = "ABC";
String output = cipher.decode(input);
assertEquals("Atbash Decoding failed the first test", correctOutput, output);
//Test 2
input = "GSV JFRXP YILDM ULC QFNKH LEVI - GSV OZAB WLT";
correctOutput = "THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG";
output = cipher.decode(input);
assertEquals("Atbash Decoding failed the second test", correctOutput, output);
}
@Test
public void TestEncode(){
Atbash cipher = new Atbash();
//Test 1
String input = "abc";
String correctOutput = "ZYX";
String output = cipher.encode(input);
assertEquals("Atbash Encoding failed the first test", correctOutput, output);
//Test 2
input = "The quick brown fox jumps over - the lazy dog";
correctOutput = "GSVJFRXPYILDMULCQFNKHLEVIGSVOZABWLT";
output = cipher.encode(input);
assertEquals("Atbash Encoding failed the second test", correctOutput, output);
}
}