Tests: Fix: Use '.logfile' instead of '.log' for test app output
[lttng-tools.git] / tests / unit / test_buffer_view.cpp
1 /*
2 * Copyright (C) 2020 EfficiOS, inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #include <common/buffer-view.hpp>
9
10 #include <tap/tap.h>
11
12 static const int TEST_COUNT = 5;
13
14 /* For error.h */
15 int lttng_opt_quiet = 1;
16 int lttng_opt_verbose;
17 int lttng_opt_mi;
18
19 static void test_contains_string()
20 {
21 const char buf[] = { 'A', 'l', 'l', 'o', '\0' };
22 struct lttng_buffer_view view = lttng_buffer_view_init(buf, 0, 5);
23 struct lttng_buffer_view view_minus_one = lttng_buffer_view_init(buf, 0, 4);
24
25 ok1(!lttng_buffer_view_contains_string(&view, buf, 4));
26 ok1(lttng_buffer_view_contains_string(&view, buf, 5));
27 ok1(!lttng_buffer_view_contains_string(&view, buf, 6));
28
29 ok1(!lttng_buffer_view_contains_string(&view_minus_one, buf, 4));
30 ok1(!lttng_buffer_view_contains_string(&view_minus_one, buf, 5));
31 }
32
33 int main()
34 {
35 plan_tests(TEST_COUNT);
36
37 test_contains_string();
38
39 return exit_status();
40 }
This page took 0.030376 seconds and 4 git commands to generate.