2019-03-05 13:35:19 +00:00
|
|
|
import shutil
|
|
|
|
import unittest
|
2019-02-27 14:50:25 +00:00
|
|
|
|
|
|
|
import pqclean
|
2019-03-05 13:35:19 +00:00
|
|
|
from helpers import run_subprocess
|
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
|
|
|
|
|
|
|
|
|
|
|
|
def check_format(implementation: pqclean.Implementation):
|
2019-03-05 13:35:19 +00:00
|
|
|
if shutil.which('astyle') is None:
|
|
|
|
raise unittest.SkipTest("AStyle is not installed")
|
|
|
|
cfiles = implementation.cfiles()
|
|
|
|
hfiles = implementation.hfiles()
|
2019-02-27 14:50:25 +00:00
|
|
|
run_subprocess(['astyle',
|
|
|
|
'--dry-run',
|
|
|
|
'--options=../.astylerc',
|
|
|
|
*cfiles,
|
|
|
|
*hfiles])
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
try:
|
|
|
|
import nose2
|
|
|
|
nose2.main()
|
|
|
|
except ImportError:
|
|
|
|
import nose
|
|
|
|
nose.runmodule()
|