MCPcopy Create free account
hub / github.com/cucumber/cucumber-cpp / UnixSocketServerTest

Class UnixSocketServerTest

tests/integration/WireServerTest.cpp:167–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166#if defined(ASIO_HAS_LOCAL_SOCKETS)
167class UnixSocketServerTest : public SocketServerTest {
168protected:
169 std::unique_ptr<UnixSocketServer> server;
170
171 SocketServer* createListeningServer() override {
172 const std::string filename = std::filesystem::temp_directory_path() / randomString();
173 server.reset(new UnixSocketServer(&protocolHandler));
174 server->listen(filename);
175 return server.get();
176 }
177
178 void destroyListeningServer() override {
179 server.reset();
180 }
181
182private:
183 std::random_device rd{};
184 std::mt19937 gen{rd()};
185 std::uniform_int_distribution<> distrib{0, 15};
186
187 std::string randomString() {
188 std::stringstream out{};
189 for (std::size_t i = 0; i < 16; i++)
190 out << std::hex << distrib(gen);
191 return out.str();
192 }
193};
194
195/*
196 * Tests are flickering on OSX when testing without traffic flowing.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected