From f60fde631cec36ea5c6ed7c6838d95f8808f4c15 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 19 Mar 2015 15:09:28 -0400 Subject: [PATCH] ir: add tests for duplicate event classes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- tests/lib/test_ctf_writer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index e6120d22..4d2c468a 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -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); -- 2.34.1