Merge branch 'master' into feature/benchmarks

This commit is contained in:
Mackenzie Clark
2019-02-22 12:14:11 -08:00
committed by GitHub
13 changed files with 637 additions and 22 deletions

View File

@ -306,3 +306,21 @@ impl Clone for SharedMemory {
unimplemented!()
}
}
#[cfg(test)]
mod memory_tests {
use super::{Memory, MemoryDescriptor, Pages};
#[test]
fn test_initial_memory_size() {
let unshared_memory = Memory::new(MemoryDescriptor {
minimum: Pages(10),
maximum: Some(Pages(20)),
shared: false,
})
.unwrap();
assert_eq!(unshared_memory.size(), Pages(10));
}
}

View File

@ -53,10 +53,7 @@ impl AnyfuncTable {
desc: TableDescriptor,
local: &mut vm::LocalTable,
) -> Result<Box<Self>, CreationError> {
let initial_table_backing_len = match desc.maximum {
Some(max) => max,
None => desc.minimum,
} as usize;
let initial_table_backing_len = desc.minimum as usize;
let mut storage = Box::new(AnyfuncTable {
backing: vec![vm::Anyfunc::null(); initial_table_backing_len],

View File

@ -148,3 +148,21 @@ impl fmt::Debug for Table {
.finish()
}
}
#[cfg(test)]
mod table_tests {
use super::{ElementType, Table, TableDescriptor};
#[test]
fn test_initial_table_size() {
let table = Table::new(TableDescriptor {
element: ElementType::Anyfunc,
minimum: 10,
maximum: Some(20),
})
.unwrap();
assert_eq!(table.size(), 10);
}
}

View File

@ -246,6 +246,7 @@ impl_traits!([C] S8, A, B, C, D, E, F, G, H);
impl_traits!([C] S9, A, B, C, D, E, F, G, H, I);
impl_traits!([C] S10, A, B, C, D, E, F, G, H, I, J);
impl_traits!([C] S11, A, B, C, D, E, F, G, H, I, J, K);
impl_traits!([C] S12, A, B, C, D, E, F, G, H, I, J, K, L);
impl<'a, Args, Rets, Safety> IsExport for Func<'a, Args, Rets, Safety>
where