|
| bool | passthrough_bool (bool v) |
| |
| uint8_t | passthrough_uint8 (uint8_t v) |
| |
| int8_t | passthrough_sint8 (int8_t v) |
| |
| uint16_t | passthrough_uint16 (uint16_t v) |
| |
| int16_t | passthrough_sint16 (int16_t v) |
| |
| uint32_t | passthrough_uint32 (uint32_t v) |
| |
| int32_t | passthrough_sint32 (int32_t v) |
| |
| uint64_t | passthrough_uint64 (uint64_t v) |
| |
| int64_t | passthrough_sint64 (int64_t v) |
| |
| float | passthrough_float (float v) |
| |
| double | passthrough_double (double v) |
| |
| long double | passthrough_long_double (long double v) |
| |
| __uint128_t | passthrough_uint128 (__uint128_t v) |
| |
| __int128_t | passthrough_sint128 (__int128_t v) |
| |
| | TEST_PRIMITIVE ("bool", bool, INFIX_PRIMITIVE_BOOL, passthrough_bool, true, "%d") |
| |
| | TEST_PRIMITIVE ("uint8_t", uint8_t, INFIX_PRIMITIVE_UINT8, passthrough_uint8, 255, "%u") |
| |
| | TEST_PRIMITIVE ("int8_t", int8_t, INFIX_PRIMITIVE_SINT8, passthrough_sint8, -128, "%d") |
| |
| | TEST_PRIMITIVE ("uint16_t", uint16_t, INFIX_PRIMITIVE_UINT16, passthrough_uint16, 65535, "%u") |
| |
| | TEST_PRIMITIVE ("int16_t", int16_t, INFIX_PRIMITIVE_SINT16, passthrough_sint16, -32768, "%d") |
| |
| | TEST_PRIMITIVE ("uint32_t", uint32_t, INFIX_PRIMITIVE_UINT32, passthrough_uint32, 0xFFFFFFFF, "%u") |
| |
| | TEST_PRIMITIVE ("int32_t", int32_t, INFIX_PRIMITIVE_SINT32, passthrough_sint32, -2147483647 - 1, "%d") |
| |
| | TEST_PRIMITIVE ("uint64_t", uint64_t, INFIX_PRIMITIVE_UINT64, passthrough_uint64, 0xFFFFFFFFFFFFFFFF, "%" PRIu64) |
| |
| | TEST_PRIMITIVE ("int64_t", int64_t, INFIX_PRIMITIVE_SINT64, passthrough_sint64, -9223372036854775807LL - 1, "%" PRId64) |
| |
| | TEST_PRIMITIVE ("float", float, INFIX_PRIMITIVE_FLOAT, passthrough_float, 3.14159f, "%f") |
| |
| | TEST_PRIMITIVE ("double", double, INFIX_PRIMITIVE_DOUBLE, passthrough_double, 2.718281828459045, "%f") |
| |
| | subtest ("long double") |
| |
| | subtest ("__uint128_t") |
| |
| | subtest ("__int128_t") |
| |
Unit test for creating trampolines for functions with primitive C types.
This test file verifies the core functionality of the infix library for the most fundamental C types (integers, floats, bool). It is a critical "smoke test" that ensures the basic JIT compilation pipeline is working correctly for each supported platform ABI.
The test covers the following for each primitive type:
- **
infix_forward_create_unbound_manual**: Creation of an unbound trampoline.
- **
infix_forward_create_manual**: Creation of a bound trampoline.
- Calling: Correctly calling both unbound and bound trampolines.
- Argument Passing: Verifying that the primitive argument is passed correctly to the target C function.
- Return Value: Verifying that the primitive return value is correctly received from the target C function.
It uses a "passthrough" C function for each type (e.g., passthrough_int32) that simply returns its argument, allowing for a straightforward check of whether the value was transmitted correctly through the FFI boundary.