File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ Warning: test
4343?
4444+1e+00
4545+1e+00
46+ # binary
47+ 122
48+ 456
46490123456789 b'0123456789'
47507300
48517300
Original file line number Diff line number Diff line change 1010#include "py/emit.h"
1111#include "py/formatfloat.h"
1212#include "py/stream.h"
13+ #include "py/binary.h"
1314
1415#if defined(MICROPY_UNIX_COVERAGE )
1516
@@ -278,6 +279,19 @@ STATIC mp_obj_t extra_coverage(void) {
278279 mp_printf (& mp_plat_print , "%s\n" , buf2 );
279280 }
280281
282+ // binary
283+ {
284+ mp_printf (& mp_plat_print , "# binary\n" );
285+
286+ // call function with float and double typecodes
287+ float far [1 ];
288+ double dar [1 ];
289+ mp_binary_set_val_array_from_int ('f' , far , 0 , 123 );
290+ mp_printf (& mp_plat_print , "%.0f\n" , (double )far [0 ]);
291+ mp_binary_set_val_array_from_int ('d' , dar , 0 , 456 );
292+ mp_printf (& mp_plat_print , "%.0lf\n" , dar [0 ]);
293+ }
294+
281295 mp_obj_streamtest_t * s = m_new_obj (mp_obj_streamtest_t );
282296 s -> base .type = & mp_type_stest_fileio ;
283297 s -> buf = NULL ;
You can’t perform that action at this time.
0 commit comments