1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-29 19:01:22 +00:00
pqcrypto/test/test_format.py
Douglas Stebila cfc9705751 test_format wasn't actually checking output of astyle
It was only checking the return code, but astyle was always returning 0. 
Changed to parse the output and look for the string "Formatted"
2019-04-10 21:23:33 -04:00

31 lines
817 B
Python

import helpers
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
def check_format(implementation: pqclean.Implementation):
helpers.ensure_available('astyle')
cfiles = implementation.cfiles()
hfiles = implementation.hfiles()
result = helpers.run_subprocess(['astyle',
'--dry-run',
'--options=../.astylerc',
*cfiles,
*hfiles])
assert(not('Formatted' in result))
if __name__ == "__main__":
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()