mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
Merge pull request #8011 from aabadie/pr/tests/pexpect_libfixmath
tests/libfixmath_*: migrate to testrunner
This commit is contained in:
commit
47ab744f77
@ -5,3 +5,6 @@ USEPKG += libfixmath
|
||||
USEMODULE += libfixmath
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
test:
|
||||
tests/01-run.py
|
||||
|
||||
@ -190,6 +190,6 @@ int main(void)
|
||||
puts("Binary.");
|
||||
binary_ops();
|
||||
|
||||
puts("Done.");
|
||||
puts("SUCCESS");
|
||||
return 0;
|
||||
}
|
||||
|
||||
44
tests/libfixmath/tests/01-run.py
Executable file
44
tests/libfixmath/tests/01-run.py
Executable file
@ -0,0 +1,44 @@
|
||||
#!/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))
|
||||
@ -17,3 +17,6 @@ ifneq (,$(filter native qemu-i386,$(BOARD)))
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
test:
|
||||
tests/01-run.py
|
||||
|
||||
@ -40,6 +40,6 @@ int main(void)
|
||||
RUN(fix16_str_unittests);
|
||||
RUN(fix16_unittests);
|
||||
|
||||
puts("All tests executed.");
|
||||
puts("SUCCESS");
|
||||
return 0;
|
||||
}
|
||||
|
||||
20
tests/libfixmath_unittests/tests/01-run.py
Executable file
20
tests/libfixmath_unittests/tests/01-run.py
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2017 Inria
|
||||
#
|
||||
# This file is subject to the terms and conditions of the GNU Lesser
|
||||
# General Public License v2.1. See the file LICENSE in the top level
|
||||
# directory for more details.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
|
||||
import testrunner
|
||||
|
||||
|
||||
def testfunc(child):
|
||||
child.expect('SUCCESS')
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(testrunner.run(testfunc))
|
||||
Loading…
x
Reference in New Issue
Block a user