Paul Sokolovsky
4b03941f5e
tests/float2int*: Suffix with _intbig, don't run on any other int type.
...
I.e. they don't run successfully with MICROPY_LONGINT_IMPL_NONE
and MICROPY_LONGINT_IMPL_LONGLONG (the problem is that they generate
different output than CPython, TODO to fix that).
2017-03-06 16:30:12 +01:00
Paul Sokolovsky
121fb88988
float/float2int*: Make actually be parsable for MICROPY_LONGINT_IMPL_NONE.
...
The use of large literal numbers is a big no-no when it comes to writing
programs which work with different int representations. Also, some checks
are pretty adhoc (e.g using struct module to check for 64-bitness). This
change bases entire detection on sys.maxsize and integer operarions, and
thus more correct, even if longer.
Note that this change doesn't mean that any of these tests can pass with
anything but MPZ - even despite checking for various int representations,
the tests aren't written to be portable among them.
2017-03-06 16:23:09 +01:00
Paul Sokolovsky
325c4473a5
tests/float/complex1: Split out intbig test.
2017-03-06 15:46:01 +01:00
Damien George
8a39e18f5f
tests/float: Add tests for zero to a negative power.
2017-02-03 00:04:13 +11:00
Damien George
213a718953
tests/float: Add test for assigning to attribute of complex number.
2017-01-19 23:37:21 +11:00
Rami Ali
64dc925c4a
tests/float: Improve formatfloat.c test coverage using Python.
2017-01-05 12:31:05 +11:00
Rami Ali
531c206e8b
tests: Add tests to improve coverage of runtime.c.
2016-12-21 15:44:41 +11:00
Damien George
49bf7617d0
tests/float/builtin_float_round: Test round() with second arg.
2016-12-20 14:01:10 +11:00
Damien George
290daa15d9
tests/float: Add test for parsing a float from an empty string.
2016-09-27 15:44:56 +10:00
Damien George
e1e7657277
py/formatfloat: Fix further cases of buffer overflow in formatting.
...
Includes extensive test cases to catch hopefully all cases where
buffer might overflow.
2016-03-29 22:07:15 +01:00
Damien George
cea6cf8a5e
py/formatfloat: Fix buffer overflow when formatting tiny numbers.
2016-03-15 12:21:56 +00:00
Paul Sokolovsky
d973c1bc12
test/string_format_fp30: Variant of string_format for 30-bit stuffed float.
2016-03-06 06:10:40 +02:00
Paul Sokolovsky
50e0a7b9d4
test/float2int_fp30: Variant of float2int for 30-bit stuffed float.
2016-03-06 06:08:38 +02:00
Paul Sokolovsky
d4315a6caf
float/string_format: Split large test in 2.
2016-02-13 17:18:55 +02:00
Paul Sokolovsky
dc587a3623
test/float2int: Make test output clearer.
2016-02-13 17:03:02 +02:00
Damien George
3b936a5f4c
tests: Fix math_fun_special test so it passes with single prec float.
2016-01-08 17:58:02 +00:00
Damien George
b1fa907d56
tests: Allow float tests to run when MATH_SPECIAL_FUNCTIONS is disabled.
2016-01-08 14:27:21 +00:00
Michael Buesch
17298af61e
py/modmath: Add domain error checking to sqrt, log, log2, log10.
...
These functions will raise 'ValueError: math domain error' on invalid
input.
2015-12-12 15:12:54 +00:00
Paul Sokolovsky
b64e0575fd
tests/float/string_format: Add testcase for incorrect rounding for %f.
2015-11-22 18:08:49 +02:00
Damien George
e5635f4ab3
py: Catch all cases of integer (big and small) division by zero.
2015-10-01 22:48:48 +01:00
Damien George
a81539db25
tests: Add further tests for mpz code.
2015-10-01 18:49:37 +01:00
Dave Hylands
9d6128acdc
stmhal: fix single precision float printing error
...
Fixes #1435 .
2015-09-11 23:09:50 +03:00
Damien George
2b000474d9
py/lexer: Properly classify floats that look like hex numbers.
...
Eg 0e0 almost looks like a hex number but in fact is a float.
2015-09-07 17:33:44 +01:00
Damien George
1d350b8ac6
tests: Add a few tests for bool, bytearray, float to improve coverage.
2015-08-29 23:13:28 +01:00
Damien George
d007cb8903
tests: Add more tests to improve coverage, mostly testing exceptions.
2015-08-21 12:02:09 +01:00
Sebastian Plamauer
1e8ca3a3cf
modbuiltins: Implement round() to precision.
2015-07-19 21:49:44 +03:00
Damien George
6f49520042
py: Implement second arg for math.log (optional value for base).
2015-06-13 22:35:25 +01:00
Damien George
9ede4dcfbb
tests: Add some tests for printing floats to improve coverage.
2015-05-28 14:24:47 +00:00
Damien George
79474c6b16
py: Remove unnecessary extra handling of padding of nan/inf.
...
C's printf will pad nan/inf differently to CPython. Our implementation
originally conformed to C, now it conforms to CPython's way.
Tests for this are also added in this patch.
2015-05-28 14:22:12 +00:00
stijn
861670ba2a
py: Implement mp_format_float for doubles and use where appropriate
...
This allows using (almost) the same code for printing floats everywhere,
removes the dependency on sprintf and uses just snprintf and
applies an msvc-specific fix for snprintf in a single place so
nan/inf are now printed correctly.
2015-05-17 21:47:11 +01:00
stijn
709955b601
py: Fix printing of complex number when imaginary part is nan
2015-05-13 23:10:15 +01:00
Paul Sokolovsky
3d3ef36e97
modstruct: Rename module to "ustruct", to allow full Python-level impl.
2015-05-04 16:53:52 +03:00
Damien George
956d765786
py: Fix printing of "inf" and "nan" floating point values.
2015-04-22 16:51:29 +01:00
Damien George
97abe22963
tests: Add tests to exercise lexer; and some more complex number tests.
2015-04-04 23:16:22 +01:00
Damien George
9dd3640464
tests: Add missing tests for builtins, and many other things.
2015-04-04 22:05:30 +01:00
Damien George
214179b430
tests: Add tests for SyntaxError, TypeError, and other missing things.
...
This is intended to improve coverage of the test suite.
2015-03-25 23:10:09 +00:00
Damien George
f256cfef4f
tests: Add some more tests for complex numbers and ure module.
2015-03-14 22:56:02 +00:00
Damien George
af43565322
tests: Add tests for things that are not already tested.
...
The aim here is to improve coverage of the code.
2015-03-12 22:48:45 +00:00
Damien George
086a7616dd
tests: Add tests for boundmeth; and bignum cmp, unary, float, error.
2015-03-03 16:45:39 +00:00
stijn
25f1264699
tests: Skip special math fun tests when math module exists but not funs.
2015-03-03 14:36:59 +00:00
Damien George
24ffb8e876
tests: Add tests for builtins: all, any, sum, abs.
2015-03-02 17:21:10 +00:00
Damien George
2af921fb51
tests: Add tests for op special meths, ubinascii, complex.
2015-03-02 12:47:44 +00:00
Damien George
5c047b97f2
tests: Add test for math special functions.
2015-02-22 14:49:46 +00:00
Damien George
7d414a1b52
py: Parse big-int/float/imag constants directly in parser.
...
Previous to this patch, a big-int, float or imag constant was interned
(made into a qstr) and then parsed at runtime to create an object each
time it was needed. This is wasteful in RAM and not efficient. Now,
these constants are parsed straight away in the parser and turned into
objects. This allows constants with large numbers of digits (so
addresses issue #1103 ) and takes us a step closer to #722 .
2015-02-08 01:57:40 +00:00
Damien George
ae3150cb5c
tests: Add test for cmath module.
2015-02-02 12:52:38 +00:00
Damien George
26c0b155fa
tests: Make float/int_power.py pass on pyboard/single prec float.
2015-01-29 13:56:58 +00:00
Damien George
12c66be2b8
tests: Add some tests to improve coverage.
...
Used gcov to find some parts of vm.c, runtime.c, obj.c that were not
covered by any tests. Still need to use gcov more thoroughly.
2015-01-29 00:44:11 +00:00
David Steinberg
0b3014ce3a
py: Add support for floats in mp_binary_{get,set}_val()
...
- This then provides support for floats in the struct package
2015-01-27 22:49:01 +02:00
David Steinberg
4c1a7e0d6a
tests: Update float2int tests for new range classifications
...
- Tests vary based on build configuration (32/64-bit and internal int type).
- Added tests for exceptions raised on overflow of int type.
2015-01-24 21:05:16 +00:00
Damien George
6d1f5070ce
lib/libm: Add frexp and modf functions; use in stmhal; add tests.
...
Addresses issue #1081 .
2015-01-22 13:48:29 +00:00