()
| 368 | |
| 369 | #[test] |
| 370 | fn table_zeroed() -> Result<()> { |
| 371 | if skip_pooling_allocator_tests() { |
| 372 | return Ok(()); |
| 373 | } |
| 374 | |
| 375 | let pool = crate::small_pool_config(); |
| 376 | let mut config = Config::new(); |
| 377 | config.allocation_strategy(pool); |
| 378 | config.memory_guard_size(0); |
| 379 | config.memory_reservation(1 << 16); |
| 380 | |
| 381 | let engine = Engine::new(&config)?; |
| 382 | |
| 383 | let module = Module::new(&engine, r#"(module (table (export "t") 10 funcref))"#)?; |
| 384 | |
| 385 | // Instantiate the module repeatedly after filling table elements |
| 386 | for _ in 0..10 { |
| 387 | let mut store = Store::new(&engine, ()); |
| 388 | let instance = Instance::new(&mut store, &module, &[])?; |
| 389 | let table = instance.get_table(&mut store, "t").unwrap(); |
| 390 | let f = Func::wrap(&mut store, || {}); |
| 391 | |
| 392 | assert_eq!(table.size(&store), 10); |
| 393 | |
| 394 | for i in 0..10 { |
| 395 | match table.get(&mut store, i).unwrap() { |
| 396 | Ref::Func(r) => assert!(r.is_none()), |
| 397 | _ => panic!("expected a funcref"), |
| 398 | } |
| 399 | table.set(&mut store, i, Ref::Func(Some(f))).unwrap(); |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | Ok(()) |
| 404 | } |
| 405 | |
| 406 | #[test] |
| 407 | fn total_core_instances_limit() -> Result<()> { |
nothing calls this directly
no test coverage detected