infix
A JIT-Powered FFI Library for C
|
Tests basic FFI calls with simple function signatures. More...
Macros | |
#define | DBLTAP_IMPLEMENTATION |
Functions | |
int | add_ints (int a, int b) |
A simple function that adds two integers. | |
float | multiply_floats (float a, float b) |
A simple function that multiplies two floats. | |
void | do_nothing () |
A simple function with no arguments or return value. | |
bool | is_negative (int val) |
A function to check if an integer is negative. Used for sign-extension tests. | |
subtest ("int(int, int)") | |
subtest ("float(float, float)") | |
subtest ("void(void)") | |
subtest ("Argument Sign-Extension: bool(int)") | |
Variables | |
TEST | |
Tests basic FFI calls with simple function signatures.
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 verifies the FFI for the most common and fundamental function signatures, ensuring that the library correctly handles basic integer and floating-point arguments, void returns, and proper sign-extension of integer types.
It consolidates several smaller, single-purpose tests into one cohesive file with the following subtests:
int(int, int)
: Verifies multiple integer arguments and an integer return.float(float, float)
: Verifies multiple float arguments and a float return.void(void)
: Verifies calls to functions with no arguments and no return value.bool(int)
: Specifically tests that signed integer arguments are correctly sign-extended across the FFI boundary, a crucial requirement for ABI correctness. #define DBLTAP_IMPLEMENTATION |
int add_ints | ( | int | a, |
int | b | ||
) |
A simple function that adds two integers.
void do_nothing | ( | ) |
A simple function with no arguments or return value.
bool is_negative | ( | int | val | ) |
A function to check if an integer is negative. Used for sign-extension tests.
float multiply_floats | ( | float | a, |
float | b | ||
) |
A simple function that multiplies two floats.
subtest | ( | "Argument Sign-Extension: bool(int)" | ) |
subtest | ( | "float(float, float)" | ) |
subtest | ( | "int(int, int)" | ) |
subtest | ( | "void(void)" | ) |