#define DEFAULT_CLOCK_TIME 0
#define DEFAULT_CLOCK_VALUE 0
-#define NR_TESTS 611
+#define NR_TESTS 614
static int64_t current_time = 42;
"bt_ctf_stream_class_get_event_class_by_id returns a correct event class");
bt_put(ret_event_class);
- ok(bt_ctf_stream_class_get_event_class_by_name(NULL, "some event name") == NULL,
- "bt_ctf_stream_class_get_event_class_by_name handles a NULL stream class correctly");
- ok(bt_ctf_stream_class_get_event_class_by_name(stream_class, NULL) == NULL,
- "bt_ctf_stream_class_get_event_class_by_name handles a NULL event class name correctly");
- ok(bt_ctf_stream_class_get_event_class_by_name(stream_class, "some event name") == NULL,
- "bt_ctf_stream_class_get_event_class_by_name handles non-existing event class names correctly");
- ret_event_class = bt_ctf_stream_class_get_event_class_by_name(stream_class, "Simple Event");
- ok(ret_event_class == simple_event_class,
- "bt_ctf_stream_class_get_event_class_by_name returns a correct event class");
- bt_put(ret_event_class);
-
simple_event = bt_ctf_event_create(simple_event_class);
ok(simple_event,
"Instantiate an event containing a single integer field");
event_class = bt_ctf_event_class_create("Simple Event");
assert(event_class);
- ok(bt_ctf_stream_class_add_event_class(stream_class, event_class),
- "two event classes with the same name cannot cohabit within the same stream class");
+ ok(bt_ctf_stream_class_add_event_class(stream_class, event_class) == 0,
+ "two event classes with the same name may cohabit within the same stream class");
bt_put(event_class);
event_class = bt_ctf_event_class_create("different name, ok");
bt_put(clock_class);
}
+static
+void test_trace_uuid(void)
+{
+ struct bt_ctf_trace *trace;
+ const unsigned char uuid[] = {
+ 0x35, 0x92, 0x63, 0xab, 0xb4, 0xbe, 0x40, 0xb4,
+ 0xb2, 0x60, 0xd3, 0xf1, 0x3b, 0xb0, 0xd8, 0x59,
+ };
+ const unsigned char *ret_uuid;
+
+ trace = bt_ctf_trace_create();
+ assert(trace);
+ ok(!bt_ctf_trace_get_uuid(NULL),
+ "bt_ctf_trace_get_uuid() handles NULL");
+ ok(!bt_ctf_trace_get_uuid(trace),
+ "bt_ctf_trace_get_uuid() returns NULL initially");
+ ok(bt_ctf_trace_set_uuid(NULL, uuid),
+ "bt_ctf_trace_set_uuid() handles NULL (trace)");
+ ok(bt_ctf_trace_set_uuid(trace, NULL),
+ "bt_ctf_trace_set_uuid() handles NULL (UUID)");
+ ok(bt_ctf_trace_set_uuid(trace, uuid) == 0,
+ "bt_ctf_trace_set_uuid() succeeds with a valid UUID");
+ ret_uuid = bt_ctf_trace_get_uuid(trace);
+ ok(ret_uuid, "bt_ctf_trace_get_uuid() returns a UUID");
+ ok(memcmp(uuid, ret_uuid, 16) == 0,
+ "bt_ctf_trace_get_uuid() returns the expected UUID");
+
+ bt_put(trace);
+}
+
int main(int argc, char **argv)
{
char trace_path[] = "/tmp/ctfwriter_XXXXXX";
test_static_trace();
+ test_trace_uuid();
+
metadata_string = bt_ctf_writer_get_metadata_string(writer);
ok(metadata_string, "Get metadata string");