Updated test coverage
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/Autokey.java
|
||||
//Mattrixwv
|
||||
// Created: 07-25-21
|
||||
//Modified: 07-09-22
|
||||
//Modified: 04-15-23
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
|
||||
|
||||
public class Autokey extends Vigenere{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Autokey.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(Autokey.class);
|
||||
|
||||
//Special rules for setting the strings for encoding
|
||||
private void encodeSet(String keyword, String inputString) throws InvalidKeywordException, InvalidInputException{
|
||||
protected void encodeSet(String keyword, String inputString) throws InvalidKeywordException, InvalidInputException{
|
||||
logger.debug("Setting fields for encoding");
|
||||
|
||||
//Set the input
|
||||
@@ -44,7 +44,7 @@ public class Autokey extends Vigenere{
|
||||
setOffset();
|
||||
}
|
||||
//Setting the strings for decoding
|
||||
private void decodeSet(String keyword, String inputString) throws InvalidKeywordException, InvalidInputException{
|
||||
protected void decodeSet(String keyword, String inputString) throws InvalidKeywordException, InvalidInputException{
|
||||
logger.debug("Setting fields for decoding");
|
||||
|
||||
//Remove all unneccessary elements from the key
|
||||
@@ -88,11 +88,6 @@ public class Autokey extends Vigenere{
|
||||
|
||||
letter += 26;
|
||||
}
|
||||
else if(letter > 'Z'){
|
||||
logger.debug("Wrapping around to A");
|
||||
|
||||
letter -= 26;
|
||||
}
|
||||
}
|
||||
else if(Character.isLowerCase(letter)){
|
||||
logger.debug("Appending lowercase");
|
||||
@@ -103,11 +98,6 @@ public class Autokey extends Vigenere{
|
||||
|
||||
letter += 26;
|
||||
}
|
||||
else if(letter > 'z'){
|
||||
logger.debug("Wrapping around to a");
|
||||
|
||||
letter -= 26;
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("Decoded letter {}", letter);
|
||||
@@ -117,8 +107,8 @@ public class Autokey extends Vigenere{
|
||||
fullOutput.append(currentOutput);
|
||||
|
||||
//Save and return the results
|
||||
logger.debug("Saving output string '{}'", fullOutput);
|
||||
outputString = fullOutput.toString();
|
||||
logger.debug("Saving output string '{}'", outputString);
|
||||
return outputString;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user