ir: add tests for bt_ctf_stream_class_get_event_class_by_id()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 16 Mar 2015 23:21:59 +0000 (19:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Mar 2015 02:47:39 +0000 (22:47 -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 c4512cb39dd0d55770d150f853443aab2b6f5989..ec06a97b75f3c8880d1504544a03ed0fc894b9dc 100644 (file)
@@ -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");
This page took 0.026295 seconds and 4 git commands to generate.