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
77cbd173
Commit
77cbd173
authored
Mar 14, 2017
by
Rami Ali
Committed by
Damien George
Mar 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: Improve binary.c test coverage.
parent
4e86ca39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
tests/unix/extra_coverage.py.exp
tests/unix/extra_coverage.py.exp
+3
-0
unix/coverage.c
unix/coverage.c
+14
-0
No files found.
tests/unix/extra_coverage.py.exp
View file @
77cbd173
...
...
@@ -43,6 +43,9 @@ Warning: test
?
+1e+00
+1e+00
# binary
122
456
0123456789 b'0123456789'
7300
7300
...
...
unix/coverage.c
View file @
77cbd173
...
...
@@ -10,6 +10,7 @@
#include "py/emit.h"
#include "py/formatfloat.h"
#include "py/stream.h"
#include "py/binary.h"
#if defined(MICROPY_UNIX_COVERAGE)
...
...
@@ -278,6 +279,19 @@ STATIC mp_obj_t extra_coverage(void) {
mp_printf
(
&
mp_plat_print
,
"%s
\n
"
,
buf2
);
}
// binary
{
mp_printf
(
&
mp_plat_print
,
"# binary
\n
"
);
// call function with float and double typecodes
float
far
[
1
];
double
dar
[
1
];
mp_binary_set_val_array_from_int
(
'f'
,
far
,
0
,
123
);
mp_printf
(
&
mp_plat_print
,
"%.0f
\n
"
,
(
double
)
far
[
0
]);
mp_binary_set_val_array_from_int
(
'd'
,
dar
,
0
,
456
);
mp_printf
(
&
mp_plat_print
,
"%.0lf
\n
"
,
dar
[
0
]);
}
mp_obj_streamtest_t
*
s
=
m_new_obj
(
mp_obj_streamtest_t
);
s
->
base
.
type
=
&
mp_type_stest_fileio
;
s
->
buf
=
NULL
;
...
...
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