mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
test: add test for an array with odd number of items
We have to use the relax version to get the expected container type correct.
This commit is contained in:
parent
94d0d8bc09
commit
23c449af5d
1 changed files with 2 additions and 1 deletions
|
|
@ -609,7 +609,7 @@ static void test_array(const char *str, const char * const vals[])
|
|||
|
||||
spa_json_init(&it[0], str, strlen(str));
|
||||
if (spa_json_enter_array(&it[0], &it[1]) <= 0)
|
||||
spa_json_init(&it[1], str, strlen(str));
|
||||
spa_json_init_relax(&it[1], '[', str, strlen(str));
|
||||
for (i = 0; vals[i]; i++) {
|
||||
pwtest_int_gt(spa_json_get_string(&it[1], val, sizeof(val)), 0);
|
||||
pwtest_str_eq(val, vals[i]);
|
||||
|
|
@ -624,6 +624,7 @@ PWTEST(json_array)
|
|||
test_array("[FL FR]", (const char *[]){ "FL", "FR", NULL });
|
||||
test_array("FL FR", (const char *[]){ "FL", "FR", NULL });
|
||||
test_array("[ FL FR ]", (const char *[]){ "FL", "FR", NULL });
|
||||
test_array("FL FR FC", (const char *[]){ "FL", "FR", "FC", NULL });
|
||||
|
||||
return PWTEST_PASS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue