Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
relibc
Commits
c4620be9
Commit
c4620be9
authored
7 years ago
by
Andrii Zymohliad
Browse files
Options
Downloads
Patches
Plain Diff
Prettify strpbrk and strstr tests
parent
1e969afd
No related branches found
No related tags found
1 merge request
!75
Implement strstr() and strpbrk() from string.h
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/string/strpbrk.c
+7
-8
7 additions, 8 deletions
tests/string/strpbrk.c
tests/string/strstr.c
+6
-6
6 additions, 6 deletions
tests/string/strstr.c
with
13 additions
and
14 deletions
tests/string/strpbrk.c
+
7
−
8
View file @
c4620be9
...
@@ -2,20 +2,19 @@
...
@@ -2,20 +2,19 @@
#include
<stdio.h>
#include
<stdio.h>
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
char
*
s
tr
=
"The quick drawn fix jumps over the lazy bug"
;
char
*
s
ource
=
"The quick drawn fix jumps over the lazy bug"
;
// should be "The quick drawn fix jumps over the lazy bug"
// should be "The quick drawn fix jumps over the lazy bug"
char
*
str
1
=
strpbrk
(
s
tr
,
"From The Very Beginning"
);
char
*
res
1
=
strpbrk
(
s
ource
,
"From The Very Beginning"
);
printf
(
"%s
\n
"
,
(
str
1
)
?
str
1
:
"NULL"
);
printf
(
"%s
\n
"
,
(
res
1
)
?
res
1
:
"NULL"
);
// should be "lazy bug"
// should be "lazy bug"
char
*
str2
=
strpbrk
(
str
,
"lzbg"
);
char
*
res2
=
strpbrk
(
source
,
"lzbg"
);
printf
(
"%s
\n
"
,
(
str2
)
?
str2
:
"NULL"
);
printf
(
"%s
\n
"
,
(
res2
)
?
res2
:
"NULL"
);
// should be "NULL"
// should be "NULL"
char
*
str
3
=
strpbrk
(
s
tr
,
"404"
);
char
*
res
3
=
strpbrk
(
s
ource
,
"404"
);
printf
(
"%s
\n
"
,
(
str
3
)
?
str
3
:
"NULL"
);
printf
(
"%s
\n
"
,
(
res
3
)
?
res
3
:
"NULL"
);
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
tests/string/strstr.c
+
6
−
6
View file @
c4620be9
...
@@ -3,16 +3,16 @@
...
@@ -3,16 +3,16 @@
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
// should be "rust"
// should be "rust"
char
*
str
1
=
strstr
(
"In relibc we trust"
,
"rust"
);
char
*
res
1
=
strstr
(
"In relibc we trust"
,
"rust"
);
printf
(
"%s
\n
"
,
(
str
1
)
?
str
1
:
"NULL"
);
printf
(
"%s
\n
"
,
(
res
1
)
?
res
1
:
"NULL"
);
// should be "libc we trust"
// should be "libc we trust"
char
*
str
2
=
strstr
(
"In relibc we trust"
,
"libc"
);
char
*
res
2
=
strstr
(
"In relibc we trust"
,
"libc"
);
printf
(
"%s
\n
"
,
(
str
2
)
?
str
2
:
"NULL"
);
printf
(
"%s
\n
"
,
(
res
2
)
?
res
2
:
"NULL"
);
// should be "NULL"
// should be "NULL"
char
*
str
3
=
strstr
(
"In relibc we trust"
,
"bugs"
);
char
*
res
3
=
strstr
(
"In relibc we trust"
,
"bugs"
);
printf
(
"%s
\n
"
,
(
str
3
)
?
str
3
:
"NULL"
);
printf
(
"%s
\n
"
,
(
res
3
)
?
res
3
:
"NULL"
);
return
0
;
return
0
;
}
}
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