mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-19 08:57:14 -05:00
treewide: replace !strcmp() with spa_streq()
This change is only done in source files for now, header files will be done separately.
This commit is contained in:
parent
7697ed0757
commit
95a84e797a
28 changed files with 239 additions and 221 deletions
|
|
@ -22,6 +22,7 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/support/dbus.h>
|
||||
#include <spa/support/cpu.h>
|
||||
|
||||
|
|
@ -181,8 +182,8 @@ static void test_properties(void)
|
|||
|
||||
props = pw_context_get_properties(context);
|
||||
spa_assert(props != NULL);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "biz"), "fuzz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "biz"), "fuzz"));
|
||||
spa_assert(pw_properties_get(props, "buzz") == NULL);
|
||||
|
||||
/* remove foo */
|
||||
|
|
@ -195,8 +196,8 @@ static void test_properties(void)
|
|||
|
||||
spa_assert(props == pw_context_get_properties(context));
|
||||
spa_assert(pw_properties_get(props, "foo") == NULL);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "biz"), "buzz"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "buzz"), "frizz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "biz"), "buzz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "buzz"), "frizz"));
|
||||
|
||||
spa_hook_remove(&listener);
|
||||
pw_context_destroy(context);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <pipewire/pipewire.h>
|
||||
#include <extensions/session-manager.h>
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/pod/builder.h>
|
||||
#include <spa/pod/parser.h>
|
||||
#include <spa/pod/filter.h>
|
||||
|
|
@ -274,8 +275,8 @@ endpoint_event_info(void *object, const struct pw_endpoint_info *info)
|
|||
spa_assert(info->id == pw_proxy_get_bound_id(d->bound_proxy));
|
||||
spa_assert(info->id == pw_proxy_get_bound_id(d->export_proxy));
|
||||
spa_assert(info->change_mask == PW_ENDPOINT_CHANGE_MASK_ALL);
|
||||
spa_assert(!strcmp(info->name, "test-endpoint"));
|
||||
spa_assert(!strcmp(info->media_class, "Audio/Sink"));
|
||||
spa_assert(spa_streq(info->name, "test-endpoint"));
|
||||
spa_assert(spa_streq(info->media_class, "Audio/Sink"));
|
||||
spa_assert(info->direction == PW_DIRECTION_OUTPUT);
|
||||
spa_assert(info->n_streams == 0);
|
||||
spa_assert(info->session_id == SPA_ID_INVALID);
|
||||
|
|
@ -287,9 +288,9 @@ endpoint_event_info(void *object, const struct pw_endpoint_info *info)
|
|||
spa_assert(info->params[1].flags == param_info[1].flags);
|
||||
spa_assert(info->props != NULL);
|
||||
val = spa_dict_lookup(info->props, PW_KEY_ENDPOINT_NAME);
|
||||
spa_assert(val && !strcmp(val, "test-endpoint"));
|
||||
spa_assert(val && spa_streq(val, "test-endpoint"));
|
||||
val = spa_dict_lookup(info->props, PW_KEY_MEDIA_CLASS);
|
||||
spa_assert(val && !strcmp(val, "Audio/Sink"));
|
||||
spa_assert(val && spa_streq(val, "Audio/Sink"));
|
||||
|
||||
d->info_received = true;
|
||||
pw_main_loop_quit(d->loop);
|
||||
|
|
@ -352,9 +353,9 @@ test_endpoint_global(void *object, uint32_t id,
|
|||
|
||||
spa_assert(props != NULL);
|
||||
val = spa_dict_lookup(props, PW_KEY_ENDPOINT_NAME);
|
||||
spa_assert(val && !strcmp(val, "test-endpoint"));
|
||||
spa_assert(val && spa_streq(val, "test-endpoint"));
|
||||
val = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS);
|
||||
spa_assert(val && !strcmp(val, "Audio/Sink"));
|
||||
spa_assert(val && spa_streq(val, "Audio/Sink"));
|
||||
|
||||
pw_endpoint_add_listener(d->bound_proxy, &d->object_listener,
|
||||
&endpoint_events, d);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include <pipewire/properties.h>
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
static void test_abi(void)
|
||||
{
|
||||
#if defined(__x86_64__) && defined(__LP64__)
|
||||
|
|
@ -79,19 +81,19 @@ static void test_set(void)
|
|||
|
||||
spa_assert(pw_properties_set(props, "foo", "bar") == 1);
|
||||
spa_assert(props->dict.n_items == 1);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(pw_properties_set(props, "foo", "bar") == 0);
|
||||
spa_assert(props->dict.n_items == 1);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(pw_properties_set(props, "foo", "fuz") == 1);
|
||||
spa_assert(props->dict.n_items == 1);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "fuz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "fuz"));
|
||||
spa_assert(pw_properties_set(props, "bar", "foo") == 1);
|
||||
spa_assert(props->dict.n_items == 2);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "foo"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "foo"));
|
||||
spa_assert(pw_properties_set(props, "him", "too") == 1);
|
||||
spa_assert(props->dict.n_items == 3);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(pw_properties_set(props, "him", NULL) == 1);
|
||||
spa_assert(props->dict.n_items == 2);
|
||||
spa_assert(pw_properties_get(props, "him") == NULL);
|
||||
|
|
@ -103,9 +105,9 @@ static void test_set(void)
|
|||
spa_assert(pw_properties_set(props, NULL, "invalid") == 0);
|
||||
|
||||
str = pw_properties_iterate(props, &state);
|
||||
spa_assert(str != NULL && (!strcmp(str, "foo") || !strcmp(str, "bar")));
|
||||
spa_assert(str != NULL && (spa_streq(str, "foo") || spa_streq(str, "bar")));
|
||||
str = pw_properties_iterate(props, &state);
|
||||
spa_assert(str != NULL && (!strcmp(str, "foo") || !strcmp(str, "bar")));
|
||||
spa_assert(str != NULL && (spa_streq(str, "foo") || spa_streq(str, "bar")));
|
||||
str = pw_properties_iterate(props, &state);
|
||||
spa_assert(str == NULL);
|
||||
|
||||
|
|
@ -119,9 +121,9 @@ static void test_set(void)
|
|||
spa_assert(pw_properties_set(props, "him", "too") == 1);
|
||||
spa_assert(props->dict.n_items == 3);
|
||||
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "foo"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "foo"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "too"));
|
||||
|
||||
pw_properties_clear(props);
|
||||
spa_assert(props->dict.n_items == 0);
|
||||
|
|
@ -134,19 +136,19 @@ static void test_set(void)
|
|||
copy = pw_properties_copy(props);
|
||||
spa_assert(copy != NULL);
|
||||
spa_assert(copy->dict.n_items == 3);
|
||||
spa_assert(!strcmp(pw_properties_get(copy, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(copy, "bar"), "foo"));
|
||||
spa_assert(!strcmp(pw_properties_get(copy, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(copy, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(copy, "bar"), "foo"));
|
||||
spa_assert(spa_streq(pw_properties_get(copy, "him"), "too"));
|
||||
|
||||
spa_assert(pw_properties_set(copy, "bar", NULL) == 1);
|
||||
spa_assert(pw_properties_set(copy, "foo", NULL) == 1);
|
||||
spa_assert(copy->dict.n_items == 1);
|
||||
spa_assert(!strcmp(pw_properties_get(copy, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(copy, "him"), "too"));
|
||||
|
||||
spa_assert(props->dict.n_items == 3);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "foo"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "foo"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "too"));
|
||||
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(copy);
|
||||
|
|
@ -159,7 +161,7 @@ static void test_setf(void)
|
|||
props = pw_properties_new(NULL, NULL);
|
||||
spa_assert(pw_properties_setf(props, "foo", "%d.%08x", 657, 0x89342) == 1);
|
||||
spa_assert(props->dict.n_items == 1);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "657.00089342"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "657.00089342"));
|
||||
|
||||
spa_assert(pw_properties_setf(props, "", "%f", 189.45f) == 0);
|
||||
spa_assert(pw_properties_setf(props, NULL, "%f", 189.45f) == 0);
|
||||
|
|
@ -177,9 +179,9 @@ static void test_new(void)
|
|||
spa_assert(props->flags == 0);
|
||||
spa_assert(props->dict.n_items == 3);
|
||||
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "too"));
|
||||
|
||||
pw_properties_free(props);
|
||||
}
|
||||
|
|
@ -200,9 +202,9 @@ static void test_new_dict(void)
|
|||
spa_assert(props->flags == 0);
|
||||
spa_assert(props->dict.n_items == 3);
|
||||
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "too"));
|
||||
|
||||
pw_properties_free(props);
|
||||
}
|
||||
|
|
@ -216,10 +218,10 @@ static void test_new_string(void)
|
|||
spa_assert(props->flags == 0);
|
||||
spa_assert(props->dict.n_items == 4);
|
||||
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "empty"), ""));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "empty"), ""));
|
||||
|
||||
pw_properties_free(props);
|
||||
|
||||
|
|
@ -228,8 +230,8 @@ static void test_new_string(void)
|
|||
spa_assert(props->flags == 0);
|
||||
spa_assert(props->dict.n_items == 2);
|
||||
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "baz"));
|
||||
|
||||
pw_properties_free(props);
|
||||
|
||||
|
|
@ -238,8 +240,8 @@ static void test_new_string(void)
|
|||
spa_assert(props->flags == 0);
|
||||
spa_assert(props->dict.n_items == 2);
|
||||
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "baz"));
|
||||
|
||||
pw_properties_free(props);
|
||||
}
|
||||
|
|
@ -262,32 +264,32 @@ static void test_update(void)
|
|||
spa_assert(pw_properties_update(props, &SPA_DICT_INIT_ARRAY(items)) == 3);
|
||||
spa_assert(props->dict.n_items == 3);
|
||||
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "too"));
|
||||
|
||||
items[0] = SPA_DICT_ITEM_INIT("foo", "bar");
|
||||
items[1] = SPA_DICT_ITEM_INIT("bar", "baz");
|
||||
spa_assert(pw_properties_update(props, &SPA_DICT_INIT(items, 2)) == 0);
|
||||
spa_assert(props->dict.n_items == 3);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "baz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "too"));
|
||||
|
||||
items[0] = SPA_DICT_ITEM_INIT("bar", "bear");
|
||||
items[1] = SPA_DICT_ITEM_INIT("him", "too");
|
||||
spa_assert(pw_properties_update(props, &SPA_DICT_INIT(items, 2)) == 1);
|
||||
spa_assert(props->dict.n_items == 3);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "bear"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "too"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "bear"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "too"));
|
||||
|
||||
items[0] = SPA_DICT_ITEM_INIT("bar", "bear");
|
||||
items[1] = SPA_DICT_ITEM_INIT("him", NULL);
|
||||
spa_assert(pw_properties_update(props, &SPA_DICT_INIT(items, 2)) == 1);
|
||||
spa_assert(props->dict.n_items == 2);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "bear"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "bear"));
|
||||
spa_assert(pw_properties_get(props, "him") == NULL);
|
||||
|
||||
items[0] = SPA_DICT_ITEM_INIT("foo", NULL);
|
||||
|
|
@ -296,8 +298,8 @@ static void test_update(void)
|
|||
spa_assert(pw_properties_update(props, &SPA_DICT_INIT(items, 3)) == 3);
|
||||
spa_assert(props->dict.n_items == 2);
|
||||
spa_assert(pw_properties_get(props, "foo") == NULL);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "beer"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "him"), "her"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "beer"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "him"), "her"));
|
||||
|
||||
pw_properties_free(props);
|
||||
}
|
||||
|
|
@ -339,10 +341,10 @@ static void test_new_json(void)
|
|||
spa_assert(props->flags == 0);
|
||||
spa_assert(props->dict.n_items == 3);
|
||||
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar\n\t"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "bar"), "1.8"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar\n\t"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "bar"), "1.8"));
|
||||
fprintf(stderr, "'%s'\n", pw_properties_get(props, "empty"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "empty"), "[ \"foo\", \"bar\" ]"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "empty"), "[ \"foo\", \"bar\" ]"));
|
||||
|
||||
pw_properties_free(props);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include <pipewire/main-loop.h>
|
||||
#include <pipewire/stream.h>
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
#define TEST_FUNC(a,b,func) \
|
||||
do { \
|
||||
a.func = b.func; \
|
||||
|
|
@ -159,7 +161,7 @@ static void test_create(void)
|
|||
spa_assert(pw_stream_get_state(stream, &error) == PW_STREAM_STATE_UNCONNECTED);
|
||||
spa_assert(error == NULL);
|
||||
/* check name */
|
||||
spa_assert(!strcmp(pw_stream_get_name(stream), "test"));
|
||||
spa_assert(spa_streq(pw_stream_get_name(stream), "test"));
|
||||
|
||||
/* check id, only when connected */
|
||||
spa_assert(pw_stream_get_node_id(stream) == SPA_ID_INVALID);
|
||||
|
|
@ -209,8 +211,8 @@ static void test_properties(void)
|
|||
|
||||
props = pw_stream_get_properties(stream);
|
||||
spa_assert(props != NULL);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "biz"), "fuzz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "biz"), "fuzz"));
|
||||
spa_assert(pw_properties_get(props, "buzz") == NULL);
|
||||
|
||||
/* remove foo */
|
||||
|
|
@ -223,8 +225,8 @@ static void test_properties(void)
|
|||
|
||||
spa_assert(props == pw_stream_get_properties(stream));
|
||||
spa_assert(pw_properties_get(props, "foo") == NULL);
|
||||
spa_assert(!strcmp(pw_properties_get(props, "biz"), "buzz"));
|
||||
spa_assert(!strcmp(pw_properties_get(props, "buzz"), "frizz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "biz"), "buzz"));
|
||||
spa_assert(spa_streq(pw_properties_get(props, "buzz"), "frizz"));
|
||||
|
||||
/* check destroy */
|
||||
destroy_count = 0;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <pipewire/utils.h>
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
static void test_destroy(void *object)
|
||||
{
|
||||
spa_assert_not_reached();
|
||||
|
|
@ -59,17 +61,17 @@ static void test_split(void)
|
|||
res = pw_split_strv(test1, del, INT_MAX, &n_tokens);
|
||||
spa_assert(res != NULL);
|
||||
spa_assert(n_tokens == 3);
|
||||
spa_assert(!strcmp(res[0], "a"));
|
||||
spa_assert(!strcmp(res[1], "test"));
|
||||
spa_assert(!strcmp(res[2], "string"));
|
||||
spa_assert(spa_streq(res[0], "a"));
|
||||
spa_assert(spa_streq(res[1], "test"));
|
||||
spa_assert(spa_streq(res[2], "string"));
|
||||
spa_assert(res[3] == NULL);
|
||||
pw_free_strv(res);
|
||||
|
||||
res = pw_split_strv(test1, del, 2, &n_tokens);
|
||||
spa_assert(res != NULL);
|
||||
spa_assert(n_tokens == 2);
|
||||
spa_assert(!strcmp(res[0], "a"));
|
||||
spa_assert(!strcmp(res[1], "test string \n \r "));
|
||||
spa_assert(spa_streq(res[0], "a"));
|
||||
spa_assert(spa_streq(res[1], "test string \n \r "));
|
||||
spa_assert(res[2] == NULL);
|
||||
pw_free_strv(res);
|
||||
}
|
||||
|
|
@ -79,9 +81,9 @@ static void test_strip(void)
|
|||
char test1[] = " \n\r \n a test string \n \r ";
|
||||
char test2[] = " \n\r \n \n \r ";
|
||||
char test3[] = "a test string";
|
||||
spa_assert(!strcmp(pw_strip(test1, "\n\r "), "a test string"));
|
||||
spa_assert(!strcmp(pw_strip(test2, "\n\r "), ""));
|
||||
spa_assert(!strcmp(pw_strip(test3, "\n\r "), "a test string"));
|
||||
spa_assert(spa_streq(pw_strip(test1, "\n\r "), "a test string"));
|
||||
spa_assert(spa_streq(pw_strip(test2, "\n\r "), ""));
|
||||
spa_assert(spa_streq(pw_strip(test3, "\n\r "), "a test string"));
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue