Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADDED] kvStore_WatchMulti, js_Subscribe[Sync]Multi #750

Merged
merged 18 commits into from May 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 16 additions & 12 deletions test/test.c
Expand Up @@ -5470,25 +5470,29 @@ static void
test_natsFormatStringArray(void)
{
natsStatus s;
char *str = NULL;
char *array[4];
memset(array, 0, sizeof(array));

test("Check empty: ");
s = nats_formatStringArray(&str, NULL, 0);
testCond((s == NATS_OK) && (str != NULL) && (strcmp(str, "[]") == 0));
NATS_FREE(str);
str = NULL;
s = nats_formatStringArray(&array[0], NULL, 0);
testCond((s == NATS_OK) && (array[0] != NULL) && (strcmp(array[0], "[]") == 0));

test("Check one: ");
levb marked this conversation as resolved.
Show resolved Hide resolved
const char *oneArray[] = {"one"};
s = nats_formatStringArray(&str, oneArray, 1);
testCond((s == NATS_OK) && (str != NULL) && (strcmp(str, "[\"one\"]") == 0));
NATS_FREE(str);
s = nats_formatStringArray(&array[1], oneArray, 1);
testCond((s == NATS_OK) && (array[1] != NULL) && (strcmp(array[1], "[\"one\"]") == 0));

test("Check multiple: ");
const char *threeArray[] = {"one","two","three"};
s = nats_formatStringArray(&str, threeArray, 3);
testCond((s == NATS_OK) && (str != NULL) && (strcmp(str, "[\"one\",\"two\",\"three\"]") == 0));
NATS_FREE(str);
const char *threeArray[] = {"one", "two", "three"};
levb marked this conversation as resolved.
Show resolved Hide resolved
s = nats_formatStringArray(&array[2], threeArray, 3);
testCond((s == NATS_OK) && (array[2] != NULL) && (strcmp(array[2], "[\"one\",\"two\",\"three\"]") == 0));

test("Check NULL: ");
const char *nullArray[] = {NULL};
s = nats_formatStringArray(&array[3], nullArray, 1);
testCond((s == NATS_OK) && (array[3] != NULL) && (strcmp(array[3], "[\"(null)\"]") == 0));

NATS_FREE_STRINGS(array, 3);
levb marked this conversation as resolved.
Show resolved Hide resolved
}

static natsStatus
Expand Down