def __init__(self,question_library_path,question_path): config = file_util.dynamic_import(os.path.join( question_library_path,question_path,'cqg_config.py')) self.question_library_path = question_library_path self.question_path = question_path self.plaintext = config.plaintext self.key = config.key self.ciphertext = caesar_util.caesar_encrypt(self.plaintext, self.key) self.hotspots = config.hotspots
def run_tests(): for l in tests[0]: for k in tests[1]: for alphabet in tests[2]: p = generate_plain_text(l, alphabet) c_internal = generate_caesar_result(k, p) c_caesar_util = ''.join(caesar_util.caesar_encrypt(p, k)) if(c_internal != c_caesar_util): print("Test Failed!: \n" \ "Plaintext: '" + p + "'\n" \ "Key: " + str(k) + "\n" \ "Expected Result: '" + c_internal + "'\n" \ "Provided Result: '" + c_caesar_util + "'\n")
def run_tests(): for l in tests[0]: for k in tests[1]: for alphabet in tests[2]: p = generate_plain_text(l, alphabet) c_internal = generate_caesar_result(k, p) c_caesar_util = ''.join(caesar_util.caesar_encrypt(p, k)) if (c_internal != c_caesar_util): print("Test Failed!: \n" \ "Plaintext: '" + p + "'\n" \ "Key: " + str(k) + "\n" \ "Expected Result: '" + c_internal + "'\n" \ "Provided Result: '" + c_caesar_util + "'\n")
def __init__(self,question_library_path,question_path): ''' purpose retrieve the question specified by path preconditions question_library_path,question_path are strings ''' config = file_util.dynamic_import( os.path.join( question_library_path, question_path, 'cqg_config.py')) self.question_library_path = question_library_path self.question_path = question_path self.plaintext = config.plaintext self.key = config.key self.hotspots = config.hotspots self.ciphertext = caesar_util.caesar_encrypt(self.plaintext, self.key)