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

Function DoTestMilitaryZones

util/datetime/parser_ut.cpp:146–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 }
145
146 void DoTestMilitaryZones(char firstChar, char lastChar) {
147 const time_t utcTime = 1109964885; // Fri, 4 Mar 2005 19:34:45 UT
148 char text[] = "Fri, 4 Mar 2005 19:34:45 A";
149 const size_t zoneCharIndex = strlen(text) - 1;
150
151 for (char militaryZone = firstChar; militaryZone <= lastChar; ++militaryZone) {
152 time_t t = 0;
153 const time_t offset = GetOffset(militaryZone);
154 // the last character is replaced with next zone symbol
155 text[zoneCharIndex] = militaryZone;
156
157 UNIT_ASSERT(ParseRFC822DateTime(text, t));
158 UNIT_ASSERT_EQUAL(t, utcTime - offset);
159 }
160 }
161
162 Y_UNIT_TEST(TestRfc822MilitaryZones) {
163 DoTestMilitaryZones('A', 'I');

Callers 1

Y_UNIT_TESTFunction · 0.70

Calls 1

GetOffsetFunction · 0.70

Tested by

no test coverage detected