2019-04-10 22:03:02 +01:00
|
|
|
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:
|
2019-04-10 22:03:02 +01:00
|
|
|
if helpers.permit_test('format', implementation):
|
|
|
|
yield check_format, implementation
|
2019-02-27 14:50:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
def check_format(implementation: pqclean.Implementation):
|
2019-04-10 22:03:02 +01:00
|
|
|
helpers.ensure_available('astyle')
|
2019-03-05 13:35:19 +00:00
|
|
|
cfiles = implementation.cfiles()
|
|
|
|
hfiles = implementation.hfiles()
|
2019-04-11 02:23:33 +01:00
|
|
|
result = helpers.run_subprocess(['astyle',
|
2019-02-27 14:50:25 +00:00
|
|
|
'--dry-run',
|
|
|
|
'--options=../.astylerc',
|
|
|
|
*cfiles,
|
|
|
|
*hfiles])
|
2019-04-11 02:23:33 +01:00
|
|
|
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()
|