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

Unit test for the Manual API (infix_type_create_* functions). More...

#include "common/double_tap.h"
#include <infix/infix.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for 003_type_system_api.c:

Classes

struct  TestStruct
 
union  TestUnion
 

Macros

#define DBLTAP_IMPLEMENTATION
 

Typedefs

typedef int64_t TestArray[10]
 

Functions

 subtest ("infix_type_create_struct API validation")
 
 subtest ("infix_type_create_union API validation")
 
 subtest ("infix_type_create_array API validation")
 
 subtest ("infix_type_create_enum API validation")
 
 subtest ("Forward trampoline introspection API")
 

Variables

 TEST
 

Detailed Description

Unit test for the Manual API (infix_type_create_* functions).

This test file validates the correctness of the programmatic type creation API. Its primary goal is to ensure that the infix_type objects created by these functions have a memory layout (size and alignment) that perfectly matches the layout produced by the C compiler for equivalent native types.

It tests:

  • infix_type_create_struct: Verifies standard padding and layout calculation.
  • infix_type_create_union: Verifies size and alignment for unions.
  • infix_type_create_array: Verifies layout for fixed-size arrays.
  • infix_type_create_enum: Verifies that enums have the layout of their underlying type.
  • Introspection API: Checks that functions like infix_forward_get_num_args and infix_forward_get_arg_type return correct information about a created trampoline.

This test is crucial for guaranteeing that the library's internal understanding of C's data layout rules is accurate.

Macro Definition Documentation

◆ DBLTAP_IMPLEMENTATION

#define DBLTAP_IMPLEMENTATION

Typedef Documentation

◆ TestArray

typedef int64_t TestArray[10]

Function Documentation

◆ subtest() [1/5]

subtest ( "Forward trampoline introspection API"  )

◆ subtest() [2/5]

subtest ( "infix_type_create_array API validation"  )

◆ subtest() [3/5]

subtest ( "infix_type_create_enum API validation"  )

◆ subtest() [4/5]

subtest ( "infix_type_create_struct API validation"  )

◆ subtest() [5/5]

subtest ( "infix_type_create_union API validation"  )

Variable Documentation

◆ TEST

TEST
Initial value:
{
plan(5)
#define plan(count)
Definition double_tap.h:163