From: Philippe Proulx Date: Mon, 16 Mar 2015 22:56:26 +0000 (-0400) Subject: ir: add tests for bt_ctf_trace_get_clock_by_name() X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=1a7334e082f086e6696712d9438173585ffdc8e2;p=deliverable%2Fbabeltrace.git ir: add tests for bt_ctf_trace_get_clock_by_name() Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index ff7f47ee1..c4512cb39 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");