Handle negative time and offset from Epoch
[babeltrace.git] / tests / lib / test_seek.c
index 63e5a6ad2183991734cb697192e90ab3aad82e6f..444f1ab7664420520592a6b6d1c7949e22b3e7fb 100644 (file)
@@ -33,7 +33,7 @@
 #include <tap/tap.h>
 #include "common.h"
 
-#define NR_TESTS       29
+#define NR_TESTS       36
 
 void run_seek_begin(char *path, uint64_t expected_begin)
 {
@@ -42,8 +42,8 @@ void run_seek_begin(char *path, uint64_t expected_begin)
        struct bt_ctf_event *event;
        struct bt_iter_pos newpos;
        int ret;
-       uint64_t timestamp_begin;
-       uint64_t timestamp_seek_begin;
+       int64_t timestamp_begin;
+       int64_t timestamp_seek_begin;
 
        /* Open the trace */
        ctx = create_context_with_path(path);
@@ -64,7 +64,7 @@ void run_seek_begin(char *path, uint64_t expected_begin)
        ok(event, "Event valid");
 
        /* Validate that the first timestamp is right */
-       timestamp_begin = bt_ctf_get_timestamp(event);
+       ok1(bt_ctf_get_timestamp(event, &timestamp_begin) == 0);
 
        ok1(timestamp_begin == expected_begin);
 
@@ -78,7 +78,7 @@ void run_seek_begin(char *path, uint64_t expected_begin)
 
        ok(event, "Event valid");
 
-       timestamp_seek_begin = bt_ctf_get_timestamp(event);
+       ok1(bt_ctf_get_timestamp(event, &timestamp_seek_begin) == 0);
 
        ok1(timestamp_begin == timestamp_seek_begin);
 
@@ -93,7 +93,7 @@ void run_seek_last(char *path, uint64_t expected_last)
        struct bt_ctf_event *event;
        struct bt_iter_pos newpos;
        int ret;
-       uint64_t timestamp_last;
+       int64_t timestamp_last;
 
        /* Open the trace */
        ctx = create_context_with_path(path);
@@ -123,7 +123,7 @@ void run_seek_last(char *path, uint64_t expected_last)
 
        ok(event, "Event valid at last position");
 
-       timestamp_last = bt_ctf_get_timestamp(event);
+       ok1(bt_ctf_get_timestamp(event, &timestamp_last) == 0);
 
        ok1(timestamp_last == expected_last);
 
@@ -146,7 +146,7 @@ void run_seek_time_at_last(char *path, uint64_t expected_last)
        struct bt_ctf_event *event;
        struct bt_iter_pos newpos;
        int ret;
-       uint64_t timestamp_last;
+       int64_t timestamp_last;
 
        /* Open the trace */
        ctx = create_context_with_path(path);
@@ -177,7 +177,7 @@ void run_seek_time_at_last(char *path, uint64_t expected_last)
 
        ok(event, "Event valid at last position");
 
-       timestamp_last = bt_ctf_get_timestamp(event);
+       ok1(bt_ctf_get_timestamp(event, &timestamp_last) == 0);
 
        ok1(timestamp_last == expected_last);
 
@@ -202,7 +202,7 @@ void run_seek_cycles(char *path,
        struct bt_ctf_event *event;
        struct bt_iter_pos newpos;
        int ret;
-       uint64_t timestamp;
+       int64_t timestamp;
 
        /* Open the trace */
        ctx = create_context_with_path(path);
@@ -232,7 +232,7 @@ void run_seek_cycles(char *path,
 
        ok(event, "Event valid at last position");
 
-       timestamp = bt_ctf_get_timestamp(event);
+       ok1(bt_ctf_get_timestamp(event, &timestamp) == 0);
 
        ok1(timestamp == expected_last);
 
@@ -255,7 +255,7 @@ void run_seek_cycles(char *path,
 
        ok(event, "Event valid at first position");
 
-       timestamp = bt_ctf_get_timestamp(event);
+       ok1(bt_ctf_get_timestamp(event, &timestamp) == 0);
 
        ok1(timestamp == expected_begin);
 
@@ -269,7 +269,7 @@ void run_seek_cycles(char *path,
 
        ok(event, "Event valid at last position");
 
-       timestamp = bt_ctf_get_timestamp(event);
+       ok1(bt_ctf_get_timestamp(event, &timestamp) == 0);
 
        ok1(timestamp == expected_last);
 
This page took 0.025452 seconds and 4 git commands to generate.