44#include < unistd.h>
55#include < inttypes.h>
66
7+ #include < sstream>
8+ #include < string>
9+
710#include " io.h"
8- #include " utstring.h"
911
1012SUITE (io_tests);
1113
@@ -55,18 +57,18 @@ TEST long_ipc_socket_test(void) {
5557 int socket_fd = bind_ipc_sock (socket_pathname, true );
5658 ASSERT (socket_fd >= 0 );
5759
58- UT_string *test_string;
59- utstring_new (test_string);
60+ std::stringstream test_string_ss;
6061 for (int i = 0 ; i < 10000 ; i++) {
61- utstring_printf (test_string, " hello world " ) ;
62+ test_string_ss << " hello world " ;
6263 }
64+ std::string test_string = test_string_ss.str ();
6365 const char *test_bytes = " another string" ;
6466 pid_t pid = fork ();
6567 if (pid == 0 ) {
6668 close (socket_fd);
6769 socket_fd = connect_ipc_sock (socket_pathname);
6870 ASSERT (socket_fd >= 0 );
69- write_log_message (socket_fd, utstring_body ( test_string));
71+ write_log_message (socket_fd, test_string. c_str ( ));
7072 write_message (socket_fd, LOG_MESSAGE, strlen (test_bytes),
7173 (uint8_t *) test_bytes);
7274 close (socket_fd);
@@ -76,7 +78,7 @@ TEST long_ipc_socket_test(void) {
7678 ASSERT (client_fd >= 0 );
7779 char *message = read_log_message (client_fd);
7880 ASSERT (message != NULL );
79- ASSERT_STR_EQ (utstring_body ( test_string), message);
81+ ASSERT_STR_EQ (test_string. c_str ( ), message);
8082 free (message);
8183 int64_t type;
8284 int64_t len;
@@ -90,7 +92,6 @@ TEST long_ipc_socket_test(void) {
9092 unlink (socket_pathname);
9193 }
9294
93- utstring_free (test_string);
9495#endif
9596 PASS ();
9697}
0 commit comments