summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorCameron Evans <camerone@fb.com>2016-02-03 05:52:08 (GMT)
committerJason Evans <jasone@canonware.com>2016-02-20 04:29:06 (GMT)
commite5d5a4a51792258aed65e6b45191d1f56c1305ea (patch)
treede6678827608e575a32b8c6e4aaa424bcea53d85 /test/unit
parentf829009929bdce17bef8a963264a92e39271a166 (diff)
downloadjemalloc-e5d5a4a51792258aed65e6b45191d1f56c1305ea.zip
jemalloc-e5d5a4a51792258aed65e6b45191d1f56c1305ea.tar.gz
jemalloc-e5d5a4a51792258aed65e6b45191d1f56c1305ea.tar.bz2
Add time_update().
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/time.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/time.c b/test/unit/time.c
new file mode 100644
index 0000000..80460f9
--- /dev/null
+++ b/test/unit/time.c
@@ -0,0 +1,23 @@
+#include "test/jemalloc_test.h"
+
+TEST_BEGIN(test_time_update)
+{
+ struct timespec ts;
+
+ memset(&ts, 0, sizeof(struct timespec));
+
+ assert_false(time_update(&ts), "Basic time update failed.");
+
+ /* Only Rip Van Winkle sleeps this long. */
+ ts.tv_sec += 631152000;
+ assert_true(time_update(&ts), "Update should detect time roll-back.");
+}
+TEST_END
+
+int
+main(void)
+{
+
+ return (test(
+ test_time_update));
+}