keksum_genesis_3 1
keksum_genesis_3 2
keksum_genesis_3 3 from sys import argv
keksum_genesis_3 4
keksum_genesis_3 5 def is_lane(s):
keksum_genesis_3 6 return len(s) == 16 and all(c in '0123456789ABCDEF' for c in s)
keksum_genesis_3 7
keksum_genesis_3 8 test_files = argv[1:]
keksum_genesis_3 9
keksum_genesis_3 10 print '#define NTESTS ' + str(len(test_files))
keksum_genesis_3 11 print '#define TEST_STEPS (1 + 24*5)'
keksum_genesis_3 12 print 'static lane_t tests[NTESTS][TEST_STEPS][25] = {'
keksum_genesis_3 13
keksum_genesis_3 14 for path in test_files:
keksum_genesis_3 15 with open(path) as f:
keksum_genesis_3 16 tokens = f.read().split()
keksum_genesis_3 17 lane = 0
keksum_genesis_3 18 print '\t{'
keksum_genesis_3 19 for t in tokens:
keksum_genesis_3 20 if is_lane(t):
keksum_genesis_3 21 if lane == 0:
keksum_genesis_3 22 print '\t\t{'
keksum_genesis_3 23 print '\t\t\t0x' + t + ','
keksum_genesis_3 24 lane += 1
keksum_genesis_3 25 if lane == 25:
keksum_genesis_3 26 lane = 0
keksum_genesis_3 27 print '\t\t},'
keksum_genesis_3 28 print '\t},'
keksum_genesis_3 29
keksum_genesis_3 30 print '};'