mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
Have test_gen provide roc_alloc etc
This commit is contained in:
parent
18df7fd24f
commit
017ba59775
1 changed files with 21 additions and 0 deletions
|
@ -3,9 +3,30 @@
|
|||
use crate::assert_evals_to;
|
||||
use crate::assert_llvm_evals_to;
|
||||
use crate::helpers::with_larger_debug_stack;
|
||||
use core::ffi::c_void;
|
||||
use indoc::indoc;
|
||||
use roc_std::{RocList, RocStr};
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe fn roc_alloc(_alignment: u32, size: usize) -> *mut c_void {
|
||||
libc::malloc(size)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe fn roc_realloc(
|
||||
_alignment: u32,
|
||||
c_ptr: *mut c_void,
|
||||
_old_size: usize,
|
||||
new_size: usize,
|
||||
) -> *mut c_void {
|
||||
libc::realloc(c_ptr, new_size)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe fn roc_dealloc(_alignment: u32, c_ptr: *mut c_void) {
|
||||
libc::free(c_ptr)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn roc_list_construction() {
|
||||
let list = RocList::from_slice(&[1i64; 23]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue