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

Unit test for basic forward trampoline calls with simple function signatures. More...

#include "common/double_tap.h"
#include <infix/infix.h>
#include <math.h>
Include dependency graph for 002_simple_calls.c:

Macros

#define DBLTAP_IMPLEMENTATION
 

Functions

int add_ints (int a, int b)
 
float multiply_floats (float a, float b)
 
void do_nothing ()
 
bool is_negative (int val)
 
 subtest ("int(int, int)")
 
 subtest ("float(float, float)")
 
 subtest ("void(void)")
 
 subtest ("Argument Sign-Extension: bool(int)")
 

Variables

 TEST
 

Detailed Description

Unit test for basic forward trampoline calls with simple function signatures.

This test file verifies that the infix library can correctly create and execute forward trampolines for functions with simple, primitive arguments and return types. It covers:

  • int(int, int): Basic integer arithmetic.
  • float(float, float): Basic floating-point arithmetic.
  • void(void): Functions with no arguments or return value.
  • bool(int): A test to specifically verify correct sign-extension of integer arguments that are smaller than a full register.

For each signature, it tests both bound and unbound trampolines to ensure both creation paths and calling conventions are working correctly.

Macro Definition Documentation

◆ DBLTAP_IMPLEMENTATION

#define DBLTAP_IMPLEMENTATION

Function Documentation

◆ add_ints()

int add_ints ( int  a,
int  b 
)

◆ do_nothing()

void do_nothing ( )

◆ is_negative()

bool is_negative ( int  val)

◆ multiply_floats()

float multiply_floats ( float  a,
float  b 
)

◆ subtest() [1/4]

subtest ( "Argument Sign-Extension: bool(int)"  )

◆ subtest() [2/4]

subtest ( "float(float, float)"  )

◆ subtest() [3/4]

subtest ( "int(int, int)"  )

◆ subtest() [4/4]

subtest ( "void(void)"  )

Variable Documentation

◆ TEST

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