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

Function test_S

test/date_test/parse.pass.cpp:573–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573void
574test_S()
575{
576 using namespace date;
577 using namespace std::chrono;
578 using date::sys_time;
579 {
580 std::istringstream in{"2016-12-11 15"};
581 sys_seconds tp;
582 in >> parse("%F %S", tp);
583 assert(!in.fail());
584 assert(!in.bad());
585 assert(tp == sys_days{2016_y/12/11} + seconds{15});
586 }
587 {
588 std::istringstream in{"2016-12-11 15.001"};
589 sys_time<milliseconds> tp;
590 in >> parse("%F %S", tp);
591 assert(!in.fail());
592 assert(!in.bad());
593 assert(tp == sys_days{2016_y/12/11} + seconds{15} + milliseconds{1});
594 }
595 {
596 std::istringstream in{"2016-12-11 60"};
597 sys_seconds tp;
598 in >> parse("%F %S", tp);
599 assert(in.fail());
600 }
601}
602
603void
604test_T()

Callers 1

mainFunction · 0.85

Calls 1

parseFunction · 0.85

Tested by

no test coverage detected