()
| 202 | |
| 203 | #[test] |
| 204 | fn test_get_wasm_val() { |
| 205 | let kind = dummy_table_type(); |
| 206 | let mut table_instance = TableInstance::new(kind); |
| 207 | |
| 208 | table_instance.set(0, TableElement::Initialized(0)).expect("Setting table element failed"); |
| 209 | table_instance.set(1, TableElement::Uninitialized).expect("Setting table element failed"); |
| 210 | |
| 211 | match table_instance.get_wasm_val(0) { |
| 212 | Ok(WasmValue::RefFunc(_)) => {} |
| 213 | _ => panic!("get_wasm_val failed to return the correct WasmValue"), |
| 214 | } |
| 215 | |
| 216 | match table_instance.get_wasm_val(1) { |
| 217 | Ok(WasmValue::RefFunc(f)) if f.is_null() => {} |
| 218 | _ => panic!("get_wasm_val failed to return the correct WasmValue"), |
| 219 | } |
| 220 | |
| 221 | match table_instance.get_wasm_val(999) { |
| 222 | Err(Trap::TableOutOfBounds { .. }) => {} |
| 223 | _ => panic!("get_wasm_val failed to handle undefined element correctly"), |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | #[test] |
| 228 | fn test_set_and_get() { |
nothing calls this directly
no test coverage detected