Beispiel #1
0
        // Test a correct SHIFT value. numberOfQueries should increment and
        // average guess value should update to guess value
        public static string testCorrectGuessValue()
        {
            encryption.encryptWord correctGuess = new encryptWord();

            correctGuess.GuessShiftValue(3);
            return(correctGuess.DisplayGuessStatistics());
        }
Beispiel #2
0
        // Test a high guess value. numberOfHighGuesses should increment and
        // average guess value should update to guess value
        public static string testHighGuessValue()
        {
            encryption.encryptWord highGuess = new encryptWord();

            highGuess.GuessShiftValue(4);
            return(highGuess.DisplayGuessStatistics());
        }
Beispiel #3
0
        // Test a low guess value. numberOfLowGuesses should increment and
        // average guess value should update to guess value
        public static string testLowGuessValue()
        {
            encryption.encryptWord lowGuess = new encryptWord();

            lowGuess.GuessShiftValue(0);
            return(lowGuess.DisplayGuessStatistics());
        }
Beispiel #4
0
        // Test to ensure EncryptWord initialize properly
        public static string testObjectInitialState()
        {
            encryption.encryptWord initialState = new encryptWord();

            // Initial state will have all guess statistics as 0's
            return(initialState.DisplayGuessStatistics());
        }
Beispiel #5
0
        // Test average guess value is working correctly. The two guesses
        // should be summed, divided by 2, then rounded down to the nearest
        // whole number
        public static string testAverageGuessValue()
        {
            encryption.encryptWord averageGuess = new encryptWord();

            averageGuess.GuessShiftValue(2);
            averageGuess.GuessShiftValue(5);
            return(averageGuess.DisplayGuessStatistics());
        }
Beispiel #6
0
        // Test resetting the EncryptWord object. Input a low guess, high guess
        // and a correct guess. Then call ResetObject function.
        // DisplayGuessStatistics function then should have all statistics set
        // to 0's.
        public static string testResetObject()
        {
            encryption.encryptWord resetTest = new encryptWord();

            resetTest.GuessShiftValue(0);
            resetTest.GuessShiftValue(3);
            resetTest.GuessShiftValue(5);
            resetTest.ResetObject();
            return(resetTest.DisplayGuessStatistics());
        }