Added new documentation

This commit is contained in:
2018-05-08 11:53:16 -04:00
parent 1cf1898664
commit 0e4a954cc4
3 changed files with 127 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
//Ciphers/testMain.hpp
//Matthew Ellison
// Created: 4-30-18
//Modified: 4-30-18
//Modified: 5-8-18
//This file contains the driver function and the test functions for the Cipher program
//This program will use some simple ciphers that are no longer widely used but still fun to play with
@@ -25,37 +25,92 @@
#define ATBASH_TEST
#define MORSE_TEST
#define AUTOKEY_TEST
/**
* @brief Helper for determining the state of a cipher when an error occured
*
*/
enum codingState { ENCODE, DECODE };
/**
* @brief Creates an error message
*
* @param type Determines whether the cipher was encoding or decoding when an error occured
* @param input The string that was input into the cipher
* @param output The string that was the expected output of the cipher
* @param cipher The string that was the actual output of the cipher
* @return The appropriate error message
*/
std::string testingError(codingState type, const std::string& input, const std::string& output, const std::string& cipher);
#endif //TEST_VERSION definition
#ifdef CAESAR_TEST
/**
* @brief Runs several tests on the Caesar cipher, checking if encoding and decoding are working propperly
*
* @param errorString A string to store any error messages
* @return true If all tests completed successfully
* @return false If 1 or more tests failed
*/
bool caesarTest(std::string& errorString);
#endif //CAESAR_TEST
#ifdef PLAYFAIR_TEST
/**
* @brief Runs several tests on the Playfair cipher, checking if encoding and decoding are working propperly
*
* @param errorString A string to store any error messages
* @return true If all tests completed successfully
* @return false If 1 or more tests failed
*/
bool playfairTest(std::string& errorString);
#endif //PLAYFAIR_TEST
#ifdef VIGENERE_TEST
/**
* @brief Runs several tests on the Vigenere cipher, checking if encoding and decoding are working propperly
*
* @param errorString A string to store any error messages
* @return true If all tests completed successfully
* @return false If 1 or more tests failed
*/
bool vigenereTest(std::string& errorString);
#endif //VIGENERE_TEST
#ifdef ATBASH_TEST
/**
* @brief Runs several tests on the Atbash cipher, checking if encoding and decoding are working propperly
*
* @param errorString A string to store any error messages
* @return true If all tests completed successfully
* @return false If 1 or more tests failed
*/
bool atbashTest(std::string& errorString);
#endif //ATBASH_TEST
#ifdef MORSE_TEST
/**
* @brief Runs several tests on Morse code, checking if encoding and decoding are working propperly
*
* @param errorString A string to store any error messages
* @return true If all tests completed successfully
* @return false If 1 or more tests failed
*/
bool morseTest(std::string& errorString);
#endif //MORSE_TEST
#ifdef AUTOKEY_TEST
/**
* @brief Runs several tests on the Autokey cipher, checking if encoding and decoding are working propperly
*
* @param errorString A string to store any error messages
* @return true If all tests completed successfully
* @return false If 1 or more tests failed
*/
bool autokeyTest(std::string& errorString);
#endif //AUTOKEY_TEST
#ifdef TEST_VERSION
//A different main function that facilitates all tests
int main(int argc, char** argv){
bool testResult = false;
std::string resultString = "";