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
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
a16715ac
Commit
a16715ac
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
tests: Add special tests to test mp_printf function to improve coverage.
parent
9ede4dcf
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
+15
-0
15 additions, 0 deletions
unix/coverage.c
with
25 additions
and
0 deletions
tests/unix/extra_coverage.py.exp
+
10
−
0
View file @
a16715ac
# mp_printf
-123 +123 123
-0123
123
1ABCDEF
ab abc
false true
(null)
t
# vstr
# vstr
tests
tests
sts
sts
...
...
This diff is collapsed.
Click to expand it.
unix/coverage.c
+
15
−
0
View file @
a16715ac
...
@@ -8,6 +8,21 @@
...
@@ -8,6 +8,21 @@
// 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
)
{
// mp_printf (used by ports that don't have a native printf)
{
printf
(
"# mp_printf
\n
"
);
mp_printf
(
&
mp_plat_print
,
"%"
);
// nothing after percent
mp_printf
(
&
mp_plat_print
,
"%d %+d % d
\n
"
,
-
123
,
123
,
123
);
// sign
mp_printf
(
&
mp_plat_print
,
"%05d
\n
"
,
-
123
);
// negative number with zero padding
mp_printf
(
&
mp_plat_print
,
"%ld
\n
"
,
123
);
// long
mp_printf
(
&
mp_plat_print
,
"%X
\n
"
,
0x1abcdef
);
// capital hex
mp_printf
(
&
mp_plat_print
,
"%.2s %.3s
\n
"
,
"abc"
,
"abc"
);
// fixed string precision
mp_printf
(
&
mp_plat_print
,
"%.*s
\n
"
,
-
1
,
"abc"
);
// negative string precision
mp_printf
(
&
mp_plat_print
,
"%b %b
\n
"
,
0
,
1
);
// bools
mp_printf
(
&
mp_plat_print
,
"%s
\n
"
,
NULL
);
// null string
mp_printf
(
&
mp_plat_print
,
"%t
\n
"
);
// non-format char
}
// vstr
// vstr
{
{
printf
(
"# vstr
\n
"
);
printf
(
"# vstr
\n
"
);
...
...
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