diff options
author | Damien George <damien.p.george@gmail.com> | 2016-01-08 14:27:21 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-01-08 14:27:21 +0000 |
commit | b1fa907d563b9efb77edc6a83056320a14408966 (patch) | |
tree | 23cf82b3606783c67fa519d934a2dd7ce909546b /tests/float/cmath_fun_special.py | |
parent | 978d2e55efaeed26f4e9d4c21a10e41e4f150f72 (diff) | |
download | micropython-b1fa907d563b9efb77edc6a83056320a14408966.tar.gz micropython-b1fa907d563b9efb77edc6a83056320a14408966.zip |
tests: Allow float tests to run when MATH_SPECIAL_FUNCTIONS is disabled.
Diffstat (limited to 'tests/float/cmath_fun_special.py')
-rw-r--r-- | tests/float/cmath_fun_special.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/float/cmath_fun_special.py b/tests/float/cmath_fun_special.py new file mode 100644 index 0000000000..422964dd75 --- /dev/null +++ b/tests/float/cmath_fun_special.py @@ -0,0 +1,32 @@ +# test the special functions imported from cmath + +try: + from cmath import * + log10 +except (ImportError, NameError): + print("SKIP") + import sys + sys.exit() + +test_values_non_zero = [] +base_values = (0.0, 0.5, 1.2345, 10.) +for r in base_values: + for i in base_values: + if r != 0. or i != 0.: + test_values_non_zero.append(complex(r, i)) + if r != 0.: + test_values_non_zero.append(complex(-r, i)) + if i != 0.: + test_values_non_zero.append(complex(r, -i)) + if r != 0. and i != 0.: + test_values_non_zero.append(complex(-r, -i)) + +functions = [ + ('log10', log10, test_values_non_zero), +] + +for f_name, f, test_vals in functions: + print(f_name) + for val in test_vals: + ret = f(val) + print("complex(%.5g, %.5g)" % (ret.real, ret.imag)) |