MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / test_table_init

Function test_table_init

crates/tinywasm/src/store/table.rs:243–259  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

241
242 #[test]
243 fn test_table_init() {
244 let kind = dummy_table_type();
245 let mut table_instance = TableInstance::new(kind);
246
247 let init_elements = vec![TableElement::Initialized(0); 5];
248 let result = table_instance.init(0, &init_elements);
249
250 assert!(result.is_ok(), "Initializing table with elements failed");
251
252 for i in 0..5 {
253 let elem = table_instance.get(i);
254 assert!(
255 elem.is_ok() && matches!(elem.unwrap(), &TableElement::Initialized(_)),
256 "Element not initialized correctly at index {i}"
257 );
258 }
259 }
260}

Callers

nothing calls this directly

Calls 3

dummy_table_typeFunction · 0.85
initMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected