1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-29 19:01:22 +00:00

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"
This commit is contained in:
Douglas Stebila 2019-04-10 21:23:33 -04:00
parent f388d6f93e
commit cfc9705751
4 changed files with 5 additions and 4 deletions

View File

@ -13,7 +13,7 @@
#define min(x, y) (((x) < (y)) ? (x) : (y)) #define min(x, y) (((x) < (y)) ? (x) : (y))
uint16_t PQCLEAN_FRODOKEM1344SHAKE_CLEAN_LE_TO_UINT16(const uint16_t n) { uint16_t PQCLEAN_FRODOKEM1344SHAKE_CLEAN_LE_TO_UINT16(const uint16_t n) {
return (((uint8_t *) &(n))[0] | (((uint8_t *) &(n))[1] << 8)); return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8));
} }
uint16_t PQCLEAN_FRODOKEM1344SHAKE_CLEAN_UINT16_TO_LE(const uint16_t n) { uint16_t PQCLEAN_FRODOKEM1344SHAKE_CLEAN_UINT16_TO_LE(const uint16_t n) {

View File

@ -13,7 +13,7 @@
#define min(x, y) (((x) < (y)) ? (x) : (y)) #define min(x, y) (((x) < (y)) ? (x) : (y))
uint16_t PQCLEAN_FRODOKEM640SHAKE_CLEAN_LE_TO_UINT16(const uint16_t n) { uint16_t PQCLEAN_FRODOKEM640SHAKE_CLEAN_LE_TO_UINT16(const uint16_t n) {
return (((uint8_t *) &(n))[0] | (((uint8_t *) &(n))[1] << 8)); return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8));
} }
uint16_t PQCLEAN_FRODOKEM640SHAKE_CLEAN_UINT16_TO_LE(const uint16_t n) { uint16_t PQCLEAN_FRODOKEM640SHAKE_CLEAN_UINT16_TO_LE(const uint16_t n) {

View File

@ -13,7 +13,7 @@
#define min(x, y) (((x) < (y)) ? (x) : (y)) #define min(x, y) (((x) < (y)) ? (x) : (y))
uint16_t PQCLEAN_FRODOKEM976SHAKE_CLEAN_LE_TO_UINT16(const uint16_t n) { uint16_t PQCLEAN_FRODOKEM976SHAKE_CLEAN_LE_TO_UINT16(const uint16_t n) {
return (((uint8_t *) &(n))[0] | (((uint8_t *) &(n))[1] << 8)); return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8));
} }
uint16_t PQCLEAN_FRODOKEM976SHAKE_CLEAN_UINT16_TO_LE(const uint16_t n) { uint16_t PQCLEAN_FRODOKEM976SHAKE_CLEAN_UINT16_TO_LE(const uint16_t n) {

View File

@ -13,11 +13,12 @@ def check_format(implementation: pqclean.Implementation):
helpers.ensure_available('astyle') helpers.ensure_available('astyle')
cfiles = implementation.cfiles() cfiles = implementation.cfiles()
hfiles = implementation.hfiles() hfiles = implementation.hfiles()
helpers.run_subprocess(['astyle', result = helpers.run_subprocess(['astyle',
'--dry-run', '--dry-run',
'--options=../.astylerc', '--options=../.astylerc',
*cfiles, *cfiles,
*hfiles]) *hfiles])
assert(not('Formatted' in result))
if __name__ == "__main__": if __name__ == "__main__":