ir: add tests for duplicate event classes
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 19 Mar 2015 19:09:28 +0000 (15:09 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Mar 2015 21:36:22 +0000 (17:36 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/lib/test_ctf_writer.c

index e6120d2242e8adf7d47798d3db9c1ea3c480d6db..4d2c468a378578a80febb4843f7f967fc253daa3 100644 (file)
@@ -1752,6 +1752,22 @@ end:
        bt_ctf_clock_put(clock);
 }
 
+void append_existing_event_class(struct bt_ctf_stream_class *stream_class)
+{
+       struct bt_ctf_event_class *event_class;
+
+       assert(event_class = bt_ctf_event_class_create("Simple Event"));
+       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");
+       bt_ctf_event_class_put(event_class);
+
+       assert(event_class = bt_ctf_event_class_create("different name, ok"));
+       assert(!bt_ctf_event_class_set_id(event_class, 11));
+       ok(bt_ctf_stream_class_add_event_class(stream_class, event_class),
+               "two event classes with the same ID cannot cohabit within the same stream class");
+       bt_ctf_event_class_put(event_class);
+}
+
 int main(int argc, char **argv)
 {
        char trace_path[] = "/tmp/ctfwriter_XXXXXX";
@@ -2355,6 +2371,8 @@ int main(int argc, char **argv)
 
        append_complex_event(stream_class, stream1, clock);
 
+       append_existing_event_class(stream_class);
+
        test_empty_stream(writer);
 
        metadata_string = bt_ctf_writer_get_metadata_string(writer);
This page took 0.026465 seconds and 4 git commands to generate.