2 * Copyright (C) - EfficiOS, Inc.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by as
6 * published by the Free Software Foundation; only version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 #include <common/buffer-view.h>
21 static const int TEST_COUNT
= 5;
24 int lttng_opt_quiet
= 1;
25 int lttng_opt_verbose
;
28 static void test_validate_string(void)
30 const char buf
[] = {'A', 'l', 'l', 'o', '\0'};
31 struct lttng_buffer_view view
= lttng_buffer_view_init(buf
, 0, 5);
32 struct lttng_buffer_view view_minus_one
=
33 lttng_buffer_view_init(buf
, 0, 4);
35 ok1(!lttng_buffer_view_validate_string(&view
, buf
, 4));
36 ok1(lttng_buffer_view_validate_string(&view
, buf
, 5));
37 ok1(!lttng_buffer_view_validate_string(&view
, buf
, 6));
39 ok1(!lttng_buffer_view_validate_string(&view_minus_one
, buf
, 4));
40 ok1(!lttng_buffer_view_validate_string(&view_minus_one
, buf
, 5));
45 plan_tests(TEST_COUNT
);
47 test_validate_string();