Atbash cipher implemented
This commit is contained in:
47
src/test/java/mattrixwv/CipherStreamJava/TestAtbash.java
Normal file
47
src/test/java/mattrixwv/CipherStreamJava/TestAtbash.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user