Added logging
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/polySubstitution/TestTrifid.java
|
||||
//Mattrixwv
|
||||
// Created: 03-03-22
|
||||
//Modified: 03-03-22
|
||||
//Modified: 07-09-22
|
||||
package com.mattrixwv.cipherstream.polysubstitution;
|
||||
|
||||
|
||||
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.InvalidBaseException;
|
||||
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||
@@ -25,13 +25,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "gqdokpdodljvflf";
|
||||
String output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPDODLJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength encoding
|
||||
inputString = "messagetoencode";
|
||||
@@ -39,35 +39,35 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "gpjqdvdofodlklf";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "gqdokpd od ljvflf";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to-encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "gqdokpd*od-ljvflf";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "Gqdokpd od^ljvflf";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "Gpjqdvd of^odlklf";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed mixed case, whitespace, symbol, groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -79,13 +79,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "GQDOKPDODLJVFLF";
|
||||
String output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPDODLJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength encoding
|
||||
inputString = "messagetoencode";
|
||||
@@ -93,35 +93,35 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "GPJQDVDOFODLKLF";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no capital groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPD OD LJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to-encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPD*OD-LJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPD OD^LJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "GPJQDVD OF^ODLKLF";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no capital mixed case, whitespace, symbol, groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -133,13 +133,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "gqdokpdodljvflf";
|
||||
String output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPDODLJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength encoding
|
||||
inputString = "messagetoencode";
|
||||
@@ -147,35 +147,35 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "gpjqdvdofodlklf";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no whitespace groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "gqdokpdodljvflf";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to-encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "gqdokpd*od-ljvflf";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "Gqdokpdod^ljvflf";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "Gpjqdvdof^odlklf";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no whitespace mixed case, whitespace, symbol, groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -187,13 +187,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "gqdokpdodljvflf";
|
||||
String output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPDODLJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength encoding
|
||||
inputString = "messagetoencode";
|
||||
@@ -201,35 +201,35 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "gpjqdvdofodlklf";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no symbol groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "gqdokpd od ljvflf";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to-encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "gqdokpdodljvflf";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "Gqdokpd odljvflf";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "Gpjqdvd ofodlklf";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no symbol mixed case, whitespace, symbol, groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -241,13 +241,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "GQDOKPDODLJVFLF";
|
||||
String output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure lowercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase encoding
|
||||
inputString = "MESSAGETOENCODE";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPDODLJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure uppercase encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength encoding
|
||||
inputString = "messagetoencode";
|
||||
@@ -255,35 +255,35 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "GPJQDVDOFODLKLF";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed secure groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace encoding
|
||||
inputString = "message to encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPDODLJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure whitespace encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol encoding
|
||||
inputString = "message*to-encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPDODLJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol encoding
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
correctOutput = "GQDOKPDODLJVFLF";
|
||||
output = cipher.encode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure mixed case, whitespace, symbol encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Message to^encode";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "GPJQDVDOFODLKLF";
|
||||
output = cipher.encode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed secure mixed case, whitespace, symbol, groupLength encoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
|
||||
@@ -296,13 +296,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "messagetoencode";
|
||||
String output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "GQDOKPDODLJVFLF";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength decoding
|
||||
inputString = "gpjqdvdofodlklf";
|
||||
@@ -310,35 +310,35 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "messagetoencode";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "gqdokpd od ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "message to encode";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "gqdokpd*od-ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "message*to-encode";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Gqdokpd od^ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "Message to^encode";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Gpjqdvd of^odlklf";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "Message to^encode";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed mixed case, whitespace, symbol, groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -350,13 +350,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "MESSAGETOENCODE";
|
||||
String output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "GQDOKPDODLJVFLF";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength decoding
|
||||
inputString = "gpjqdvdofodlklf";
|
||||
@@ -364,35 +364,35 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no capital groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "gqdokpd od ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGE TO ENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "gqdokpd*od-ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGE*TO-ENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Gqdokpd od^ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGE TO^ENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no capital mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Gpjqdvd of^odlklf";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "MESSAGE TO^ENCODE";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no capital mixed case, whitespace, symbol, groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -404,13 +404,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "messagetoencode";
|
||||
String output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "GQDOKPDODLJVFLF";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength decoding
|
||||
inputString = "gpjqdvdofodlklf";
|
||||
@@ -418,35 +418,35 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "messagetoencode";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no whitespace groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "gqdokpd od ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "messagetoencode";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "gqdokpd*od-ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "message*to-encode";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Gqdokpd od^ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "Messageto^encode";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no whitespace mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Gpjqdvd of^odlklf";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "Messageto^encode";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no whitespace mixed case, whitespace, symbol, groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -458,13 +458,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "messagetoencode";
|
||||
String output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "GQDOKPDODLJVFLF";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength decoding
|
||||
inputString = "gpjqdvdofodlklf";
|
||||
@@ -472,35 +472,35 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "messagetoencode";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no symbol groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "gqdokpd od ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "message to encode";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "gqdokpd*od-ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "messagetoencode";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Gqdokpd od^ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "Message toencode";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed no symbol mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Gpjqdvd of^odlklf";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "Message toencode";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed no symbol mixed case, whitespace, symbol, groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -512,13 +512,13 @@ public class TestTrifid{
|
||||
String keyword = "keyword";
|
||||
String correctOutput = "MESSAGETOENCODE";
|
||||
String output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure lowercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Test uppercase decoding
|
||||
inputString = "GQDOKPDODLJVFLF";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure uppercase decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test groupLength decoding
|
||||
inputString = "gpjqdvdofodlklf";
|
||||
@@ -526,34 +526,34 @@ public class TestTrifid{
|
||||
int groupLength = 3;
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed secure groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test whitespace decoding
|
||||
inputString = "gqdokpd od ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure whitespace decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test symbol decoding
|
||||
inputString = "gqdokpd*od-ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
|
||||
//Test mixed case, whitespace, symbol decoding
|
||||
inputString = "Gqdokpd od^ljvflf";
|
||||
keyword = "keyword";
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, inputString);
|
||||
assertEquals("Trifid failed secure mixed case, whitespace, symbol decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
//Throw in groupLength for good measure
|
||||
inputString = "Gpjqdvd of^odlklf";
|
||||
keyword = "keyword";
|
||||
groupLength = 3;
|
||||
correctOutput = "MESSAGETOENCODE";
|
||||
output = cipher.decode(keyword, groupLength, inputString);
|
||||
assertEquals("Trifid failed secure mixed case, whitespace, symbol, groupLength decoding.", correctOutput, output);
|
||||
assertEquals(correctOutput, output);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user