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

Tests the infix_type_* API functions for correctness and error handling. 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

Tests the infix_type_* API functions for correctness and error handling.

Copyright (c) 2025 Sanko Robinson

This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.

SPDX-License-Identifier: (Artistic-2.0 OR MIT)

The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

SPDX-License-Identifier: CC-BY-4.0

This test suite focuses on the internal consistency of the type system's public API, rather than its use in FFI calls. It ensures that the functions for creating structs, unions, and arrays behave as expected under both normal and exceptional conditions.

The tests verify:

  1. Correctness: That infix_type_create_struct, _union, and _array calculate the size and alignment of types in a way that matches the C compiler's own sizeof and _Alignof operators.
  2. Error Handling: That the creation functions correctly reject invalid arguments (e.g., nullptr pointers for required parameters) and return the appropriate error status.

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:132