()
| 572 | // filetest infrastructure. |
| 573 | #[test] |
| 574 | fn sanity() { |
| 575 | let code = "function %test() -> i8 { |
| 576 | block0: |
| 577 | v0 = iconst.i32 1 |
| 578 | v5 = iconst.i32 1 |
| 579 | v1 = iadd v0, v5 |
| 580 | v6 = iconst.i32 44 |
| 581 | v2 = isub v6, v1 ; 44 - 2 == 42 |
| 582 | v4 = iconst.i32 42 |
| 583 | v3 = icmp eq v2, v4 |
| 584 | return v3 |
| 585 | }"; |
| 586 | |
| 587 | let func = parse_functions(code).unwrap().into_iter().next().unwrap(); |
| 588 | let mut env = FunctionStore::default(); |
| 589 | env.add(func.name.to_string(), &func); |
| 590 | let state = InterpreterState::default().with_function_store(env); |
| 591 | let result = Interpreter::new(state).call_by_name("%test", &[]).unwrap(); |
| 592 | |
| 593 | assert_eq!(result, ControlFlow::Return(smallvec![DataValue::I8(1)])); |
| 594 | } |
| 595 | |
| 596 | // We don't have a way to check for traps with the current filetest infrastructure |
| 597 | #[test] |
nothing calls this directly
no test coverage detected