25e140652b
This patch changes how most of the plain math functions are implemented: there are now two generic math wrapper functions that take a pointer to a math function (like sin, cos) and perform the necessary conversion to and from MicroPython types. This helps to reduce code size. The generic functions can also check for math domain errors in a generic way, by testing if the result is NaN or infinity combined with finite inputs. The result is that, with this patch, all math functions now have full domain error checking (even gamma and lgamma) and code size has decreased for most ports. Code size changes in bytes for those with the math module are: unix x64: -432 unix nanbox: -792 stm32: -88 esp8266: +12 Tests are also added to check domain errors are handled correctly. |
||
---|---|---|
.. | ||
basics | ||
bench | ||
cmdline | ||
cpydiff | ||
extmod | ||
feature_check | ||
float | ||
import | ||
inlineasm | ||
io | ||
jni | ||
micropython | ||
misc | ||
net_hosted | ||
net_inet | ||
pyb | ||
pybnative | ||
stress | ||
thread | ||
unicode | ||
unix | ||
wipy | ||
README | ||
pyboard.py | ||
run-bench-tests | ||
run-tests | ||
run-tests-exp.py | ||
run-tests-exp.sh |
README
This directory contains tests for various functionality areas of MicroPython. To run all stable tests, run "run-tests" script in this directory. Tests of capabilities not supported on all platforms should be written to check for the capability being present. If it is not, the test should merely output 'SKIP' followed by the line terminator, and call sys.exit() to raise SystemExit, instead of attempting to test the missing capability. The testing framework (run-tests in this directory, test_main.c in qemu_arm) recognizes this as a skipped test. There are a few features for which this mechanism cannot be used to condition a test. The run-tests script uses small scripts in the feature_check directory to check whether each such feature is present, and skips the relevant tests if not. When creating new tests, anything that relies on float support should go in the float/ subdirectory. Anything that relies on import x, where x is not a built-in module, should go in the import/ subdirectory.