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/polySubstitution/PolybiusSquare.java
//Mattrixwv
// Created: 01-04-22
//Modified: 04-29-23
//Modified: 05-04-23
package com.mattrixwv.cipherstream.polysubstitution;
@@ -16,7 +16,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
public class PolybiusSquare{
protected static Logger logger = LoggerFactory.getLogger(PolybiusSquare.class);
private static final Logger logger = LoggerFactory.getLogger(PolybiusSquare.class);
//A class representing the location of a character in the grid
protected class CharLocation{
@@ -41,8 +41,9 @@ public class PolybiusSquare{
protected char[][] grid; //The grid used to encode/decode the message
protected char replaced; //The letter that will need to be replaced in the grid and any input string or keyword
protected char replacer; //The letter that replaces replaced in the input string or keyword
protected boolean preserveWhitespace; //Whether to respect whitespace in the output string
protected boolean preserveSymbols; //Whether to respect symbols in the output string
//Settings
protected boolean preserveWhitespace; //Persist whitespace in the output string
protected boolean preserveSymbols; //Persist symbols in the output string
//Setting the character to be replaced
@@ -362,6 +363,7 @@ public class PolybiusSquare{
addCharactersToCleanStringDecode(output.toString());
}
//Constructors
public PolybiusSquare() throws InvalidCharacterException{
reset();
setReplaced('J');
@@ -383,6 +385,7 @@ public class PolybiusSquare{
this.preserveWhitespace = preserveWhitespace;
this.preserveSymbols = preserveSymbols;
}
//Sets the keyword and inputString and encodes the message
public String encode(String inputString) throws InvalidCharacterException, InvalidInputException{
return encode("", inputString);
@@ -415,7 +418,8 @@ public class PolybiusSquare{
outputString = "";
keyword = "";
}
//Gets
//Getters
public char getReplaced(){
return replaced;
}