infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
305_bitfields_reverse.c File Reference

Unit test for receiving bitfield structs in reverse trampolines (callbacks). More...

#include "common/compat_c23.h"
#include "common/double_tap.h"
#include <infix/infix.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for 305_bitfields_reverse.c:

Classes

struct  SmallBF
 
struct  LargeBF
 

Macros

#define DBLTAP_IMPLEMENTATION
 

Typedefs

typedef void(* small_bf_fn) (SmallBF)
 
typedef void(* large_bf_fn) (LargeBF)
 

Functions

void small_bf_handler (SmallBF bf)
 
void large_bf_handler (LargeBF bf)
 
 subtest ("Small bitfield (1 byte) in callback")
 
 subtest ("Large bitfield (4 bytes) in callback")
 
 infix_arena_destroy (arena)
 

Variables

static int g_callback_called = 0
 
static uint8_t g_received_a = 0
 
static uint8_t g_received_b = 0
 
static int g_large_called = 0
 
static uint32_t g_received_x = 0
 
static uint32_t g_received_y = 0
 
static uint32_t g_received_z = 0
 
 TEST
 
infix_arena_tarena = infix_arena_create(4096)
 

Detailed Description

Unit test for receiving bitfield structs in reverse trampolines (callbacks).

Macro Definition Documentation

◆ DBLTAP_IMPLEMENTATION

#define DBLTAP_IMPLEMENTATION

Typedef Documentation

◆ large_bf_fn

typedef void(* large_bf_fn) (LargeBF)

◆ small_bf_fn

typedef void(* small_bf_fn) (SmallBF)

Function Documentation

◆ infix_arena_destroy()

infix_arena_destroy ( arena  )

◆ large_bf_handler()

void large_bf_handler ( LargeBF  bf)

◆ small_bf_handler()

void small_bf_handler ( SmallBF  bf)

◆ subtest() [1/2]

subtest ( "Large bitfield (4 bytes) in callback"  )

◆ subtest() [2/2]

subtest ( "Small bitfield (1 byte) in callback"  )

Variable Documentation

◆ arena

◆ g_callback_called

int g_callback_called = 0
static

◆ g_large_called

int g_large_called = 0
static

◆ g_received_a

uint8_t g_received_a = 0
static

◆ g_received_b

uint8_t g_received_b = 0
static

◆ g_received_x

uint32_t g_received_x = 0
static

◆ g_received_y

uint32_t g_received_y = 0
static

◆ g_received_z

uint32_t g_received_z = 0
static

◆ TEST

TEST
Initial value:
{
plan(2)
#define plan(count)
Definition double_tap.h:192