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

Method TestNetworkResolutionErrorMessage

util/network/socket_ut.cpp:93–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void TSockTest::TestNetworkResolutionErrorMessage() {
94#ifdef _unix_
95 auto str = [](int code) -> TString {
96 return TNetworkResolutionError(code).what();
97 };
98
99 auto expected = [](int code) -> TString {
100 return gai_strerror(code);
101 };
102
103 struct TErrnoGuard {
104 TErrnoGuard()
105 : PrevValue_(errno)
106 {
107 }
108
109 ~TErrnoGuard() {
110 errno = PrevValue_;
111 }
112
113 private:
114 int PrevValue_;
115 } g;
116
117 UNIT_ASSERT_VALUES_EQUAL(expected(0) + "(0): ", str(0));
118 UNIT_ASSERT_VALUES_EQUAL(expected(-9) + "(-9): ", str(-9));
119
120 errno = 0;
121 UNIT_ASSERT_VALUES_EQUAL(expected(EAI_SYSTEM) + "(" + IntToString<10>(EAI_SYSTEM) + "; errno=0): ",
122 str(EAI_SYSTEM));
123 errno = 110;
124 UNIT_ASSERT_VALUES_EQUAL(expected(EAI_SYSTEM) + "(" + IntToString<10>(EAI_SYSTEM) + "; errno=110): ",
125 str(EAI_SYSTEM));
126#endif
127}
128
129class TTempEnableSigPipe {
130public:

Callers

nothing calls this directly

Calls 4

expectedClass · 0.50
strClass · 0.50
whatMethod · 0.45

Tested by

no test coverage detected