Пример #1
0
def run_test(fp):
    '''
    :param fp: file pointer to read in values
    :return: number of right and the length of the linked list

    creates linked lists and runs merge sort, then checks for correct result
    '''
    queue = stu_lq.LinkedQueue()
    count, answer = AddValues(queue, fp)
    stu_qs.quick_sort(queue)

    return check(answer, queue)
Пример #2
0
def test4():
    cur_total = 0
    data = [['a', 'z', 'r', 'c', 'g', 'e', 'a'], [1, 2, 4, 5, 3, 7],
            [56, 3, 5, -22, -4], [12.3, 122, 120.2], [1, 2, 3]]

    for el in range(5):
        queue = stu_lq.LinkedQueue()
        ans = sol_lq.LinkedQueue()
        for i in data[el]:
            queue.enqueue(i)
            ans.enqueue(i)
        if stu_qs.pick_pivot(queue) == sol_qs.pick_pivot(ans):
            cur_total += 2
            global TOTAL
            TOTAL += 2

    return f"Testcase 04: {cur_total} / 10"