linux/lib/bitfield_kunit.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Test cases for bitfield helpers.
 */

#define pr_fmt(fmt)

#include <kunit/test.h>
#include <linux/bitfield.h>

#define CHECK_ENC_GET_U(tp, v, field, res)

#define CHECK_ENC_GET_LE(tp, v, field, res)

#define CHECK_ENC_GET_BE(tp, v, field, res)

#define CHECK_ENC_GET(tp, v, field, res)

static void __init test_bitfields_constants(struct kunit *context)
{}

#define CHECK(tp, mask)

static void __init test_bitfields_variables(struct kunit *context)
{}

#ifdef TEST_BITFIELD_COMPILE
static void __init test_bitfields_compile(struct kunit *context)
{
	/* these should fail compilation */
	CHECK_ENC_GET(16, 16, 0x0f00, 0x1000);
	u32_encode_bits(7, 0x06000000);

	/* this should at least give a warning */
	u16_encode_bits(0, 0x60000);
}
#endif

static struct kunit_case __refdata bitfields_test_cases[] =;

static struct kunit_suite bitfields_test_suite =;

kunit_test_suites();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();