|
@@ -2080,7 +2080,7 @@ test_util_format_time_interval(void *arg)
|
|
|
char dbuf[DBUF_SIZE];
|
|
|
#define T_ "%ld"
|
|
|
long sec, min, hour, day;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
* second(s), minute(s), hour(s), day(s) labels */
|
|
|
#define LABEL_SIZE 21
|
|
@@ -2091,16 +2091,16 @@ test_util_format_time_interval(void *arg)
|
|
|
char label_d[LABEL_SIZE];
|
|
|
|
|
|
#define TL_ T_ " " L_
|
|
|
-
|
|
|
+
|
|
|
int r;
|
|
|
-
|
|
|
+
|
|
|
(void)arg;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
* spelling or abbreviations */
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 0);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2108,30 +2108,30 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
tt_int_op(sec,==, 0);
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 1);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_, &sec, label_s);
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
tt_int_op(sec,==, 1);
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 10);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_, &sec, label_s);
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
tt_int_op(sec,==, 10);
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 59);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_, &sec, label_s);
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
tt_int_op(sec,==, 59);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), -4);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_, &sec, label_s);
|
|
@@ -2139,7 +2139,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
tt_int_op(sec,==, 4);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), -32);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_, &sec, label_s);
|
|
@@ -2147,9 +2147,9 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
tt_int_op(sec,==, 32);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 60);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2170,7 +2170,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(sec,==, 1);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 60*2 - 1);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_ " " TL_,
|
|
@@ -2180,7 +2180,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
tt_int_op(sec,==, 59);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 60*2);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2188,7 +2188,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_int_op(min,==, 2);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 60*2 + 1);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2199,7 +2199,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
tt_int_op(sec,==, 1);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 60*60 - 1);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_ " " TL_,
|
|
@@ -2209,9 +2209,9 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
tt_int_op(sec,==, 59);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), -3*60);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2219,7 +2219,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_int_op(min,==, 3);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), -96);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2230,7 +2230,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
tt_int_op(sec,==, 36);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), -2815);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_ " " TL_,
|
|
@@ -2240,10 +2240,10 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
tt_int_op(sec,==, 55);
|
|
|
tt_ci_char_op(label_s[0],==, 's');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 60*60);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2251,14 +2251,14 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_int_op(hour,==, 1);
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 60*60 + 1);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_, &hour, label_h);
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_int_op(hour,==, 1);
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 60*60 + 60);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2269,7 +2269,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
tt_int_op(min,==, 1);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 24*60*60 - 60);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_ " " TL_,
|
|
@@ -2279,7 +2279,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
tt_int_op(min,==, 59);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 24*60*60 - 1);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_ " " TL_,
|
|
@@ -2289,9 +2289,9 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
tt_int_op(min,==, 59);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), -2*60*60);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2299,7 +2299,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_int_op(hour,==, 2);
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), -75804);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_ " " TL_,
|
|
@@ -2309,10 +2309,10 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
tt_int_op(min,==, 3);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 24*60*60);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2320,14 +2320,14 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_int_op(day,==, 1);
|
|
|
tt_ci_char_op(label_d[0],==, 'd');
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 24*60*60 + 1);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_, &day, label_d);
|
|
|
tt_int_op(r,==, 2);
|
|
|
tt_int_op(day,==, 1);
|
|
|
tt_ci_char_op(label_d[0],==, 'd');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 24*60*60 + 60);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2347,7 +2347,7 @@ test_util_format_time_interval(void *arg)
|
|
|
}
|
|
|
tt_int_op(min,==, 1);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 24*60*60 + 60*60);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2358,9 +2358,9 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_d[0],==, 'd');
|
|
|
tt_int_op(hour,==, 1);
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), -21936184);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_ " " TL_ " " TL_,
|
|
@@ -2372,9 +2372,9 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
tt_int_op(min,==, 23);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 758635154);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2387,9 +2387,9 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
tt_int_op(min,==, 59);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
format_time_interval(dbuf, sizeof(dbuf), -1427014922);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
|
r = tor_sscanf(dbuf, TL_ " " TL_ " " TL_,
|
|
@@ -2401,12 +2401,12 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_ci_char_op(label_h[0],==, 'h');
|
|
|
tt_int_op(min,==, 2);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
-
|
|
|
+
|
|
|
#if SIZEOF_LONG == 4 || SIZEOF_LONG == 8
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 2147483647);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2420,7 +2420,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(min,==, 14);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
* which doesn't actually fit in int32_t.
|
|
|
* We expect INT32_MAX or INT32_MAX + 1 with 64 bit longs */
|
|
@@ -2443,7 +2443,7 @@ test_util_format_time_interval(void *arg)
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
format_time_interval(dbuf, sizeof(dbuf), 9223372036854775807L);
|
|
|
tt_int_op(strnlen(dbuf, DBUF_SIZE),<=, DBUF_SIZE - 1);
|
|
@@ -2457,7 +2457,7 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(min,==, 30);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
* which doesn't actually fit in int64_t.
|
|
|
* We expect INT64_MAX */
|
|
@@ -2474,11 +2474,10 @@ test_util_format_time_interval(void *arg)
|
|
|
tt_int_op(min,==, 30);
|
|
|
tt_ci_char_op(label_m[0],==, 'm');
|
|
|
|
|
|
-
|
|
|
+
|
|
|
#endif
|
|
|
|
|
|
-
|
|
|
-done:
|
|
|
+ done:
|
|
|
;
|
|
|
}
|
|
|
|