linux/lib/test_scanf.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Test cases for sscanf facility.
 */

#define pr_fmt(fmt)

#include <linux/bitops.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/overflow.h>
#include <linux/printk.h>
#include <linux/random.h>
#include <linux/slab.h>
#include <linux/string.h>

#include "../tools/testing/selftests/kselftest_module.h"

#define BUF_SIZE

KSTM_MODULE_GLOBALS();
static char *test_buffer __initdata;
static char *fmt_buffer __initdata;
static struct rnd_state rnd_state __initdata;

check_fn;

static void __scanf(4, 6) __init
_test(check_fn fn, const void *check_data, const char *string, const char *fmt,
	int n_args, ...)
{}

#define _check_numbers_template(arg_fmt, expect, str, fmt, n_args, ap)

static int __init check_ull(const void *check_data, const char *string,
			    const char *fmt, int n_args, va_list ap)
{}

static int __init check_ll(const void *check_data, const char *string,
			   const char *fmt, int n_args, va_list ap)
{}

static int __init check_ulong(const void *check_data, const char *string,
			   const char *fmt, int n_args, va_list ap)
{}

static int __init check_long(const void *check_data, const char *string,
			  const char *fmt, int n_args, va_list ap)
{}

static int __init check_uint(const void *check_data, const char *string,
			     const char *fmt, int n_args, va_list ap)
{}

static int __init check_int(const void *check_data, const char *string,
			    const char *fmt, int n_args, va_list ap)
{}

static int __init check_ushort(const void *check_data, const char *string,
			       const char *fmt, int n_args, va_list ap)
{}

static int __init check_short(const void *check_data, const char *string,
			       const char *fmt, int n_args, va_list ap)
{}

static int __init check_uchar(const void *check_data, const char *string,
			       const char *fmt, int n_args, va_list ap)
{}

static int __init check_char(const void *check_data, const char *string,
			       const char *fmt, int n_args, va_list ap)
{}

/* Selection of interesting numbers to test, copied from test-kstrtox.c */
static const unsigned long long numbers[] __initconst =;

#define value_representable_in_type(T, val)


#define test_one_number(T, gen_fmt, scan_fmt, val, fn)

#define simple_numbers_loop(T, gen_fmt, scan_fmt, fn)

static void __init numbers_simple(void)
{}

/*
 * This gives a better variety of number "lengths" in a small sample than
 * the raw prandom*() functions (Not mathematically rigorous!!).
 * Variabilty of length and value is more important than perfect randomness.
 */
static u32 __init next_test_random(u32 max_bits)
{}

static unsigned long long __init next_test_random_ull(void)
{}

#define random_for_type(T)

/*
 * Define a pattern of negative and positive numbers to ensure we get
 * some of both within the small number of samples in a test string.
 */
#define NEGATIVES_PATTERN

#define fill_random_array(arr)

/*
 * Convenience wrapper around snprintf() to append at buf_pos in buf,
 * updating buf_pos and returning the number of characters appended.
 * On error buf_pos is not changed and return value is 0.
 */
static int __init __printf(4, 5)
append_fmt(char *buf, int *buf_pos, int buf_len, const char *val_fmt, ...)
{}

/*
 * Convenience function to append the field delimiter string
 * to both the value string and format string buffers.
 */
static void __init append_delim(char *str_buf, int *str_buf_pos, int str_buf_len,
				char *fmt_buf, int *fmt_buf_pos, int fmt_buf_len,
				const char *delim_str)
{}

#define test_array_8(fn, check_data, string, fmt, arr)

#define numbers_list_8(T, gen_fmt, field_sep, scan_fmt, fn)

#define numbers_list_fix_width(T, gen_fmt, field_sep, width, scan_fmt, fn)

#define numbers_list_val_width(T, gen_fmt, field_sep, scan_fmt, fn)

static void __init numbers_list_ll(const char *delim)
{}

static void __init numbers_list_l(const char *delim)
{}

static void __init numbers_list_d(const char *delim)
{}

static void __init numbers_list_h(const char *delim)
{}

static void __init numbers_list_hh(const char *delim)
{}

static void __init numbers_list(const char *delim)
{}

static void __init numbers_list_field_width_ll(const char *delim)
{}

static void __init numbers_list_field_width_l(const char *delim)
{}

static void __init numbers_list_field_width_d(const char *delim)
{}

static void __init numbers_list_field_width_h(const char *delim)
{}

static void __init numbers_list_field_width_hh(const char *delim)
{}

/*
 * List of numbers separated by delim. Each field width specifier is the
 * maximum possible digits for the given type and base.
 */
static void __init numbers_list_field_width_typemax(const char *delim)
{}

static void __init numbers_list_field_width_val_ll(const char *delim)
{}

static void __init numbers_list_field_width_val_l(const char *delim)
{}

static void __init numbers_list_field_width_val_d(const char *delim)
{}

static void __init numbers_list_field_width_val_h(const char *delim)
{}

static void __init numbers_list_field_width_val_hh(const char *delim)
{}

/*
 * List of numbers separated by delim. Each field width specifier is the
 * exact length of the corresponding value digits in the string being scanned.
 */
static void __init numbers_list_field_width_val_width(const char *delim)
{}

/*
 * Slice a continuous string of digits without field delimiters, containing
 * numbers of varying length, using the field width to extract each group
 * of digits. For example the hex values c0,3,bf01,303 would have a
 * string representation of "c03bf01303" and extracted with "%2x%1x%4x%3x".
 */
static void __init numbers_slice(void)
{}

#define test_number_prefix(T, str, scan_fmt, expect0, expect1, n_args, fn)

/*
 * Number prefix is >= field width.
 * Expected behaviour is derived from testing userland sscanf.
 */
static void __init numbers_prefix_overflow(void)
{}

#define _test_simple_strtoxx(T, fn, gen_fmt, expect, base)

#define test_simple_strtoxx(T, fn, gen_fmt, base)

static void __init test_simple_strtoull(void)
{}

static void __init test_simple_strtoll(void)
{}

static void __init test_simple_strtoul(void)
{}

static void __init test_simple_strtol(void)
{}

/* Selection of common delimiters/separators between numbers in a string. */
static const char * const number_delimiters[] __initconst =;

static void __init test_numbers(void)
{}

static void __init selftest(void)
{}

KSTM_MODULE_LOADERS(test_scanf);
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();