Created autokey cipher
This commit is contained in:
523
src/test/java/mattrixwv/CipherStreamJava/TestAutokey.java
Normal file
523
src/test/java/mattrixwv/CipherStreamJava/TestAutokey.java
Normal file
@@ -0,0 +1,523 @@
|
||||
//CipherStreamJava/src/main/java/mattrixwv/CipherStreamJava/TestAutokey.java
|
||||
//Matthew Ellison
|
||||
// Created: 07-26-21
|
||||
//Modified: 12-30-21
|
||||
//These are the tests for the Vigenere class
|
||||
package mattrixwv.CipherStreamJava;
|
||||
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class TestAutokey{
|
||||
@Test
|
||||
public void testDecode() throws Exception{
|
||||
Autokey cipher = new Autokey(true, true, true);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "qnxepv";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "attack";
|
||||
String output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "QNXEPV";
|
||||
keyword = "queenly";
|
||||
correctOutput = "ATTACK";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "qnxepv yt wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attack at dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "qnxepv@yt-wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attack@at-dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
input = "Qnxepv yt - wtwp";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "Attack at - dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Wmpm mx \"Xae Yhbryoca\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "Meet at \"The Fountain\"";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoWhitespaceDecode() throws Exception{
|
||||
Autokey cipher = new Autokey(true, false, true);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "qnxepv";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "attack";
|
||||
String output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "QNXEPV";
|
||||
keyword = "queenly";
|
||||
correctOutput = "ATTACK";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "qnxepv yt wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attackatdawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "qnxepv@yt-wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attack@at-dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
input = "Qnxepv yt - wtwp";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "Attackat-dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Wmpm mx \"Xae Yhbryoca\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "Meetat\"TheFountain\"";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoCapitalDecode() throws Exception{
|
||||
Autokey cipher = new Autokey(false, true, true);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "qnxepv";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "attack";
|
||||
String output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no capital lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "QNXEPV";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attack";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no capital uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "qnxepv yt wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attack at dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no capital whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "qnxepv@yt-wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attack@at-dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no capital symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
input = "Qnxepv yt - wtwp";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "attack at - dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no capital mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Wmpm mx \"Xae Yhbryoca\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "meet at \"the fountain\"";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no capital mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoSymbolDecode() throws Exception{
|
||||
Autokey cipher = new Autokey(true, true, false);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "qnxepv";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "attack";
|
||||
String output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "QNXEPV";
|
||||
keyword = "queenly";
|
||||
correctOutput = "ATTACK";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "qnxepv yt wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attack at dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "qnxepv@yt-wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attackatdawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
input = "Qnxepv yt - wtwp";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "Attack at dawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Wmpm mx \"Xae Yhbryoca\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "Meet at The Fountain";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoCapitalWhitespaceSymbolDecode() throws Exception{
|
||||
Autokey cipher = new Autokey(false, false, false);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "qnxepv";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "attack";
|
||||
String output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed secure lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "QNXEPV";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attack";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed secure uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "qnxepv yt wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attackatdawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed secure whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "qnxepv@yt-wtwp";
|
||||
keyword = "queenly";
|
||||
correctOutput = "attackatdawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed secure symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
input = "Qnxepv yt - wtwp";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "attackatdawn";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed secure mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Wmpm mx \"Xae Yhbryoca\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "meetatthefountain";
|
||||
output = cipher.decode(keyword, input);
|
||||
assertEquals("Autokey failed secure mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncode() throws Exception{
|
||||
Autokey cipher = new Autokey(true, true, true);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "attack";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "qnxepv";
|
||||
String output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "ATTACK";
|
||||
keyword = "queenly";
|
||||
correctOutput = "QNXEPV";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "attack at dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepv yt wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "attack@at-dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepv@yt-wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
input = "Attack at - dawn";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "Qnxepv yt - wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Meet at \"The Fountain\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "Wmpm mx \"Xae Yhbryoca\"";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoWhitespaceEncode() throws Exception{
|
||||
Autokey cipher = new Autokey(true, false, true);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "attack";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "qnxepv";
|
||||
String output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "ATTACK";
|
||||
keyword = "queenly";
|
||||
correctOutput = "QNXEPV";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "attack at dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepvytwtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "attack@at-dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepv@yt-wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
input = "Attack at - dawn";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "Qnxepvyt-wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Meet at \"The Fountain\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "Wmpmmx\"XaeYhbryoca\"";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no whitespace mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoCapitalEncode() throws Exception{
|
||||
Autokey cipher = new Autokey(false, true, true);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "attack";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "qnxepv";
|
||||
String output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no capital lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "ATTACK";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepv";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no capital uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "attack at dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepv yt wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no capital whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "attack@at-dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepv@yt-wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no capital symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
input = "Attack at - dawn";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "qnxepv yt - wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no capital mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Meet at \"The Fountain\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "wmpm mx \"xae yhbryoca\"";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no capital mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoSymbolEncode() throws Exception{
|
||||
Autokey cipher = new Autokey(true, true, false);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "attack";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "qnxepv";
|
||||
String output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "ATTACK";
|
||||
keyword = "queenly";
|
||||
correctOutput = "QNXEPV";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "attack at dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepv yt wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "attack@at-dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepvytwtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
input = "Attack at - dawn";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "Qnxepv yt wtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Meet at \"The Fountain\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "Wmpm mx Xae Yhbryoca";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed no symbol mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoCapitalWhitespaceSymbolEncode() throws Exception{
|
||||
Autokey cipher = new Autokey(false, false, false);
|
||||
|
||||
//Test lowercase decoding
|
||||
String input = "attack";
|
||||
String keyword = "queenly";
|
||||
String correctOutput = "qnxepv";
|
||||
String output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed secure lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
input = "ATTACK";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepv";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed secure uppercase decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test whitespace decoding
|
||||
input = "attack at dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepvytwtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed secure whitespace decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test symbol decoding
|
||||
input = "attack@at-dawn";
|
||||
keyword = "queenly";
|
||||
correctOutput = "qnxepvytwtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed secure symbol decoding.", correctOutput, output);
|
||||
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
input = "Attack at - dawn";
|
||||
keyword = "QUEENLY";
|
||||
correctOutput = "qnxepvytwtwp";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed secure mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol decoding with mangled keyword
|
||||
input = "Meet at \"The Fountain\"";
|
||||
keyword = "k@i l-t";
|
||||
correctOutput = "wmpmmxxaeyhbryoca";
|
||||
output = cipher.encode(keyword, input);
|
||||
assertEquals("Autokey failed secure mixed case, whitespace, symbol decoding with mangled keyword.", correctOutput, output);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testKeyword() throws Exception{
|
||||
Autokey cipher = new Autokey();
|
||||
|
||||
//Test keyword with whitespace
|
||||
String keyword = "x y z ";
|
||||
String correctOutput = "XYZ";
|
||||
cipher.setKeyword(keyword);
|
||||
String output = cipher.getKeyword();
|
||||
assertEquals("Vigenere failed keyword with whitespace", correctOutput, output);
|
||||
|
||||
|
||||
//Test keyword with symbol
|
||||
keyword = "x-y@z0";
|
||||
correctOutput = "XYZ";
|
||||
cipher.setKeyword(keyword);
|
||||
output = cipher.getKeyword();
|
||||
assertEquals("Vigenere failed keyword with symbol", correctOutput, output);
|
||||
|
||||
|
||||
//Test keyword with mixed case
|
||||
keyword = "xYz";
|
||||
correctOutput = "XYZ";
|
||||
cipher.setKeyword(keyword);
|
||||
output = cipher.getKeyword();
|
||||
assertEquals("Vigenere failed keyword with mixed case", correctOutput, output);
|
||||
|
||||
//Test keyword with whitespace, symbol and keyword
|
||||
keyword = "x Y%z ";
|
||||
correctOutput = "XYZ";
|
||||
cipher.setKeyword(keyword);
|
||||
output = cipher.getKeyword();
|
||||
assertEquals("Vigenere failed keyword with space, symbol, and mixed case", correctOutput, output);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user