您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

36 行
851 B

  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()