tests/pkg_libfixmath: fix PEP8 issues
This commit is contained in:
parent
19917f18b7
commit
326f5f1d12
@ -78,12 +78,16 @@ def main():
|
|||||||
abs_error = abs(res_locals['result'] - float(res_locals['expected']))
|
abs_error = abs(res_locals['result'] - float(res_locals['expected']))
|
||||||
res_locals['result'] = '{:.4f}'.format(res_locals['result'])
|
res_locals['result'] = '{:.4f}'.format(res_locals['result'])
|
||||||
if abs_error > ABS_ERROR_LIMIT:
|
if abs_error > ABS_ERROR_LIMIT:
|
||||||
print('{}: {} != {}, {:.4f} > {}'.format(res_locals['input'], res_locals['result'], res_locals['expected'],
|
print('{}: {} != {}, {:.4f} > {}'.format(
|
||||||
abs_error, ABS_ERROR_LIMIT))
|
res_locals['input'],
|
||||||
|
res_locals['result'],
|
||||||
|
res_locals['expected'],
|
||||||
|
abs_error,
|
||||||
|
ABS_ERROR_LIMIT))
|
||||||
errors += 1
|
errors += 1
|
||||||
except:
|
except Exception as exc:
|
||||||
errors += 1
|
errors += 1
|
||||||
print('ERROR {}'.format(line))
|
print('ERROR: {}: {}'.format(line, exc))
|
||||||
|
|
||||||
print('{} calculations passed.'.format(total - errors))
|
print('{} calculations passed.'.format(total - errors))
|
||||||
if errors:
|
if errors:
|
||||||
|
|||||||
@ -7,26 +7,26 @@ from testrunner import run, test_utils_interactive_sync
|
|||||||
def expect_unary(child):
|
def expect_unary(child):
|
||||||
for _ in range(20):
|
for _ in range(20):
|
||||||
for op_name in ('abs', 'sq', 'atan', 'exp'):
|
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 _ in range(20):
|
||||||
for op_name in ('sin', 'cos', 'tan'):
|
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 _ in range(20):
|
||||||
for op_name in ('asin', 'acos'):
|
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 _ in range(20):
|
||||||
for op_name in ('sqrt', 'log', 'log2', 'slog2'):
|
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):
|
def expect_binary(child):
|
||||||
for _ in range(1500):
|
for _ in range(1500):
|
||||||
for op_name in ('add', 'sub', 'mul', 'div', 'mod', 'sadd', 'ssub',
|
for op_name in ('add', 'sub', 'mul', 'div', 'mod', 'sadd', 'ssub',
|
||||||
'smul', 'sdiv', 'min', 'max'):
|
'smul', 'sdiv', 'min', 'max'):
|
||||||
child.expect('{}\(-?\d+.\d+\, -?\d+.\d+\) = -?\d+.\d+'
|
child.expect(r'{}\(-?\d+.\d+\, -?\d+.\d+\) = -?\d+.\d+'
|
||||||
.format(op_name))
|
.format(op_name))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user