1 #ifndef TEST_SOCKET_UNIX_COMMON_HPP_
2 #define TEST_SOCKET_UNIX_COMMON_HPP_
4 #include <posixx/socket/unix.hpp> // posixx::socket::unix
5 #include <posixx/socket/unix/print.hpp> // address ostream formatting
6 #include <boost/test/unit_test.hpp> // unit testing stuff
7 #include <ostream> // std::ostream
8 #include <unistd.h> // unlink
9 #include <sys/stat.h> // struct stat
11 #define PATH "/tmp/posixx_socket_unix_test"
12 #define PATH1 PATH "1"
13 #define PATH2 PATH "2"
16 void clean_test_address(posixx::socket::unix::socket& socket,
17 const posixx::socket::unix::sockaddr& addr)
19 // remove the socket file, if exists
21 if (stat(addr.sun_path, &st) == 0)
22 BOOST_REQUIRE_EQUAL(unlink(addr.sun_path), 0);
25 static posixx::socket::unix::sockaddr test_address1(PATH1);
26 static posixx::socket::unix::sockaddr test_address2(PATH2);
28 #endif // TEST_SOCKET_UNIX_COMMON_HPP_