/*
- * test-bitfield.c
+ * SPDX-License-Identifier: GPL-2.0-only
*
- * BabelTrace - bitfield test program
- *
- * Copyright 2010-2019 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
+ * Copyright (C) 2010-2019 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * BabelTrace - bitfield test program
*/
#include "compat/bitfield.h"
/*
* This function is only declared to show the size of a bitfield write in
- * objdump.
+ * objdump. The declaration is there to avoid a -Wmissing-prototypes warning.
*/
+void fct(void);
void fct(void)
{
bt_bitfield_write(&glob, unsigned int, 12, 15, 0x12345678);
(val) != (ref); \
})
+static
void run_test_unsigned_write(unsigned int src_ui, unsigned long long src_ull)
{
unsigned int nrbits_ui, nrbits_ull;
pass(UNSIGNED_LONG_LONG_WRITE_TEST_DESC_FMT_STR, src_ull);
}
+static
void run_test_unsigned_read(unsigned int src_ui, unsigned long long src_ull)
{
unsigned int nrbits_ui, nrbits_ull, readval_ui;
pass(UNSIGNED_LONG_LONG_READ_TEST_DESC_FMT_STR, src_ull);
}
+static
void run_test_unsigned(unsigned int src_ui, unsigned long long src_ull)
{
run_test_unsigned_write(src_ui, src_ull);
run_test_unsigned_read(src_ui, src_ull);
}
+static
void run_test_signed_write(int src_i, long long src_ll)
{
unsigned int nrbits_i, nrbits_ll;
pass(SIGNED_LONG_LONG_WRITE_TEST_DESC_FMT_STR, src_ll);
}
+static
void run_test_signed_read(int src_i, long long src_ll)
{
unsigned int nrbits_i, nrbits_ll;
pass(SIGNED_LONG_LONG_READ_TEST_DESC_FMT_STR, src_ll);
}
+static
void run_test_signed(int src_i, long long src_ll)
{
run_test_signed_write(src_i, src_ll);
run_test_signed_read(src_i, src_ll);
}
+static
void run_test(void)
{
int i;