diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-11-14 14:57:32 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-11-30 14:42:52 -0500 |
commit | 539eba0a4bab1e22a7e2e19132d356e99c32e232 (patch) | |
tree | 8cb80377dfdb33b7cb1fed231cf5b44c96851843 /src/test/test_util.c | |
parent | df8256a931099767d9f70997c9eb1ef934afd392 (diff) | |
download | tor-539eba0a4bab1e22a7e2e19132d356e99c32e232.tar.gz tor-539eba0a4bab1e22a7e2e19132d356e99c32e232.zip |
Teach parse_iso_time about the spaceless variant.
(We previously added support for generating the spaceless
2016-11-14T19:58:12 variant, but not for actually parsing it.)
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index b74f658146..187bfdd93c 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1059,6 +1059,23 @@ test_util_time(void *arg) tt_int_op(-1,OP_EQ, parse_iso_time("2004-08-04 00:48:22.100", &t_res)); tt_int_op(-1,OP_EQ, parse_iso_time("2004-08-04 00:48:22XYZ", &t_res)); + /* but... that _is_ acceptable if we aren't being strict. */ + t_res = 0; + i = parse_iso_time_("2004-08-04 00:48:22XYZ", &t_res, 0, 0); + tt_int_op(0,OP_EQ, i); + tt_int_op(t_res,OP_EQ, (time_t)1091580502UL); + + /* try nospace variant. */ + t_res = 0; + i = parse_iso_time_nospace("2004-08-04T00:48:22", &t_res); + tt_int_op(0,OP_EQ, i); + tt_int_op(t_res,OP_EQ, (time_t)1091580502UL); + + tt_int_op(-1,OP_EQ, parse_iso_time("2004-08-04T00:48:22", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time_nospace("2004-08-04 00:48:22", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("2004-08-04x00:48:22", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time_nospace("2004-08-04x00:48:22", &t_res)); + /* Test tor_gettimeofday */ end.tv_sec = 4; |