MCPcopy Create free account
hub / github.com/HowardHinnant/date / test_c

Function test_c

test/date_test/parse.pass.cpp:193–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193void
194test_c()
195{
196 using namespace date;
197 using namespace std::chrono;
198 {
199 // correct abbreviation
200 std::istringstream in{"Sun Dec 11 14:02:43 2016"};
201 sys_seconds tp;
202 in >> parse("%c", tp);
203 assert(!in.fail());
204 assert(!in.bad());
205 assert(tp == sys_days{2016_y/12/11} + hours{14} + minutes{2} + seconds{43});
206 }
207 {
208 // can't parse negative years with "%c" directly
209 std::istringstream in{"Sun Dec 11 14:02:43 -2016"};
210 sys_seconds tp;
211 in >> parse("%c", tp);
212 assert(in.fail());
213 }
214}
215
216void
217test_x()

Callers 1

mainFunction · 0.70

Calls 1

parseFunction · 0.85

Tested by

no test coverage detected