From 3ed04f17655390c91c81b25f24d9b7aa8265dc23 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 16 Mar 2015 19:21:59 -0400 Subject: [PATCH] ir: add tests for bt_ctf_stream_class_get_event_class_by_id() 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 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index c4512cb3..ec06a97b 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -455,6 +455,8 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class, bt_ctf_event_class_add_field(simple_event_class, float_type, "float_field"); + assert(!bt_ctf_event_class_set_id(simple_event_class, 13)); + /* Set an event context type which will contain a single integer*/ ok(!bt_ctf_field_type_structure_add_field(event_context_type, uint_12_type, "event_specific_context"), @@ -489,6 +491,15 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class, ok(ret_event_class == simple_event_class, "bt_ctf_stream_class_get_event_class returns the correct event class"); bt_ctf_event_class_put(ret_event_class); + ok(!bt_ctf_stream_class_get_event_class_by_id(NULL, 0), + "bt_ctf_stream_class_get_event_class_by_id handles NULL correctly"); + ok(!bt_ctf_stream_class_get_event_class_by_id(stream_class, 2), + "bt_ctf_stream_class_get_event_class_by_id returns NULL when the requested ID doesn't exist"); + ret_event_class = + bt_ctf_stream_class_get_event_class_by_id(stream_class, 13); + ok(ret_event_class == simple_event_class, + "bt_ctf_stream_class_get_event_class_by_id returns a correct event class"); + bt_ctf_event_class_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"); -- 2.34.1