diff --git a/libguac/tests/protocol/instruction_read.c b/libguac/tests/protocol/instruction_read.c index 19d75ffd..a763ad21 100644 --- a/libguac/tests/protocol/instruction_read.c +++ b/libguac/tests/protocol/instruction_read.c @@ -51,8 +51,8 @@ void test_instruction_read() { int rfd, wfd; int fd[2], childpid; - char test_string[] = "4.test,3.a" UTF8_DOG "b," - "5.12345,4.a" UTF8_DOG UTF8_DOG "c;" + char test_string[] = "4.test,6.a" UTF8_4 "b," + "5.12345,10.a" UTF8_8 "c;" "5.test2,10.hellohello,15.worldworldworld;"; /* Create pipe */ @@ -95,9 +95,9 @@ void test_instruction_read() { /* Validate contents */ CU_ASSERT_STRING_EQUAL(instruction->opcode, "test"); CU_ASSERT_EQUAL_FATAL(instruction->argc, 3); - CU_ASSERT_STRING_EQUAL(instruction->argv[0], "a" UTF8_DOG "b"); + CU_ASSERT_STRING_EQUAL(instruction->argv[0], "a" UTF8_4 "b"); CU_ASSERT_STRING_EQUAL(instruction->argv[1], "12345"); - CU_ASSERT_STRING_EQUAL(instruction->argv[2], "a" UTF8_DOG UTF8_DOG "c"); + CU_ASSERT_STRING_EQUAL(instruction->argv[2], "a" UTF8_8 "c"); /* Read another instruction */ guac_instruction_free(instruction); diff --git a/libguac/tests/protocol/instruction_write.c b/libguac/tests/protocol/instruction_write.c index 3331226f..1e003942 100644 --- a/libguac/tests/protocol/instruction_write.c +++ b/libguac/tests/protocol/instruction_write.c @@ -76,7 +76,7 @@ void test_instruction_write() { socket = guac_socket_open(wfd); /* Write instruction */ - guac_protocol_send_clipboard(socket, "a" UTF8_DOG "b" UTF8_DOG "c"); + guac_protocol_send_clipboard(socket, "a" UTF8_4 "b" UTF8_4 "c"); guac_protocol_send_sync(socket, 12345); guac_socket_flush(socket); @@ -88,7 +88,7 @@ void test_instruction_write() { else { char expected[] = - "9.clipboard,5.a" UTF8_DOG "b" UTF8_DOG "c;" + "9.clipboard,11.a" UTF8_4 "b" UTF8_4 "c;" "4.sync,5.12345;"; int numread; diff --git a/libguac/tests/protocol/suite.h b/libguac/tests/protocol/suite.h index b551e3a5..7e8b5b8c 100644 --- a/libguac/tests/protocol/suite.h +++ b/libguac/tests/protocol/suite.h @@ -38,7 +38,13 @@ #ifndef _GUAC_TEST_PROTOCOL_SUITE_H #define _GUAC_TEST_PROTOCOL_SUITE_H -#define UTF8_DOG "\xe7\x8a\xac" +/* Unicode (UTF-8) strings */ + +#define UTF8_1 "\xe7\x8a\xac" /* One character */ +#define UTF8_2 UTF8_1 "\xf0\x90\xac\x80" /* Two characters */ +#define UTF8_3 UTF8_2 "z" /* Three characters */ +#define UTF8_4 UTF8_3 "\xc3\xa1" /* Four characters */ +#define UTF8_8 UTF8_4 UTF8_4 /* Eight characters */ int register_protocol_suite();