Updating tests

This commit is contained in:
2023-05-05 20:19:27 -04:00
parent b3ca4754ea
commit 9c41f10576
45 changed files with 2729 additions and 2239 deletions

View File

@@ -1,7 +1,7 @@
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/combination/ADFGX.java
//Mattrixwv
// Created: 01-25-22
//Modified: 04-14-23
//Modified: 05-04-23
package com.mattrixwv.cipherstream.combination;
@@ -16,16 +16,17 @@ import com.mattrixwv.cipherstream.polysubstitution.PolybiusSquare;
public class ADFGX{
protected static Logger logger = LoggerFactory.getLogger(ADFGX.class);
private static final Logger logger = LoggerFactory.getLogger(ADFGX.class);
//Internal fields
protected String inputString; //The string that needs encoded/decoded
protected String inputString; //The string that needs encoded/decoded
protected String outputString; //The string that is output after encoding/decoding
protected String squareKeyword; //The keyword used in the Polybius Square
protected String keyword; //The keyword used in the Columnar cipher
protected boolean preserveCapitals; //Whether to respect capitals in the output string
protected boolean preserveWhitespace; //Whether to respect whitespace in the output string
protected boolean preserveSymbols; //Whether to respect symbols in the output string
protected String keyword; //The keyword used in the Columnar cipher
//Settings
protected boolean preserveCapitals; //Persist capitals in the output string
protected boolean preserveWhitespace; //Persist whitespace in the output string
protected boolean preserveSymbols; //Persist symbols in the output string
//Internal ciphers
protected PolybiusSquare polybiusSquare; //The first step in encoding
protected Columnar columnar; //The second step in encoding
@@ -37,7 +38,7 @@ public class ADFGX{
throw new InvalidKeywordException("Square keyword cannot be null");
}
logger.debug("squareKeyword = {}", squareKeyword);
logger.debug("Square keyword '{}'", squareKeyword);
this.squareKeyword = squareKeyword;
}
//Ensures Columnar keyword constraints
@@ -46,7 +47,7 @@ public class ADFGX{
throw new InvalidKeywordException("Keyword cannot be null");
}
logger.debug("keyword = {}", keyword);
logger.debug("Keyword '{}'", keyword);
this.keyword = keyword;
}
//Ensures inputString constraints
@@ -74,10 +75,10 @@ public class ADFGX{
this.inputString = inputString;
logger.debug("Cleaned input string '{}'", inputString);
if(this.inputString.isBlank()){
throw new InvalidInputException("Input cannot be blank");
}
logger.debug("Cleaned input string '{}'", inputString);
}
//Format the output string with capitals, symbols, and numbers that are in the input string
protected void formatOutputStringEncode(){
@@ -209,23 +210,20 @@ public class ADFGX{
return outputString;
}
//Returns the cleaned inputString
//Getters
public String getInputString(){
return inputString;
}
//Returns the outputString
public String getOutputString(){
return outputString;
}
//Returns the cleaned Polybius Square keyword
public String getSquareKeyword(){
return squareKeyword;
}
//Returns the cleaned Columnar keyword
public String getKeyword(){
return keyword;
}
//Makes sure all of the variables are empty
//Makes sure all variables are empty
public void reset() throws InvalidCharacterException{
logger.debug("Resetting fields");