pqc/test/test_format.py

31 lines
817 B
Python
Raw Normal View History

import helpers
2019-02-27 14:50:25 +00:00
import pqclean
def test_formatting():
for scheme in pqclean.Scheme.all_schemes():
for implementation in scheme.implementations:
if helpers.permit_test('format', implementation):
yield check_format, implementation
2019-02-27 14:50:25 +00:00
def check_format(implementation: pqclean.Implementation):
helpers.ensure_available('astyle')
cfiles = implementation.cfiles()
hfiles = implementation.hfiles()
result = helpers.run_subprocess(['astyle',
2019-02-27 14:50:25 +00:00
'--dry-run',
'--options=../.astylerc',
*cfiles,
*hfiles])
assert(not('Formatted' in result))
2019-02-27 14:50:25 +00:00
if __name__ == "__main__":
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()