Define better set of UTF8 test strings, use instead of dog.

This commit is contained in:
Michael Jumper 2012-07-23 15:50:58 -07:00
parent f8eb590ea3
commit a46e4f40ed
3 changed files with 13 additions and 7 deletions

View File

@ -51,8 +51,8 @@ void test_instruction_read() {
int rfd, wfd; int rfd, wfd;
int fd[2], childpid; int fd[2], childpid;
char test_string[] = "4.test,3.a" UTF8_DOG "b," char test_string[] = "4.test,6.a" UTF8_4 "b,"
"5.12345,4.a" UTF8_DOG UTF8_DOG "c;" "5.12345,10.a" UTF8_8 "c;"
"5.test2,10.hellohello,15.worldworldworld;"; "5.test2,10.hellohello,15.worldworldworld;";
/* Create pipe */ /* Create pipe */
@ -95,9 +95,9 @@ void test_instruction_read() {
/* Validate contents */ /* Validate contents */
CU_ASSERT_STRING_EQUAL(instruction->opcode, "test"); CU_ASSERT_STRING_EQUAL(instruction->opcode, "test");
CU_ASSERT_EQUAL_FATAL(instruction->argc, 3); 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[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 */ /* Read another instruction */
guac_instruction_free(instruction); guac_instruction_free(instruction);

View File

@ -76,7 +76,7 @@ void test_instruction_write() {
socket = guac_socket_open(wfd); socket = guac_socket_open(wfd);
/* Write instruction */ /* 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_protocol_send_sync(socket, 12345);
guac_socket_flush(socket); guac_socket_flush(socket);
@ -88,7 +88,7 @@ void test_instruction_write() {
else { else {
char expected[] = 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;"; "4.sync,5.12345;";
int numread; int numread;

View File

@ -38,7 +38,13 @@
#ifndef _GUAC_TEST_PROTOCOL_SUITE_H #ifndef _GUAC_TEST_PROTOCOL_SUITE_H
#define _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(); int register_protocol_suite();