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

Function array_set_in_bounds

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

Source from the content-addressed store, hash-verified

312
313#[test]
314fn array_set_in_bounds() -> Result<()> {
315 let mut store = gc_store()?;
316
317 let array_ty = ArrayType::new(
318 store.engine(),
319 FieldType::new(Mutability::Var, ValType::I32.into()),
320 );
321 let pre = ArrayRefPre::new(&mut store, array_ty);
322
323 let array = ArrayRef::new_fixed(&mut store, &pre, &[Val::I32(11)])?;
324
325 assert_eq!(array.get(&mut store, 0)?.unwrap_i32(), 11);
326 array.set(&mut store, 0, Val::I32(22))?;
327 assert_eq!(array.get(&mut store, 0)?.unwrap_i32(), 22);
328
329 Ok(())
330}
331
332#[test]
333fn array_set_out_of_bounds() -> Result<()> {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected