From 1a7334e082f086e6696712d9438173585ffdc8e2 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 16 Mar 2015 18:56:26 -0400 Subject: [PATCH] ir: add tests for bt_ctf_trace_get_clock_by_name() 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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index ff7f47ee..c4512cb3 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -1866,6 +1866,18 @@ int main(int argc, char **argv) ok(ret_clock == clock, "bt_ctf_trace_get_clock returns the right clock instance"); bt_ctf_clock_put(ret_clock); + ok(!bt_ctf_trace_get_clock_by_name(trace, NULL), + "bt_ctf_trace_get_clock_by_name correctly handles NULL (trace)"); + ok(!bt_ctf_trace_get_clock_by_name(NULL, clock_name), + "bt_ctf_trace_get_clock_by_name correctly handles NULL (clock name)"); + ok(!bt_ctf_trace_get_clock_by_name(NULL, NULL), + "bt_ctf_trace_get_clock_by_name correctly handles NULL (both)"); + ret_clock = bt_ctf_trace_get_clock_by_name(trace, clock_name); + ok(ret_clock == clock, + "bt_ctf_trace_get_clock_by_name returns the right clock instance"); + bt_ctf_clock_put(ret_clock); + ok(!bt_ctf_trace_get_clock_by_name(trace, "random"), + "bt_ctf_trace_get_clock_by_name fails when the requested clock doesn't exist"); ok(!bt_ctf_clock_get_name(NULL), "bt_ctf_clock_get_name correctly handles NULL"); -- 2.34.1