Added logging
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/monoSubstitution/TestSubstitution.java
|
||||
//Mattrixwv
|
||||
// Created: 02-22-22
|
||||
//Modified: 02-22-22
|
||||
//Modified: 07-09-22
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
@@ -23,40 +23,40 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "oguucigvqgpeqfg";
|
||||
String output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIGVQGPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "oguucig vq gpeqfg";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "oguucig*vq+gpeqfg";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "Oguucig vq^gpeqfg";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number encoding with long key
|
||||
inputString = "Message to&encode 123";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "Oguucig vq&gpeqfg 876";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed mixed case, whitespace, symbol, number encoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -68,40 +68,40 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "OGUUCIGVQGPEQFG";
|
||||
String output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIGVQGPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIG VQ GPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIG*VQ+GPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIG VQ^GPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number encoding with long key
|
||||
inputString = "Message to&encode 123";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "OGUUCIG VQ&GPEQFG 876";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital mixed case, whitespace, symbol, number encoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -113,40 +113,40 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "oguucigvqgpeqfg";
|
||||
String output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIGVQGPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "oguucigvqgpeqfg";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "oguucig*vq+gpeqfg";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "Oguucigvq^gpeqfg";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number encoding with long key
|
||||
inputString = "Message to&encode 123";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "Oguucigvq&gpeqfg876";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace mixed case, whitespace, symbol, number encoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -158,40 +158,40 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "oguucigvqgpeqfg";
|
||||
String output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIGVQGPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "oguucig vq gpeqfg";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "oguucigvqgpeqfg";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "Oguucig vqgpeqfg";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number encoding with long key
|
||||
inputString = "Message to&encode 123";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "Oguucig vqgpeqfg ";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol mixed case, whitespace, symbol, number encoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -203,40 +203,40 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "OGUUCIGVQGPEQFG";
|
||||
String output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIGVQGPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIGVQGPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to+encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIGVQGPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "OGUUCIGVQGPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number encoding with long key
|
||||
inputString = "Message to&encode 123";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "OGUUCIGVQGPEQFG";
|
||||
output = cipher.encode(key, inputString);
|
||||
assertEquals("Substitution failed no capital mixed case, whitespace, symbol, number encoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
|
||||
@@ -249,40 +249,40 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "messagetoencode";
|
||||
String output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "OGUUCIGVQGPEQFG";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "oguucig vq gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "message to encode";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "oguucig*vq+gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "message*to+encode";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Oguucig vq^gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "Message to^encode";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number decoding with long key
|
||||
inputString = "Oguucig vq&gpeqfg 876";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "Message to&encode 123";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed mixed case, whitespace, symbol, number decoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -294,40 +294,40 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "MESSAGETOENCODE";
|
||||
String output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no capital lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "OGUUCIGVQGPEQFG";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no capital uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "oguucig vq gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGE TO ENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no capital whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "oguucig*vq+gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGE*TO+ENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no capital whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Oguucig vq^gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGE TO^ENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no capital mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number decoding with long key
|
||||
inputString = "Oguucig vq&gpeqfg 876";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "MESSAGE TO&ENCODE 123";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no capital mixed case, whitespace, symbol, number decoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -339,40 +339,40 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "messagetoencode";
|
||||
String output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "OGUUCIGVQGPEQFG";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "oguucig vq gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "messagetoencode";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "oguucig*vq+gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "message*to+encode";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Oguucig vq^gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "Messageto^encode";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number decoding with long key
|
||||
inputString = "Oguucig vq&gpeqfg 876";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "Messageto&encode123";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no whitespace mixed case, whitespace, symbol, number decoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -384,40 +384,40 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "messagetoencode";
|
||||
String output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "OGUUCIGVQGPEQFG";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "oguucig vq gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "message to encode";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "oguucig*vq+gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "messagetoencode";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Oguucig vq^gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "Message toencode";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed mixed no symbol case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number decoding with long key
|
||||
inputString = "Oguucig vq&gpeqfg 876";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "Message toencode ";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed no symbol mixed case, whitespace, symbol, number decoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -429,39 +429,39 @@ public class TestSubstitution{
|
||||
String key = "cdefghijklmnopqrstuvwxyzab";
|
||||
String correctOutput = "MESSAGETOENCODE";
|
||||
String output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed secure lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "OGUUCIGVQGPEQFG";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed secure uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "oguucig vq gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed secure whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "oguucig*vq+gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed secure whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Oguucig vq^gpeqfg";
|
||||
key = "cdefghijklmnopqrstuvwxyzab";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed secure mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test mixed case, whitespace, symbol, number decoding with long key
|
||||
inputString = "Oguucig vq&gpeqfg 876";
|
||||
key = "cdefghijklmnopqrstuvwxyzab9876543210";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(key, inputString);
|
||||
assertEquals("Substitution failed secure mixed case, whitespace, symbol, number decoding with long key.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user