88
99// function to run extra tests for things that can't be checked by scripts
1010STATIC mp_obj_t extra_coverage (void ) {
11+ // vstr
12+ {
13+ printf ("# vstr\n" );
14+ vstr_t * vstr = vstr_new_size (16 );
15+ vstr_hint_size (vstr , 32 );
16+ vstr_add_str (vstr , "ts" );
17+ vstr_ins_byte (vstr , 1 , 'e' );
18+ vstr_ins_char (vstr , 3 , 't' );
19+ vstr_ins_char (vstr , 10 , 's' );
20+ printf ("%.*s\n" , (int )vstr -> len , vstr -> buf );
21+
22+ vstr_cut_head_bytes (vstr , 2 );
23+ printf ("%.*s\n" , (int )vstr -> len , vstr -> buf );
24+
25+ vstr_cut_tail_bytes (vstr , 10 );
26+ printf ("%.*s\n" , (int )vstr -> len , vstr -> buf );
27+
28+ vstr_printf (vstr , "t%cst" , 'e' );
29+ printf ("%.*s\n" , (int )vstr -> len , vstr -> buf );
30+
31+ vstr_cut_out_bytes (vstr , 3 , 10 );
32+ printf ("%.*s\n" , (int )vstr -> len , vstr -> buf );
33+
34+ VSTR_FIXED (fix , 4 );
35+ vstr_add_str (& fix , "large" );
36+ printf ("%.*s\n" , (int )fix .len , fix .buf );
37+ }
38+
1139 // repl autocomplete
1240 {
41+ printf ("# repl\n" );
42+
1343 const char * str ;
1444 mp_uint_t len = mp_repl_autocomplete ("__n" , 3 , & mp_plat_print , & str );
1545 printf ("%.*s\n" , (int )len , str );
@@ -20,6 +50,16 @@ STATIC mp_obj_t extra_coverage(void) {
2050 printf ("%.*s\n" , (int )len , str );
2151 }
2252
53+ // attrtuple
54+ {
55+ printf ("# attrtuple\n" );
56+
57+ static const qstr fields [] = {MP_QSTR_start , MP_QSTR_stop , MP_QSTR_step };
58+ static const mp_obj_t items [] = {MP_OBJ_NEW_SMALL_INT (1 ), MP_OBJ_NEW_SMALL_INT (2 ), MP_OBJ_NEW_SMALL_INT (3 )};
59+ mp_obj_print_helper (& mp_plat_print , mp_obj_new_attrtuple (fields , 3 , items ), PRINT_REPR );
60+ printf ("\n" );
61+ }
62+
2363 return mp_const_none ;
2464}
2565MP_DEFINE_CONST_FUN_OBJ_0 (extra_coverage_obj , extra_coverage );
0 commit comments