diff options
Diffstat (limited to 'test/bun.js/ffi-test.c')
-rw-r--r-- | test/bun.js/ffi-test.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/bun.js/ffi-test.c b/test/bun.js/ffi-test.c index cc87d0528..e508b2c11 100644 --- a/test/bun.js/ffi-test.c +++ b/test/bun.js/ffi-test.c @@ -105,6 +105,19 @@ void *ptr_should_point_to_42_as_int32_t() { return ptr; } +static uint8_t buffer_with_deallocator[128]; +static int deallocatorCalled; +void deallocator(void *ptr, void *userData) { deallocatorCalled++; } +void *getDeallocatorCallback() { + deallocatorCalled = 0; + return &deallocator; +} +void *getDeallocatorBuffer() { + deallocatorCalled = 0; + return &buffer_with_deallocator; +} +int getDeallocatorCalledCount() { return deallocatorCalled; } + bool does_pointer_equal_42_as_int32_t(int32_t *ptr); bool does_pointer_equal_42_as_int32_t(int32_t *ptr) { return *ptr == 42; } |