Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
94
Issues
94
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
f58f11f2
Commit
f58f11f2
authored
Aug 17, 2018
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature: Test buffer_set_length()
parent
99671cdb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
src/tests/ctest_buffer.c
src/tests/ctest_buffer.c
+26
-0
No files found.
src/tests/ctest_buffer.c
View file @
f58f11f2
...
...
@@ -256,6 +256,31 @@ static void test_shift(void)
ctest_test
(
"un-referenced"
,
refobject_unref
(
a
)
==
0
);
}
static
void
test_length
(
void
)
{
buffer_t
*
a
;
const
char
*
pattern
=
"AABBBCC"
;
const
char
*
match_a
=
"AABBB"
;
const
char
*
match_b
=
"AABB"
;
const
char
*
match_c
=
""
;
a
=
buffer_new_simple
();
ctest_test
(
"buffer created"
,
a
!=
NULL
);
ctest_test
(
"pushed string"
,
buffer_push_string
(
a
,
pattern
)
==
0
);
test__compare_to_string
(
a
,
"string matches input"
,
pattern
);
ctest_test
(
"Set length to match pattern a"
,
buffer_set_length
(
a
,
strlen
(
match_a
))
==
0
);
test__compare_to_string
(
a
,
"string matches pattern a"
,
match_a
);
ctest_test
(
"Set length to match pattern b"
,
buffer_set_length
(
a
,
strlen
(
match_b
))
==
0
);
test__compare_to_string
(
a
,
"string matches pattern a"
,
match_b
);
ctest_test
(
"Set length to match pattern c"
,
buffer_set_length
(
a
,
strlen
(
match_c
))
==
0
);
test__compare_to_string
(
a
,
"string matches pattern a"
,
match_c
);
ctest_test
(
"Set length to match pattern a (again)"
,
buffer_set_length
(
a
,
strlen
(
match_a
))
!=
0
);
test__compare_to_string
(
a
,
"string still matches pattern c"
,
match_c
);
ctest_test
(
"un-referenced"
,
refobject_unref
(
a
)
==
0
);
}
int
main
(
void
)
{
ctest_init
();
...
...
@@ -272,6 +297,7 @@ int main (void)
test_binary
();
test_shift
();
test_length
();
ctest_fin
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment