def _testTableDirectoryChecksums(data, reporter):
    # check the table directory checksums
    directory = unpackDirectory(data)
    tables = unpackTableData(data)
    for entry in directory:
        tag = entry["tag"]
        origChecksum = entry["origChecksum"]
        decompressedData = tables[tag]
        # couldn't be decompressed.
        if decompressedData is None:
            continue
        newChecksum = calcChecksum(tag, decompressedData)
        if newChecksum != origChecksum:
            reporter.logError(message="The \"%s\" table directory entry original checksum (%s) does not match the checksum (%s) calculated from the data." % (tag, hex(origChecksum), hex(newChecksum)))
        else:
            reporter.logPass(message="The \"%s\" table directory entry original checksum is correct." % tag)
    # check the head checksum adjustment
    if "head" not in tables:
        reporter.logWarning(message="The font does not contain a \"head\" table.")
    else:
        newChecksum = calcHeadChecksum(data)
        data = tables["head"]
        try:
            checksum = struct.unpack(">L", data[8:12])[0]
            if checksum != newChecksum:
                reporter.logError(message="The \"head\" table checkSumAdjustment (%s) does not match the calculated checkSumAdjustment (%s)." % (hex(checksum), hex(newChecksum)))
            else:
                reporter.logPass(message="The \"head\" table checkSumAdjustment is valid.")
        except:
            reporter.logError(message="The \"head\" table is not properly structured.")
Tests:
dataset/ETHPy150Open typesupply/woffTools/Lib/woffTools/tools/validate.py/_testTableDirectoryChecksums