Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

test_api_h.py 851 B

1234567891011121314151617181920212223242526272829303132333435
  1. import os
  2. import re
  3. import helpers
  4. import pqclean
  5. def test_api_h():
  6. for scheme in pqclean.Scheme.all_schemes():
  7. for implementation in scheme.implementations:
  8. yield check_api_h, implementation
  9. @helpers.filtered_test
  10. def check_api_h(implementation: pqclean.Implementation):
  11. apipath = os.path.join(implementation.path(), 'api.h')
  12. errors = []
  13. p = re.compile(r'^\s*#include\s*"')
  14. with open(apipath) as f:
  15. for i, line in enumerate(f):
  16. if p.match(line):
  17. errors.append("\n at {}:{}".format(apipath, i+1))
  18. if errors:
  19. raise AssertionError(
  20. "Prohibited external include in api.h" + "".join(errors)
  21. )
  22. if __name__ == "__main__":
  23. try:
  24. import nose2
  25. nose2.main()
  26. except ImportError:
  27. import nose
  28. nose.runmodule()