parameters
[imago.git] / test / results.py
1 #!/usr/bin/env python
2
3 import sys
4 import pickle
5
6 res = pickle.load(open(sys.argv[1], 'r'))
7
8 total = len(res)
9
10 failed = [(name,error) for (name, time, output, error, r_code) in res
11           if r_code > 0]
12 print "failed tests:", str(len(failed)) + '/' + str(total)
13
14 for (name, error) in failed:
15     print "    ", name
16
17 print ""
18
19 n = 0
20 t = 0
21 correct = 0
22
23 for (name, time, output, error, r_code) in res:
24     if r_code > 0:
25         continue
26     n += 1
27     t += time
28     ref = open(name.split('.')[0] + '.txt').read()
29     if output == ref:
30         correct += 1
31     else:
32         #TODO find and record the error
33         pass
34
35 print "average runtime:", (t/n)
36 print "correct:", str(correct) + '/' + str(n)