STRUCT KUNIT_MEM_ASSERT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct kunit_mem_assert β€” Kernel API Manual, bestie edition ✨

okay so picture this: you're deep in ./include/kunit/assert.h land, the Kernel API Manual is open, and you just need to know what a struct kunit_mem_assert is. Don't worry bestie, I got you πŸ’–


🌸 NAME 🌸

struct kunit_mem_assert β€” it's an expectation/assertion that compares two memory blocks. literally that's the whole vibe. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

struct kunit_mem_assert {
    struct kunit_assert assert;
    const struct kunit_binary_assert_text *text;
    const void *left_value;
    const void *right_value;
    const size_t size;
};

πŸ¦‹ Members πŸ¦‹

  • assert β€” the parent of this type. every icon needs a parent, periodt.
  • text β€” holds the textual representations of the operands and the comparator. it's giving receipts for your comparison πŸ”₯
  • left_value β€” the actual evaluated value of the expression in the left slot. main character of the left side πŸ’…
  • right_value β€” the actual evaluated value of the expression in the right slot. and the right side said "not me being compared" πŸ™ˆ
  • size β€” size of the memory block analysed, in bytes. number-crunching icon, fr fr πŸ“

🧚 Description 🧚

so here's the tea β˜• β€” this struct represents an expectation/assertion that compares two memory blocks. yes, literally two blocks of memory, byte by byte, no drama (except the drama you're inherently creating by asserting things ✨).

for example, to expect that the first three bytes of foo is equal to the first three bytes of bar, you can use the expectation

KUNIT_EXPECT_MEMEQ(test, foo, bar, 3);

the way that 3 just... says "first three bytes, bestie" 😭 it ate and left no crumbs πŸ‘‘


🌈 SEE ALSO 🌈

  • Kernel file ./include/kunit/assert.h
  • enum kunit_assert_type(9)
  • struct kunit_loc(9)
  • struct kunit_assert(9)
  • struct kunit_fail_assert(9)
  • struct kunit_unary_assert(9)
  • struct kunit_ptr_not_err_assert(9)
  • struct kunit_binary_assert_text(9)
  • struct kunit_binary_assert(9)
  • struct kunit_binary_ptr_assert(9)
  • struct kunit_binary_str_assert(9)

and that's the whole page, bestie 🫢 go forth and compare those memory blocks, iykyk.

πŸ’– that's a wrap πŸ’– β€” brought to you fresh from the source tree at ./include/kunit, dated October 2026, manual page struct kunit_mem_assert(9). slay πŸŽ€βœ¨

πŸ“¦ where this page comes from