1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests/pkg_libfixmath: fix PEP8 issues

This commit is contained in:
Alexandre Abadie 2019-11-11 15:48:23 +01:00
parent 19917f18b7
commit 326f5f1d12
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
2 changed files with 13 additions and 9 deletions

View File

@ -78,12 +78,16 @@ def main():
abs_error = abs(res_locals['result'] - float(res_locals['expected']))
res_locals['result'] = '{:.4f}'.format(res_locals['result'])
if abs_error > ABS_ERROR_LIMIT:
print('{}: {} != {}, {:.4f} > {}'.format(res_locals['input'], res_locals['result'], res_locals['expected'],
abs_error, ABS_ERROR_LIMIT))
print('{}: {} != {}, {:.4f} > {}'.format(
res_locals['input'],
res_locals['result'],
res_locals['expected'],
abs_error,
ABS_ERROR_LIMIT))
errors += 1
except:
except Exception as exc:
errors += 1
print('ERROR {}'.format(line))
print('ERROR: {}: {}'.format(line, exc))
print('{} calculations passed.'.format(total - errors))
if errors:

View File

@ -7,26 +7,26 @@ from testrunner import run, test_utils_interactive_sync
def expect_unary(child):
for _ in range(20):
for op_name in ('abs', 'sq', 'atan', 'exp'):
child.expect('{}\(-?\d+\.\d+\) = -?\d+\.\d+'.format(op_name))
child.expect(r'{}\(-?\d+\.\d+\) = -?\d+\.\d+'.format(op_name))
for _ in range(20):
for op_name in ('sin', 'cos', 'tan'):
child.expect('{}\(-?\d+.\d+\) = -?\d+.\d+'.format(op_name))
child.expect(r'{}\(-?\d+.\d+\) = -?\d+.\d+'.format(op_name))
for _ in range(20):
for op_name in ('asin', 'acos'):
child.expect('{}\(-?\d+.\d+\) = -?\d+.\d+'.format(op_name))
child.expect(r'{}\(-?\d+.\d+\) = -?\d+.\d+'.format(op_name))
for _ in range(20):
for op_name in ('sqrt', 'log', 'log2', 'slog2'):
child.expect('{}\(-?\d+.\d+\) = -?\d+.\d+'.format(op_name))
child.expect(r'{}\(-?\d+.\d+\) = -?\d+.\d+'.format(op_name))
def expect_binary(child):
for _ in range(1500):
for op_name in ('add', 'sub', 'mul', 'div', 'mod', 'sadd', 'ssub',
'smul', 'sdiv', 'min', 'max'):
child.expect('{}\(-?\d+.\d+\, -?\d+.\d+\) = -?\d+.\d+'
child.expect(r'{}\(-?\d+.\d+\, -?\d+.\d+\) = -?\d+.\d+'
.format(op_name))