MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / array_get_in_bounds

Function array_get_in_bounds

tests/all/arrays.rs:232–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

230
231#[test]
232fn array_get_in_bounds() -> Result<()> {
233 let mut store = gc_store()?;
234
235 let array_ty = ArrayType::new(
236 store.engine(),
237 FieldType::new(Mutability::Const, ValType::I32.into()),
238 );
239 let pre = ArrayRefPre::new(&mut store, array_ty);
240
241 let array = ArrayRef::new_fixed(
242 &mut store,
243 &pre,
244 &[Val::I32(11), Val::I32(22), Val::I32(33)],
245 )?;
246
247 assert_eq!(array.get(&mut store, 0)?.unwrap_i32(), 11);
248 assert_eq!(array.get(&mut store, 1)?.unwrap_i32(), 22);
249 assert_eq!(array.get(&mut store, 2)?.unwrap_i32(), 33);
250
251 Ok(())
252}
253
254#[test]
255fn array_get_out_of_bounds() -> Result<()> {

Callers

nothing calls this directly

Calls 4

gc_storeFunction · 0.85
OkFunction · 0.85
newFunction · 0.50
engineMethod · 0.45

Tested by

no test coverage detected