add a test for extracting symbols from a dynhost

This commit is contained in:
Folkert 2022-08-26 19:24:56 +02:00
parent c4d25e0180
commit 0238471241
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -2869,3 +2869,38 @@ fn load_structs_inplace_mut<T>(bytes: &mut [u8], offset: usize, count: usize) ->
assert!(tail.is_empty(), "End of data was not aligned");
body
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn collect_symbols() {
let data: &[u8] = include_bytes!("../dynhost_benchmarks_elf64") as &[_];
let object = object::File::parse(data).unwrap();
let symbols = collect_roc_definitions(&object);
let mut keys = symbols.keys().collect::<Vec<_>>();
keys.sort_unstable();
assert_eq!(
[
"memcpy",
"memset",
"roc_alloc",
"roc_dealloc",
"roc_fx_getInt",
"roc_fx_getInt_help",
"roc_fx_putInt",
"roc_fx_putLine",
"roc_memcpy",
"roc_memset",
"roc_panic",
"roc_realloc"
],
keys.as_slice(),
)
}
}