25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

34 satır
884 B

  1. import pytest
  2. import helpers
  3. import pqclean
  4. @pytest.mark.parametrize(
  5. 'implementation',
  6. pqclean.Scheme.all_implementations(),
  7. ids=str,
  8. )
  9. @helpers.filtered_test
  10. def test_preprocessor(implementation: pqclean.Implementation):
  11. cfiles = implementation.cfiles()
  12. hfiles = implementation.hfiles()
  13. errors = []
  14. for file in hfiles + cfiles:
  15. with open(file) as f:
  16. for i, line in enumerate(f):
  17. line = line.strip()
  18. if file in hfiles and i == 0 and line.startswith('#ifndef'):
  19. continue
  20. if line.startswith('#if'):
  21. errors.append("\n at {}:{}".format(file, i+1))
  22. if errors:
  23. raise AssertionError(
  24. "Prohibited use of preprocessor conditional" + "".join(errors)
  25. )
  26. if __name__ == '__main__':
  27. import sys
  28. pytest.main(sys.argv)