def verify(testout, expected, ordered):
    tuplepat = re.compile(r'Materialized\(([-\dA-Za-z,. ]+)\)')
    test = ({}, [])
    expect = ({}, [])

    def addTuple(tc, t):
        if ordered:
            tcl = tc[1]
            tcl.append(t)
        else:
            tcs = tc[0]
            if t not in tcs:
                tcs[t] = 1
            else:
                tcs[t]+=1

    with open(testout, 'r') as file:
        for line in file.readlines():
            m = tuplepat.search(line)
            if m:
                tlist = []
                for number in m.group(1).split(','):
                    if number=='':
                        # last one
                        break
                    tlist.append(parse_value(number))

                t = tuple(tlist)
                addTuple(test, t)

    with open(expected, 'r') as file:
        for line in file.readlines():
            tlist = []
            for number in line.split():
                tlist.append(parse_value(number))

            t = tuple(tlist)
            addTuple(expect, t)

    print test
    print expect
    assert test == expect, "\n test:  %s !=\n expect:%s" % (test, expect)
    print "pass"
dataset/ETHPy150Open uwescience/raco/c_test_environment/verifier.py/verify/original