Esempio n. 1
0
def evaluate_grammar(cmd_gramm):
    timing = []
    flag = 0
    for _ in range(INPUT_NUMBER):
        cmd = inputGen.gen_command(cmd_gramm)
        cmd_window.append(cmd)
        #result = evaluate_command(cmd, cmd_gramm['cmgf_flag']) if cmd_gramm['cmd'] == '+CMGS' else evaluate_command(cmd)
        result = evaluate_command(cmd)
        timing.append(result[0])
        if result[1] == 1:
            save_grammar(cmd_gramm, cmd)
            flag = 1
    return [utilityFunctions.average(timing), flag]
Esempio n. 2
0
def evaluate_set(gram_set):
    timing = []
    flag = 0
    for _ in range(INPUT_NUMBER):
        input_cmd = ''
        for g in gram_set:
            input_cmd += str(inputGen.gen_command(g)) + ';'
        input_cmd = input_cmd[:-1]
        cmd_window.append(input_cmd)
        result = evaluate_command(input_cmd)

        timing.append(result[0])
        if result[1] == 1:
            save_set(gram_set)
            flag = 1
    return [utilityFunctions.average(timing), flag]