mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-09-25 02:38:33 +00:00
Add strlist_contains()
Add a function to know if a string list, using some separator, contains a specific string.
This commit is contained in:
parent
243854a408
commit
ffc00210e9
3 changed files with 36 additions and 0 deletions
|
@ -287,6 +287,18 @@ static void test_parse_integer_with_suffix(void) {
|
|||
assert(!ok);
|
||||
}
|
||||
|
||||
static void test_strlist_contains(void) {
|
||||
assert(strlist_contains("a,bc,def", ',', "bc"));
|
||||
assert(!strlist_contains("a,bc,def", ',', "b"));
|
||||
assert(strlist_contains("", ',', ""));
|
||||
assert(strlist_contains("abc,", ',', ""));
|
||||
assert(strlist_contains(",abc", ',', ""));
|
||||
assert(strlist_contains("abc,,def", ',', ""));
|
||||
assert(!strlist_contains("abc", ',', ""));
|
||||
assert(strlist_contains(",,|x", '|', ",,"));
|
||||
assert(strlist_contains("xyz", '\0', "xyz"));
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
@ -304,5 +316,6 @@ int main(int argc, char *argv[]) {
|
|||
test_parse_integer();
|
||||
test_parse_integers();
|
||||
test_parse_integer_with_suffix();
|
||||
test_strlist_contains();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue