From 48482b591f939a7dc8df15167e1b7dbaa00cdc9b Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Sun, 24 May 2015 20:33:37 -0400 Subject: [PATCH] ir: add tests for bt_ctf_field_variant_get_current_field() 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index 368c1e9f..12766db9 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -1334,6 +1334,7 @@ void field_copy_tests() struct bt_ctf_field *e = NULL; struct bt_ctf_field *v = NULL; struct bt_ctf_field *v_selected = NULL; + struct bt_ctf_field *v_selected_cur = NULL; struct bt_ctf_field *v_selected_0 = NULL; struct bt_ctf_field *v_selected_1 = NULL; struct bt_ctf_field *v_selected_2 = NULL; @@ -1497,6 +1498,12 @@ void field_copy_tests() /* set v field */ v_selected = bt_ctf_field_variant_get_field(v, e); assert(v_selected); + ok(!bt_ctf_field_variant_get_current_field(NULL), + "bt_ctf_field_variant_get_current_field handles NULL correctly"); + v_selected_cur = bt_ctf_field_variant_get_current_field(v); + ok(v_selected_cur == v_selected, + "bt_ctf_field_variant_get_current_field returns the current field"); + bt_ctf_field_put(v_selected_cur); /* set selected v field */ ret = bt_ctf_field_sequence_set_length(v_selected, len); -- 2.34.1