From 54e03c12af22745bbcc00ea0ebc4b2b2179d3388 Mon Sep 17 00:00:00 2001 From: Thomas Brand Date: Sun, 27 Jan 2019 06:22:18 +0100 Subject: [PATCH] add another testcase for client name --- tests/test.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/test.cpp b/tests/test.cpp index d01f5a84..cf02e209 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -750,8 +750,8 @@ int main (int argc, char *argv[]) char client_name3[jack_client_name_size()]; // "jack_client_name_size" - 1 effective characters memset(client_name3, 'A', sizeof(client_name3)); - // set last expected printable to 'X' - client_name3[jack_client_name_size()-2] = 'X'; + // set last expected printable to '4' + client_name3[jack_client_name_size()-2] = '4'; // And last one is the terminating '0' client_name3[jack_client_name_size()-1] = 0; Log("trying to register a new jackd client with maximum possible client name size...\n", client_name3); @@ -763,6 +763,27 @@ int main (int argc, char *argv[]) printf("!!! ERROR !!! opening a client with maximum possible client name size does not work!\n"); } + // test with one less: + // set last expected printable to '3' + client_name3[jack_client_name_size()-3] = '3'; + // And (second) last one is the terminating '0' + client_name3[jack_client_name_size()-2] = 0; + Log("trying to register a new jackd client with maximum possible client name size -1...\n", client_name3); + client2 = jack_client_open(client_name3, jack_options, &status, server_name); + if (client2 != NULL) { + Log ("valid : a client with maximum possible client name size -1 can be opened\n"); + Log("Testing long name..."); + client_name2 = jack_get_client_name(client2); + if (strcmp(client_name2, client_name3) == 0) { + Log(" ok\n"); + } else { + printf("\n!!! ERROR !!! name returned different from the one given : %s\n", client_name2); + } + jack_client_close(client2); + } else { + printf("!!! ERROR !!! opening a client with maximum possible client name size -1 does not work!\n"); + } + /** * testing client name... * Verify that the name sended at registration and the one returned by jack server is the same...