pqc/test/test_format.py

33 lines
897 B
Python
Raw Normal View History

2019-02-27 14:50:25 +00:00
import os
from glob import glob
import pqclean
2019-03-04 14:12:38 +00:00
from helpers import run_subprocess, skip_windows
2019-02-27 14:50:25 +00:00
def test_formatting():
for scheme in pqclean.Scheme.all_schemes():
for implementation in scheme.implementations:
yield check_format, implementation
2019-03-04 14:12:38 +00:00
@skip_windows(message="This test needs to be amended to work with Windows "
"installations of astyle")
2019-02-27 14:50:25 +00:00
def check_format(implementation: pqclean.Implementation):
cfiles = glob(os.path.join(implementation.path(), '*.c'))
hfiles = glob(os.path.join(implementation.path(), '*.h'))
run_subprocess(['astyle',
'--dry-run',
'--options=../.astylerc',
*cfiles,
*hfiles])
if __name__ == "__main__":
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()