Damien George
6837d46c1d
py: Fix builtin abs so it works for bools and bignum.
2015-03-14 22:07:30 +00:00
Damien George
26a9975fba
tests: Add some more tests for bytes, bignum, string and ujson.
2015-03-14 21:20:58 +00:00
Damien George
0683c1ceef
tests: Don't try to verify amount of memory used in cmd_showbc test.
2015-03-14 17:38:41 +00:00
Damien George
703c009681
tests: Add cmdline test to test showbc code.
2015-03-14 14:06:20 +00:00
Damien George
ac4f6b804f
stmhal: Fix adc.read_timed so buffer store respects element size.
...
Addresses issue #1154 .
2015-03-13 22:11:50 +00:00
Damien George
143c34109c
tests: Add ability to test uPy cmdline executable.
...
This allows to test options passed to cmdline executable, as well as the
behaviour of the REPL.
2015-03-13 10:58:34 +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
c832bde05f
tests: Add zlib test for decompressing uncompressed data.
2015-03-12 00:17:04 +00:00
Peter D. Gray
b2a237d337
py: Add support for start/stop/step attributes of builtin range object.
2015-03-11 20:02:06 +00:00
Damien George
55278dcc76
tests: Add test for modure when regex has errors.
2015-03-10 17:47:43 +00:00
Damien George
6cb6947b99
extmod/ure: Correctly return None when a group has no match.
...
See issue #1122 .
2015-03-04 13:51:32 +00:00
Damien George
72ddcfd9ff
tests: Skip basics/boundmeth1.py for native emitter.
2015-03-03 18:06: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
f2a889564b
tests: Add basics test for gc module.
2015-03-02 18:30:17 +00:00
Damien George
fe3da09fa0
tests: Use range as iterable instead of list comprehension.
...
So that navite emitter passes (comprehensions use yield which is not yet
supported by native emitter).
2015-03-02 17:55:55 +00:00
Damien George
24ffb8e876
tests: Add tests for builtins: all, any, sum, abs.
2015-03-02 17:21:10 +00:00
Damien George
96e37d3bb8
tests: Add tests for inline assembler beq_n and beq_w ops.
2015-03-02 14:31:00 +00:00
Damien George
2af921fb51
tests: Add tests for op special meths, ubinascii, complex.
2015-03-02 12:47:44 +00:00
Damien George
47538cc880
tests: Add test for micropython const feature when it has a SyntaxError.
2015-03-01 12:06:24 +00:00
Paul Sokolovsky
992284be39
tests: Add test for array slice assignment.
2015-02-27 22:17:24 +02:00
Damien George
b67253e96f
tests: Update pyb/uart.py test since baudrate of 1200 is too low.
2015-02-27 00:40:08 +00:00
Damien George
4852e09c79
py: Fix adding of traceback so that it appends to existing info.
...
This makes exception traceback info self contained (ie doesn't rely on
list object, which was a bit of a hack), reduces code size, and reduces
RAM footprint of exception by eliminating the list object.
Addresses part of issue #1126 .
2015-02-27 00:36:39 +00:00
Damien George
626ee90ce1
tests: Add more tests for pyb.Timer class.
2015-02-23 13:18:33 +00:00
Damien George
5c047b97f2
tests: Add test for math special functions.
2015-02-22 14:49:46 +00:00
Damien George
4e3906d6b5
tests: Add tests for ure groups and named char classes.
...
Issue #1122 should now be fixed.
2015-02-21 10:39:41 +00:00
Paul Sokolovsky
2e24034c3f
run-tests-exp.sh: Typo fix in comment.
2015-02-21 03:22:33 +02:00
Damien George
eff10f66a6
py: Implement bl/bx instructions for inline Thumb assembler.
2015-02-16 18:17:07 +00:00
Paul Sokolovsky
ee831cafa9
tests: Add another testcase for relative imports.
2015-02-16 12:11:41 +02:00
Henrik Sölver
f80f1a7077
stmhal: Add support for CAN rx callbacks.
2015-02-15 03:10:53 +00:00
Damien George
ed8b4da0db
tests: Remove obsolete test; don't use fp in micropython/ tests.
2015-02-15 01:57:39 +00:00
Damien George
f6532bb9e0
py: Simplify and remove redundant code for __iter__ method lookup.
2015-02-15 01:10:13 +00:00
Damien George
d1c3788375
py: Fix loading of immediate pointer in Thumb assembler.
...
Addresses issue #1117 .
2015-02-15 00:45:28 +00:00
stijn
c1832fd206
py: Add setattr builtin.
2015-02-14 23:35:00 +00:00
Damien George
baafb290ad
stmhal: Add uart.sendbreak() method, to send a break condition.
2015-02-13 19:04:24 +00:00
Damien George
192d536fe4
py: Implement clz and rbit for inline Thumb assembler.
2015-02-13 11:06:23 +00:00
Damien George
32f0b7942c
py: Implement sdiv/udiv for inline Thumb assembler.
2015-02-13 10:43:05 +00:00
Damien George
0d967b8ae4
py: Implement push/pop for inline Thumb assembler.
2015-02-13 02:30:35 +00:00
Damien George
48244044a2
py: Allow subclass of native object to delegate to the native buffer_p.
...
Addresses issue #1109 .
2015-02-09 15:08:00 +00:00
Paul Sokolovsky
194117a066
objstr: Fix bytes creation from array of long ints.
2015-02-09 12:11:49 +08: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
5f64dc55d8
extmod: Make ujson.loads raise exception if given empty string.
...
Addresses issue #1097 .
2015-02-02 21:52:19 +00:00
Damien George
e8b877be60
tests: Disable float/cmath_fun.py for native emitter.
2015-02-02 20:01:51 +00:00
Damien George
744e767458
py: Make list.sort keep stack usage within O(log(N)) bound.
...
Also fix list.sort so it works with user-defined types, and parse the
keyword arguments properly.
Addresses issue #338 .
2015-02-02 15:14:22 +00:00
Damien George
ae3150cb5c
tests: Add test for cmath module.
2015-02-02 12:52:38 +00:00
Damien George
32bade19d9
py: Convert CR to LF and CR LF to LF in lexer.
...
Only noticeable difference is how newlines are encoded in triple-quoted
strings. The behaviour now matches CPython3.
2015-01-30 00:27:46 +00:00
Damien George
92ab95f215
tests: Add some tests to improve coverage.
2015-01-29 14:56:09 +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
Paul Sokolovsky
57aebe1714
tests: Add testcase for bytes() on values in range 128-255.
2015-01-28 22:29:51 +02:00
Paul Sokolovsky
2324f3ef29
moduzlib: Implement raw DEFLATE decoding support.
2015-01-28 02:21:49 +02: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
Damien George
a9dc9b8f6d
py: Fix comparison of minus-zero long int.
2015-01-27 17:47:38 +00: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
Paul Sokolovsky
66b060f3e6
tests: Fix typo in file_long_read3.py.
2015-01-23 19:00:02 +02:00
Paul Sokolovsky
444331c07f
modujson: .loads(): Handle more whitespace characters.
2015-01-23 18:41:29 +02:00
Paul Sokolovsky
1f04336b23
tests: Add extra test for reading multiple of internal chunk size.
2015-01-23 18:18:11 +02:00
Paul Sokolovsky
220d21e1bf
tests: Add testcase for reading amounts bigger than buffer/chunk size.
2015-01-23 16:42:02 +02: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
Damien George
b6e6b5277f
py: Implement proper re-raising in native codegen's finally handler.
...
This allows an exception to propagate correctly through a finally
handler.
2015-01-21 17:00:01 +00:00
Damien George
962a5d50c9
py: Implement __reversed__ slot.
...
Addresses issue #1073 .
2015-01-21 00:19:42 +00:00
stijn
bf19541f46
py: Prevent segfault for operations on closed StringIO.
...
Addresses issue #1067 .
2015-01-20 23:50:43 +00:00
Damien George
1e1779eacf
py: Reluctantly add an extra pass to bytecode compiler.
...
Bytecode also needs a pass to compute the stack size. This is because
the state size of the bytecode function is encoded as a variable uint,
so we must know the value of this uint before we encode it (otherwise
the size of the generated code changes from one pass to the next).
Having an entire pass for this seems wasteful (in time). Alternative is
to allocate fixed space for the state size (would need 3-4 bytes to be
general, when 1 byte is usually sufficient) which uses a bit of extra
RAM per bytecode function, and makes the code less elegant in places
where this uint is encoded/decoded.
So, for now, opt for an extra pass.
2015-01-14 00:20:28 +00:00
Damien George
4c81ba8015
py: Never intern data of large string/bytes object; add relevant tests.
...
Previously to this patch all constant string/bytes objects were
interned by the compiler, and this lead to crashes when the qstr was too
long (noticeable now that qstr length storage defaults to 1 byte).
With this patch, long string/bytes objects are never interned, and are
referenced directly as constant objects within generated code using
load_const_obj.
2015-01-13 16:21:23 +00:00
Damien George
c38dc3ccc7
py: Implement fallback for equality check for all types.
...
Return "not equal" for objects that don't implement equality check.
This is as per Python specs.
2015-01-11 15:13:18 +00:00
Paul Sokolovsky
7bfe4b21b9
tests: Make ffi_callback.py be able to run on uclibc and macosx.
...
Similar to ffi_float.py.
2015-01-10 00:35:48 +02:00
Damien George
c33ecb83ba
tests: Add test for when instance member overrides class member.
2015-01-08 17:48:44 +00:00
Damien George
19b3fea6a8
tests: Separate out test cases that rely on float support to float/ dir.
2015-01-08 15:41:37 +00:00
Damien George
ad2307c92c
py: Temporary fix for conversion of float to int when fits in small int.
...
Addresses issue #1044 (see also #1040 ). Could do with a better fix.
2015-01-07 12:10:47 +00:00
Paul Sokolovsky
343ca1e63a
objarray: Make sure that longint works as bytearray size.
2015-01-04 17:19:16 +02:00
Paul Sokolovsky
c114496641
objstr: Implement kwargs support for str.format().
2015-01-04 00:26:31 +02:00
Damien George
6fd4b36bc5
py: Raise exception if trying to convert inf/nan to int.
2015-01-02 23:04:09 +00:00
David Steinberg
6e0b6d02db
py: Fix float to int conversion for large exponents.
2015-01-02 22:31:41 +00:00
stijn
021dc44009
py: Allow keyword arguments for namedtuple
2015-01-01 14:53:23 +02:00
stijn
12340147b0
py: Use sequence of strings for named tuple initialization
...
- remove single string initialization style
- take list of strings instead
- store list in the type for fast lookup
2015-01-01 14:53:23 +02:00
Damien George
e0ac194f4f
py: Fix rshift and not of zero/one edge cases in mpz.
...
Addresses issue #1027 .
2014-12-31 19:35:01 +00:00
Damien George
816a46a4ab
tests: Disable float/float2int.py on pyboard (needs double prec).
2014-12-31 18:46:18 +00:00
Paul Sokolovsky
2c75665445
objstr: Fix %d-formatting of floats.
2014-12-31 02:21:19 +02:00
Paul Sokolovsky
12033df511
py: Partially fix float to int conversion.
...
This fixes conversion when float type has more mantissa bits than small int,
and float value has small exponent. This is for example the case of 32-bit
platform using doubles, and converting value of time.time(). Conversion of
floats with larg exponnet is still not handled correctly.
2014-12-30 00:22:50 +02:00
Damien George
c55a4d82cf
py: Make bytes objs work with more str methods; add tests.
2014-12-24 20:28:30 +00:00
Paul Sokolovsky
7fdb8d78a4
tests: Add run-tests-exp.py, simple MicroPython-based test runner.
...
This script is rewrite of run-tests-exp.sh, and tries to achieve self-hosted
testsuite running in environments where neither CPython nor unix shell is
available. As run-tests-exp.sh, it requires complete set of .exp files
pre-generated with ./run-test --write-exp.
2014-12-24 16:34:05 +00:00
Paul Sokolovsky
978f4ca2e1
run-tests: Allow to run testuite against Windows build on Linux (using Wine).
...
Just adjust line-endings of micropython.exe output, the rest should be
handled by Wine (automagically on properly configured distro).
To run:
MICROPY_MICROPYTHON=../windows/micropython.exe ./run-tests
2014-12-20 16:53:46 +02:00
stijn
f5efefd5a0
windows: Correctly interpret skipped tests, enable uhashlib and ubinascii
2014-12-20 16:52:22 +02:00
Damien George
f04329e93b
lib/libm: Add acosh, asinh, atanh, tan; get working with stmhal.
...
acoshf, asinhf, atanhf were added from musl. mathsincos.c was
split up into its original, separate files (from newlibe-nano-2).
tan was added.
All of the important missing float functions are now implemented,
and pyboard now passes tests/float/math_fun.py (finally!).
2014-12-18 14:44:02 +00:00
Damien George
6936f4626c
tests: Get misc/print_exception and pyb/spi working on pyboard.
2014-12-18 13:37:56 +00:00
Paul Sokolovsky
c8b0229bc7
tests: sha256: skip test if uhashlib module is not available.
2014-12-18 00:32:15 +02:00
Paul Sokolovsky
7a4765dbeb
tests: Add testcase for ffi callbacks.
2014-12-15 02:18:54 +02:00
Paul Sokolovsky
c0bc3bd736
asmarm: Fix bug with encoding small negative ints using MVN instruction.
2014-12-14 03:24:17 +02:00
Paul Sokolovsky
138562ccd9
run-tests: Skip native/viper tests based on prefix.
...
Otherwise, new tests are forgotten to be added to explicit lists. Issue
found running on Debian/ARM.
2014-12-13 00:51:24 +02:00
Damien George
e181c0dc07
py: Fix optimised for-loop compiler so it follows proper semantics.
...
You can now assign to the range end variable and the for-loop still
works correctly. This fully addresses issue #565 .
Also fixed a bug with the stack not being fully popped when breaking out
of an optimised for-loop (and it's actually impossible to write a test
for this case!).
2014-12-12 17:19:56 +00:00
Paul Sokolovsky
1ca28bd570
run-tests: Reset MICROPYPATH, to make sure tests use only builtin modules.
2014-12-12 00:58:07 +02:00
Paul Sokolovsky
dbc7854355
run-tests: PEP8 fix.
2014-12-12 00:58:07 +02:00
Paul Sokolovsky
f42b3c7599
tests: Activate recursive_data.py test, now that io.StringIO is available.
2014-12-12 00:58:07 +02:00
Damien George
5fba93a26b
tests: Add test for semantics of for-loop that optimisation can break.
2014-12-11 17:40:41 +00:00
Damien George
f905145c6d
tests: Disable print_exception test when using native emitter.
2014-12-11 17:34:55 +00:00
Damien George
184182d14c
tests: Fix print_exception test and re-enable it on Travis CI.
...
Issue was with uPy: on local machine with micropython-lib installed, io
module is available. Not the case on Travis CI, where only _io module
is available in uPy.
2014-12-11 17:10:25 +00:00
Paul Sokolovsky
66a6caa307
run-tests: Skip print_exception.py on TravisCI, as it irreproducibly fails.
...
TODO: Figure out what's wrong on Travis.
2014-12-11 15:03:29 +02:00
Damien George
4140e19c8a
tests: Fix print_exception.py to work on Travis CI.
2014-12-10 21:45:51 +00:00
Paul Sokolovsky
e8487ea1be
tests: Add test for print_exception() function.
2014-12-10 20:48:53 +00:00
Damien George
78d702c300
py: Allow builtins to be overridden.
...
This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS)
which, when enabled, allows to override all names within the builtins
module. A builtins override dict is created the first time the user
assigns to a name in the builtins model, and then that dict is searched
first on subsequent lookups. Note that this implementation doesn't
allow deleting of names.
This patch also does some refactoring of builtins code, creating the
modbuiltins.c file.
Addresses issue #959 .
2014-12-09 16:19:48 +00:00