@@ -204,8 +204,20 @@ static mp_obj_t extra_coverage(void) {
204
204
mp_printf (& mp_plat_print , "%d %+d % d\n" , -123 , 123 , 123 ); // sign
205
205
mp_printf (& mp_plat_print , "%05d\n" , -123 ); // negative number with zero padding
206
206
mp_printf (& mp_plat_print , "%ld\n" , 123 ); // long
207
- mp_printf (& mp_plat_print , "%lx\n" , 0x123 ); // long hex
208
- mp_printf (& mp_plat_print , "%X\n" , 0x1abcdef ); // capital hex
207
+ mp_printf (& mp_plat_print , "%lx\n" , 0x123fl ); // long hex
208
+ mp_printf (& mp_plat_print , "%lX\n" , 0x123fl ); // capital long hex
209
+ #if ((ULLONG_MAX >> 17 ) >> 17 ) != 0
210
+ mp_printf (& mp_plat_print , "%llx\n" , LLONG_MAX ); // long long hex
211
+ mp_printf (& mp_plat_print , "%llX\n" , LLONG_MAX ); // capital long long hex
212
+ mp_printf (& mp_plat_print , "%llu\n" , ULLONG_MAX ); // unsigned long long
213
+ #else
214
+ // fake for platforms without 64-bit long long ints
215
+ mp_printf (& mp_plat_print , "7fffffffffffffff\n" , LLONG_MAX );
216
+ mp_printf (& mp_plat_print , "7FFFFFFFFFFFFFFF\n" , LLONG_MAX );
217
+ mp_printf (& mp_plat_print , "18446744073709551615\n" , ULLONG_MAX );
218
+ #endif
219
+ mp_printf (& mp_plat_print , "%p\n" , (void * )0x789f ); // pointer
220
+ mp_printf (& mp_plat_print , "%P\n" , (void * )0x789f ); // pointer uppercase
209
221
mp_printf (& mp_plat_print , "%.2s %.3s '%4.4s' '%5.5q' '%.3q'\n" , "abc" , "abc" , "abc" , MP_QSTR_True , MP_QSTR_True ); // fixed string precision
210
222
mp_printf (& mp_plat_print , "%.*s\n" , -1 , "abc" ); // negative string precision
211
223
mp_printf (& mp_plat_print , "%b %b\n" , 0 , 1 ); // bools
@@ -216,8 +228,8 @@ static mp_obj_t extra_coverage(void) {
216
228
#endif
217
229
mp_printf (& mp_plat_print , "%d\n" , 0x80000000 ); // should print signed
218
230
mp_printf (& mp_plat_print , "%u\n" , 0x80000000 ); // should print unsigned
219
- mp_printf (& mp_plat_print , "%x\n" , 0x80000000 ); // should print unsigned
220
- mp_printf (& mp_plat_print , "%X\n" , 0x80000000 ); // should print unsigned
231
+ mp_printf (& mp_plat_print , "%x\n" , 0x8000000f ); // should print unsigned
232
+ mp_printf (& mp_plat_print , "%X\n" , 0x8000000f ); // should print unsigned
221
233
mp_printf (& mp_plat_print , "abc\n%" ); // string ends in middle of format specifier
222
234
mp_printf (& mp_plat_print , "%%\n" ); // literal % character
223
235
mp_printf (& mp_plat_print , ".%-3s.\n" , "a" ); // left adjust
@@ -505,7 +517,7 @@ static mp_obj_t extra_coverage(void) {
505
517
mp_call_function_2_protected (MP_OBJ_FROM_PTR (& mp_builtin_divmod_obj ), mp_obj_new_str_from_cstr ("abc" ), mp_obj_new_str_from_cstr ("abc" ));
506
518
507
519
// mp_obj_int_get_checked with mp_obj_int_t that has a value that is a small integer
508
- mp_printf (& mp_plat_print , "%d\n" , mp_obj_int_get_checked (mp_obj_int_new_mpz ()));
520
+ mp_printf (& mp_plat_print , "%d\n" , mp_obj_int_get_checked (MP_OBJ_FROM_PTR ( mp_obj_int_new_mpz () )));
509
521
510
522
// mp_obj_int_get_uint_checked with non-negative small-int
511
523
mp_printf (& mp_plat_print , "%d\n" , (int )mp_obj_int_get_uint_checked (MP_OBJ_NEW_SMALL_INT (1 )));
@@ -844,7 +856,7 @@ static mp_obj_t extra_coverage(void) {
844
856
mp_obj_streamtest_t * s2 = mp_obj_malloc (mp_obj_streamtest_t , & mp_type_stest_textio2 );
845
857
846
858
// return a tuple of data for testing on the Python side
847
- mp_obj_t items [] = {( mp_obj_t ) & str_no_hash_obj , ( mp_obj_t ) & bytes_no_hash_obj , MP_OBJ_FROM_PTR (s ), MP_OBJ_FROM_PTR (s2 )};
859
+ mp_obj_t items [] = {MP_OBJ_FROM_PTR ( & str_no_hash_obj ), MP_OBJ_FROM_PTR ( & bytes_no_hash_obj ) , MP_OBJ_FROM_PTR (s ), MP_OBJ_FROM_PTR (s2 )};
848
860
return mp_obj_new_tuple (MP_ARRAY_SIZE (items ), items );
849
861
}
850
862
MP_DEFINE_CONST_FUN_OBJ_0 (extra_coverage_obj , extra_coverage );
0 commit comments