| 312 | |
| 313 | #[test] |
| 314 | fn 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] |
| 333 | fn array_set_out_of_bounds() -> Result<()> { |