mirror of
https://github.com/HowardHinnant/date.git
synced 2024-12-27 00:14:07 +08:00
Add tests for %I and %p format options
This commit is contained in:
parent
39b4edf279
commit
6e921e1b1d
@ -623,6 +623,21 @@ test_p()
|
|||||||
assert(!in.bad());
|
assert(!in.bad());
|
||||||
assert(tp == sys_days{2016_y/12/11} + hours{23});
|
assert(tp == sys_days{2016_y/12/11} + hours{23});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
std::istringstream in{"1986-12-01 01:01:01 pm"};
|
||||||
|
sys_time<seconds> tp;
|
||||||
|
in >> parse("%Y-%m-%d %I:%M:%S %p", tp);
|
||||||
|
assert(!in.fail());
|
||||||
|
assert(!in.bad());
|
||||||
|
assert(tp == sys_days{1986_y/12/01} + hours{13} + minutes{01} + seconds{01});
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::istringstream in{"1986-12-01 01:01:01"};
|
||||||
|
sys_time<seconds> tp;
|
||||||
|
in >> parse("%Y-%m-%d %I:%M:%S", tp);
|
||||||
|
// The test will fail because %I needs the %p option to shows if it is AM or PM
|
||||||
|
assert(in.fail());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user