linux/lib/kunit/assert.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Assertion and expectation serialization API.
 *
 * Copyright (C) 2019, Google LLC.
 * Author: Brendan Higgins <[email protected]>
 */
#include <kunit/assert.h>
#include <kunit/test.h>
#include <kunit/visibility.h>

#include "string-stream.h"

void kunit_assert_prologue(const struct kunit_loc *loc,
			   enum kunit_assert_type type,
			      struct string_stream *stream)
{}
EXPORT_SYMBOL_GPL();

VISIBLE_IF_KUNIT
void kunit_assert_print_msg(const struct va_format *message,
			    struct string_stream *stream)
{}

void kunit_fail_assert_format(const struct kunit_assert *assert,
			      const struct va_format *message,
			      struct string_stream *stream)
{}
EXPORT_SYMBOL_GPL();

void kunit_unary_assert_format(const struct kunit_assert *assert,
			       const struct va_format *message,
			       struct string_stream *stream)
{}
EXPORT_SYMBOL_GPL();

void kunit_ptr_not_err_assert_format(const struct kunit_assert *assert,
				     const struct va_format *message,
				     struct string_stream *stream)
{}
EXPORT_SYMBOL_GPL();

/* Checks if `text` is a literal representing `value`, e.g. "5" and 5 */
VISIBLE_IF_KUNIT bool is_literal(const char *text, long long value)
{}

void kunit_binary_assert_format(const struct kunit_assert *assert,
				const struct va_format *message,
				struct string_stream *stream)
{}
EXPORT_SYMBOL_GPL();

void kunit_binary_ptr_assert_format(const struct kunit_assert *assert,
				    const struct va_format *message,
				    struct string_stream *stream)
{}
EXPORT_SYMBOL_GPL();

/* Checks if KUNIT_EXPECT_STREQ() args were string literals.
 * Note: `text` will have ""s where as `value` will not.
 */
VISIBLE_IF_KUNIT bool is_str_literal(const char *text, const char *value)
{}

void kunit_binary_str_assert_format(const struct kunit_assert *assert,
				    const struct va_format *message,
				    struct string_stream *stream)
{}
EXPORT_SYMBOL_GPL();

/* Adds a hexdump of a buffer to a string_stream comparing it with
 * a second buffer. The different bytes are marked with <>.
 */
VISIBLE_IF_KUNIT
void kunit_assert_hexdump(struct string_stream *stream,
			  const void *buf,
			  const void *compared_buf,
			  const size_t len)
{}

void kunit_mem_assert_format(const struct kunit_assert *assert,
			     const struct va_format *message,
			     struct string_stream *stream)
{}
EXPORT_SYMBOL_GPL();