TestADFGVX.java created online with Bitbucket
This commit is contained in:
@@ -0,0 +1,450 @@
|
||||
//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/combination/TestADFGVX.java
|
||||
//Mattrixwv
|
||||
// Created: 01-26-22
|
||||
//Modified: 01-26-22
|
||||
package com.mattrixwv.CipherStreamJava.combination;
|
||||
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class TestADFGVX{
|
||||
@Test
|
||||
public void testEncode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGVX cipher = new ADFGVX(true, true, true);
|
||||
|
||||
//Test lowercase encoding
|
||||
String inputString = "messagetoencode";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "axgvdavfxgagfaafagaaxdxfgdagda";
|
||||
String output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed lowercase encoding.", correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AXGVDAVFXGAGFAAFAGAAXDXFGDAGDA";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed uppercase encoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "axgvdavfxgagfa afag aaxdxfgdagda";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed whitespace encoding.", correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "axgvdavfxgagfa*afag+aaxdxfgdagda";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed symbol encoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol encoding
|
||||
inputString = "Message to-encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AXgvdavfxgagfa afag-aaxdxfgdagda";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed mixed case, whitespace, and symbol encoding.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoCapitalEncode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGX cipher = new ADFGX(false, true, true);
|
||||
|
||||
//Test lowercase encoding
|
||||
String inputString = "messagetoencode";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF";
|
||||
String output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no capital lowercase encoding.", correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no capital uppercase encoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXD AXDX ADAFAFXDDGDF";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no capital whitespace encoding.", correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode-";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXD*AXDX+ADAFAFXDDGDF-";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no capital symbol encoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXD AXDX^ADAFAFXDDGDF";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no capital mixed case, whitesapce, and symbol encoding.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoWhitespaceEncode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGX cipher = new ADFGX(true, false, true);
|
||||
|
||||
//Test lowercase encoding
|
||||
String inputString = "messagetoencode";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "aagagadfagaxxdaxdxadafafxddgdf";
|
||||
String output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no whitespace lowercase encoding.", correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no whitespace uppercase encoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "aagagadfagaxxdaxdxadafafxddgdf";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no whitespace whitespace encoding.", correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode-";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "aagagadfagaxxd*axdx+adafafxddgdf-";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no whitespace symbol encoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAgagadfagaxxdaxdx^adafafxddgdf";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no whitespace mixed case, whitesapce, and symbol encoding.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoSymbolEncode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGX cipher = new ADFGX(true, true, false);
|
||||
|
||||
//Test lowercase encoding
|
||||
String inputString = "messagetoencode";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "aagagadfagaxxdaxdxadafafxddgdf";
|
||||
String output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no symbol lowercase encoding.", correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no symbol uppercase encoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "aagagadfagaxxd axdx adafafxddgdf";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no symbol whitespace encoding.", correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode-";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "aagagadfagaxxdaxdxadafafxddgdf";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no symbol symbol encoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAgagadfagaxxd axdxadafafxddgdf";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed no symbol mixed case, whitesapce, and symbol encoding.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoCapitalWhitespaceSymbolEncode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGX cipher = new ADFGX(false, false, false);
|
||||
|
||||
//Test lowercase encoding
|
||||
String inputString = "messagetoencode";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF";
|
||||
String output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed secure lowercase encoding.", correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed secure uppercase encoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed secure whitespace encoding.", correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode-";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed secure symbol encoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "AAGAGADFAGAXXDAXDXADAFAFXDDGDF";
|
||||
output = cipher.encode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGX failed secure mixed case, whitesapce, and symbol encoding.", correctOutput, output);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDecode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGVX cipher = new ADFGVX(true, true, true);
|
||||
|
||||
//Test lowercase decoding
|
||||
String inputString = "axgvdavfxgagfaafagaaxdxfgdagda";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "messagetoencode";
|
||||
String output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "AXGVDAVFXGAGFAAFAGAAXDXFGDAGDA";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed uppercase decoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "axgvdavfxgagfa afag aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "message to encode";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed whitespace decoding.", correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "axgvdavfxgagfa*afag+aaxdxfgdagda-";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "message*to+encode-";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed symbol decoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol decoding
|
||||
inputString = "AXgvdavfxgagfa afag^aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "Message to^encode";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed mixed case, whitespace, and symbol decoding.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoCapitalDecode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGVX cipher = new ADFGVX(false, true, true);
|
||||
|
||||
//Test lowercase decoding
|
||||
String inputString = "axgvdavfxgagfaafagaaxdxfgdagda";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "MESSAGETOENCODE";
|
||||
String output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no capital lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "AXGVDAVFXGAGFAAFAGAAXDXFGDAGDA";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no capital uppercase decoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "axgvdavfxgagfa afag aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGE TO ENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no capital whitespace decoding.", correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "axgvdavfxgagfa*afag+aaxdxfgdagda-";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGE*TO+ENCODE-";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no capital symbol decoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol decoding
|
||||
inputString = "AXgvdavfxgagfa afag^aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGE TO^ENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no capital mixed case, whitespace, and symbol decoding.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoWhitespaceDecode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGVX cipher = new ADFGVX(true, false, true);
|
||||
|
||||
//Test lowercase decoding
|
||||
String inputString = "axgvdavfxgagfaafagaaxdxfgdagda";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "messagetoencode";
|
||||
String output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no whitespace lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "AXGVDAVFXGAGFAAFAGAAXDXFGDAGDA";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no whitespace uppercase decoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "axgvdavfxgagfa afag aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "messagetoencode";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no whitespace whitespace decoding.", correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "axgvdavfxgagfa*afag+aaxdxfgdagda-";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "message*to+encode-";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no whitespace symbol decoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol decoding
|
||||
inputString = "AXgvdavfxgagfa afag^aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "Messageto^encode";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no whitespace mixed case, whitespace, and symbol decoding.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoSymbolDecode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGVX cipher = new ADFGVX(true, true, false);
|
||||
|
||||
//Test lowercase decoding
|
||||
String inputString = "axgvdavfxgagfaafagaaxdxfgdagda";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "messagetoencode";
|
||||
String output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no symbol lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "AXGVDAVFXGAGFAAFAGAAXDXFGDAGDA";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no symbol uppercase decoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "axgvdavfxgagfa afag aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "message to encode";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no symbol whitespace decoding.", correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "axgvdavfxgagfa*afag+aaxdxfgdagda-";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "messagetoencode";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no symbol symbol decoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol decoding
|
||||
inputString = "AXgvdavfxgagfa afag^aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "Message toencode";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed no symbol mixed case, whitespace, and symbol decoding.", correctOutput, output);
|
||||
}
|
||||
@Test
|
||||
public void testNoCapitalWhitespaceSymbolDecode() throws InvalidCharacterException, InvalidKeywordException, InvalidInputException{
|
||||
ADFGVX cipher = new ADFGVX(false, false, false);
|
||||
|
||||
//Test lowercase decoding
|
||||
String inputString = "axgvdavfxgagfaafagaaxdxfgdagda";
|
||||
String squareKeyword = "SquareKeyword";
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "MESSAGETOENCODE";
|
||||
String output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed secure lowercase decoding.", correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "AXGVDAVFXGAGFAAFAGAAXDXFGDAGDA";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed secure uppercase decoding.", correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "axgvdavfxgagfa afag aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed secure whitespace decoding.", correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "axgvdavfxgagfa*afag+aaxdxfgdagda-";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed secure symbol decoding.", correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, and symbol decoding
|
||||
inputString = "AXgvdavfxgagfa afag^aaxdxfgdagda";
|
||||
squareKeyword = "SquareKeyword";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(squareKeyword, keyword, inputString);
|
||||
assertEquals("ADFGVX failed secure mixed case, whitespace, and symbol decoding.", correctOutput, output);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user