Skip to content
Snippets Groups Projects
Commit f73fcf4f authored by Alexandre Abadie's avatar Alexandre Abadie
Browse files

tests/libfixmath: migrate to testrunner

parent 3f9291a4
No related branches found
No related tags found
No related merge requests found
...@@ -5,3 +5,6 @@ USEPKG += libfixmath ...@@ -5,3 +5,6 @@ USEPKG += libfixmath
USEMODULE += libfixmath USEMODULE += libfixmath
include $(RIOTBASE)/Makefile.include include $(RIOTBASE)/Makefile.include
test:
tests/01-run.py
...@@ -190,6 +190,6 @@ int main(void) ...@@ -190,6 +190,6 @@ int main(void)
puts("Binary."); puts("Binary.");
binary_ops(); binary_ops();
puts("Done."); puts("SUCCESS");
return 0; return 0;
} }
#!/usr/bin/env python3
import os
import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
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))
for _ in range(20):
for op_name in ('sin', 'cos', 'tan'):
child.expect('{}\(-?\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))
for _ in range(20):
for op_name in ('sqrt', 'log', 'log2', 'slog2'):
child.expect('{}\(-?\d+.\d+\) = -?\d+.\d+'.format(op_name))
def expect_binary(child):
for _ in range(20):
for op_name in ('add', 'sub', 'mul', 'div', 'mod', 'sadd', 'ssub',
'smul', 'sdiv', 'min', 'max'):
child.expect('{}\(-?\d+.\d+\, -?\d+.\d+\) = -?\d+.\d+'
.format(op_name))
def testfunc(child):
child.expect_exact('Unary.')
expect_unary(child)
child.expect_exact('Binary.')
expect_binary(child)
child.expect_exact('SUCCESS')
if __name__ == "__main__":
sys.exit(testrunner.run(testfunc))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment