MCPcopy Create free account
hub / github.com/catboost/catboost / Y_UNIT_TEST

Function Y_UNIT_TEST

util/network/poller_ut.cpp:9–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8Y_UNIT_TEST_SUITE(TSocketPollerTest) {
9 Y_UNIT_TEST(TestSimple) {
10 SOCKET sockets[2];
11 UNIT_ASSERT(SocketPair(sockets) == 0);
12
13 TSocketHolder s1(sockets[0]);
14 TSocketHolder s2(sockets[1]);
15
16 TSocketPoller poller;
17 poller.WaitRead(sockets[1], (void*)17);
18
19 UNIT_ASSERT_VALUES_EQUAL(nullptr, poller.WaitT(TDuration::Zero()));
20 UNIT_ASSERT_VALUES_EQUAL(nullptr, poller.WaitT(TDuration::Zero()));
21
22 for (ui32 i = 0; i < 3; ++i) {
23 char buf[] = {18};
24 UNIT_ASSERT_VALUES_EQUAL(1, send(sockets[0], buf, 1, 0));
25
26 UNIT_ASSERT_VALUES_EQUAL((void*)17, poller.WaitT(TDuration::Zero()));
27
28 UNIT_ASSERT_VALUES_EQUAL(1, recv(sockets[1], buf, 1, 0));
29 UNIT_ASSERT_VALUES_EQUAL(18, buf[0]);
30
31 UNIT_ASSERT_VALUES_EQUAL(nullptr, poller.WaitT(TDuration::Zero()));
32 UNIT_ASSERT_VALUES_EQUAL(nullptr, poller.WaitT(TDuration::Zero()));
33 }
34 }
35
36 Y_UNIT_TEST(TestSimpleOneShot) {
37 SOCKET sockets[2];

Callers

nothing calls this directly

Calls 15

ZeroFunction · 0.85
SetNonBlockFunction · 0.85
Y_UNUSEDFunction · 0.85
ClearLastSystemErrorFunction · 0.85
LastSystemErrorFunction · 0.85
WaitReadMethod · 0.80
WaitReadOneShotMethod · 0.80
UnwaitMethod · 0.80
WaitWriteMethod · 0.80
ToDeadLineMethod · 0.80

Tested by

no test coverage detected