Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
f601390e
Commit
f601390e
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
unix: Add some extra coverage tests for vstr and attrtuple.
parent
7bab32ef
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/unix/extra_coverage.py.exp
+10
-0
10 additions, 0 deletions
tests/unix/extra_coverage.py.exp
unix/coverage.c
+40
-0
40 additions, 0 deletions
unix/coverage.c
with
50 additions
and
0 deletions
tests/unix/extra_coverage.py.exp
+
10
−
0
View file @
f601390e
# vstr
tests
sts
test
tes
larg
# repl
ame__
ame__
__name__ path argv version
__name__ path argv version
...
@@ -5,3 +13,5 @@ version_info implementation platform byteorder
...
@@ -5,3 +13,5 @@ version_info implementation platform byteorder
maxsize exit stdin stdout
maxsize exit stdin stdout
stderr exc_info print_exception
stderr exc_info print_exception
ementation
ementation
# attrtuple
(start=1, stop=2, step=3)
This diff is collapsed.
Click to expand it.
unix/coverage.c
+
40
−
0
View file @
f601390e
...
@@ -8,8 +8,38 @@
...
@@ -8,8 +8,38 @@
// function to run extra tests for things that can't be checked by scripts
// function to run extra tests for things that can't be checked by scripts
STATIC
mp_obj_t
extra_coverage
(
void
)
{
STATIC
mp_obj_t
extra_coverage
(
void
)
{
// vstr
{
printf
(
"# vstr
\n
"
);
vstr_t
*
vstr
=
vstr_new_size
(
16
);
vstr_hint_size
(
vstr
,
32
);
vstr_add_str
(
vstr
,
"ts"
);
vstr_ins_byte
(
vstr
,
1
,
'e'
);
vstr_ins_char
(
vstr
,
3
,
't'
);
vstr_ins_char
(
vstr
,
10
,
's'
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
vstr_cut_head_bytes
(
vstr
,
2
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
vstr_cut_tail_bytes
(
vstr
,
10
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
vstr_printf
(
vstr
,
"t%cst"
,
'e'
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
vstr_cut_out_bytes
(
vstr
,
3
,
10
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
VSTR_FIXED
(
fix
,
4
);
vstr_add_str
(
&
fix
,
"large"
);
printf
(
"%.*s
\n
"
,
(
int
)
fix
.
len
,
fix
.
buf
);
}
// repl autocomplete
// repl autocomplete
{
{
printf
(
"# repl
\n
"
);
const
char
*
str
;
const
char
*
str
;
mp_uint_t
len
=
mp_repl_autocomplete
(
"__n"
,
3
,
&
mp_plat_print
,
&
str
);
mp_uint_t
len
=
mp_repl_autocomplete
(
"__n"
,
3
,
&
mp_plat_print
,
&
str
);
printf
(
"%.*s
\n
"
,
(
int
)
len
,
str
);
printf
(
"%.*s
\n
"
,
(
int
)
len
,
str
);
...
@@ -20,6 +50,16 @@ STATIC mp_obj_t extra_coverage(void) {
...
@@ -20,6 +50,16 @@ STATIC mp_obj_t extra_coverage(void) {
printf
(
"%.*s
\n
"
,
(
int
)
len
,
str
);
printf
(
"%.*s
\n
"
,
(
int
)
len
,
str
);
}
}
// attrtuple
{
printf
(
"# attrtuple
\n
"
);
static
const
qstr
fields
[]
=
{
MP_QSTR_start
,
MP_QSTR_stop
,
MP_QSTR_step
};
static
const
mp_obj_t
items
[]
=
{
MP_OBJ_NEW_SMALL_INT
(
1
),
MP_OBJ_NEW_SMALL_INT
(
2
),
MP_OBJ_NEW_SMALL_INT
(
3
)};
mp_obj_print_helper
(
&
mp_plat_print
,
mp_obj_new_attrtuple
(
fields
,
3
,
items
),
PRINT_REPR
);
printf
(
"
\n
"
);
}
return
mp_const_none
;
return
mp_const_none
;
}
}
MP_DEFINE_CONST_FUN_OBJ_0
(
extra_coverage_obj
,
extra_coverage
);
MP_DEFINE_CONST_FUN_OBJ_0
(
extra_coverage_obj
,
extra_coverage
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment