@@ -0,0 +1,1870 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# Nicely formats results generated by example.lua%0A%0Aimport os%0Afrom sys import argv%0Aimport json%0A%0Adef main():%0A    TEST_JUST = 8%0A    RPS_JUST=9%0A    PERCENT_JUST=10%0A%0A    if len(argv) == 1:%0A        print 'Usage:', argv%5B0%5D, ' files'%0A        return -1;%0A%0A    results = %5B%5D%0A    names = %5B%5D%0A    for fname in argv%5B1:%5D:%0A        with open(fname) as f:%0A            results.append(json.loads(f.read()))%0A            name = os.path.splitext(os.path.basename(fname))%5B0%5D%0A            names.append(name)%0A    print ' vs '.join(names)%0A    print%0A%0A    # Check sizes%0A    wlnum = len(results%5B0%5D)%0A    for res in results:%0A        assert (wlnum == len(res))%0A%0A    for wls in zip(*results):%0A        for (wlname, _wldata) in wls%5B1:%5D:%0A            assert(wls%5B0%5D%5B0%5D == wlname)%0A%0A        wlname = wls%5B0%5D%5B0%5D%0A        print wlname%0A        print '-' * len(wlname)%0A        print%0A%0A        # Print headers%0A        print '%7C', 'Test'.center(TEST_JUST), '%7C', names%5B0%5D.center(RPS_JUST), '%7C',%0A        for name in names%5B1:%5D:%0A            print name.center(RPS_JUST + PERCENT_JUST + 1), '%7C',%0A        print%0A%0A        # Print hline%0A        print '%7C', '-' * TEST_JUST, '%7C', '-' * RPS_JUST, '%7C',%0A        for k in wls%5B1:%5D:%0A            print '-' * (RPS_JUST + PERCENT_JUST + 1), '%7C',%0A        print%0A%0A        for tests in zip(*%5Bx%5B1%5D for x in wls%5D):%0A            for test in tests%5B1:%5D:%0A                assert(tests%5B0%5D%5B0%5D == test%5B0%5D)%0A%0A            print '%7C', tests%5B0%5D%5B0%5D.rjust(TEST_JUST), '%7C',%0A            base = tests%5B0%5D%5B1%5D%0A            print (%22%25.0f%22 %25 base).rjust(RPS_JUST), '%7C',%0A            for test in tests%5B1:%5D:%0A                rps = test%5B1%5D%0A                delta = (((rps / base) - 1.0) * 100)%0A                print (%22%25.f%22 %25 rps).rjust(RPS_JUST),%0A                print (%22(%25.2f%25%25)%22 %25 delta).rjust(PERCENT_JUST), '%7C',%0A            print%0A        print%0A%0Aif __name__ == '__main__':%0A    main()%0A%0A

Add sample result formatter