# Convert poorly structured test data to C arrays.

from sys import argv

def is_lane(s):
    return len(s) == 16 and all(c in '0123456789ABCDEF' for c in s)

test_files = argv[1:]

print '#define NTESTS ' + str(len(test_files))
print '#define TEST_STEPS (1 + 24*5)'
print 'static lane_t tests[NTESTS][TEST_STEPS][25] = {'

for path in test_files:
    with open(path) as f:
        tokens = f.read().split()
    lane = 0
    print '\t{'
    for t in tokens:
        if is_lane(t):
            if lane == 0:
                print '\t\t{'
            print '\t\t\t0x' + t + ','
            lane += 1
            if lane == 25:
                lane = 0
                print '\t\t},'
    print '\t},'

print '};'
