The userGuess variable is not getting set to the user inputs as the program runs. Add in a line before you call checkIfCorrect to update the variable before you pass it to the function..
userGuess = getTest("userInput");