Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
75aa7bef
Commit
75aa7bef
authored
Dec 29, 2016
by
Rami Ali
Committed by
Damien George
Dec 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests/unix: Improve runtime_utils.c test coverage.
parent
b7024f0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
tests/unix/extra_coverage.py.exp
tests/unix/extra_coverage.py.exp
+3
-0
unix/coverage.c
unix/coverage.c
+16
-0
No files found.
tests/unix/extra_coverage.py.exp
View file @
75aa7bef
...
...
@@ -35,6 +35,9 @@ ementation
12345678
0
0
# runtime utils
TypeError: can't convert str to int
TypeError: unsupported types for : 'str', 'str'
('0123456789', b'0123456789')
7300
7300
...
...
unix/coverage.c
View file @
75aa7bef
...
...
@@ -5,6 +5,7 @@
#include "py/runtime.h"
#include "py/repl.h"
#include "py/mpz.h"
#include "py/builtin.h"
#if defined(MICROPY_UNIX_COVERAGE)
...
...
@@ -114,6 +115,21 @@ STATIC mp_obj_t extra_coverage(void) {
mp_printf
(
&
mp_plat_print
,
"%d
\n
"
,
mpz_as_uint_checked
(
&
mpz
,
&
value
));
}
// runtime utils
{
mp_printf
(
&
mp_plat_print
,
"# runtime utils
\n
"
);
// call mp_call_function_1_protected
mp_call_function_1_protected
(
MP_OBJ_FROM_PTR
(
&
mp_builtin_abs_obj
),
MP_OBJ_NEW_SMALL_INT
(
1
));
// call mp_call_function_1_protected with invalid args
mp_call_function_1_protected
(
MP_OBJ_FROM_PTR
(
&
mp_builtin_abs_obj
),
mp_obj_new_str
(
"abc"
,
3
,
false
));
// call mp_call_function_2_protected
mp_call_function_2_protected
(
MP_OBJ_FROM_PTR
(
&
mp_builtin_divmod_obj
),
MP_OBJ_NEW_SMALL_INT
(
1
),
MP_OBJ_NEW_SMALL_INT
(
1
));
// call mp_call_function_2_protected with invalid args
mp_call_function_2_protected
(
MP_OBJ_FROM_PTR
(
&
mp_builtin_divmod_obj
),
mp_obj_new_str
(
"abc"
,
3
,
false
),
mp_obj_new_str
(
"abc"
,
3
,
false
));
}
// return a tuple of data for testing on the Python side
mp_obj_t
items
[]
=
{(
mp_obj_t
)
&
str_no_hash_obj
,
(
mp_obj_t
)
&
bytes_no_hash_obj
};
return
mp_obj_new_tuple
(
MP_ARRAY_SIZE
(
items
),
items
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment