1
1
pqc/test/test_api_h.py

34 linhas
732 B
Python
Em bruto Vista normal Histórico

2019-04-09 16:14:34 +01:00
import os
import re
import pytest
import helpers
2019-04-09 16:14:34 +01:00
import pqclean
pattern = re.compile(r'^\s*#include\s*"')
2019-04-09 16:14:34 +01:00
@pytest.mark.parametrize(
'implementation',
pqclean.Scheme.all_implementations(),
ids=str,
)
@helpers.filtered_test
def test_api_h(implementation: pqclean.Implementation):
2019-04-09 16:14:34 +01:00
apipath = os.path.join(implementation.path(), 'api.h')
errors = []
with open(apipath) as f:
for i, line in enumerate(f):
if pattern.match(line):
2019-04-09 16:14:34 +01:00
errors.append("\n at {}:{}".format(apipath, i+1))
if errors:
raise AssertionError(
"Prohibited external include in api.h" + "".join(errors)
)
if __name__ == '__main__':
import sys
pytest.main(sys.argv)