Basic form of a function call

This commit is contained in:
Sergey Pepyakin
2018-12-07 19:16:32 +01:00
parent 5eb43f027a
commit 078486e080
5 changed files with 89 additions and 60 deletions

View File

@@ -20,11 +20,7 @@ fn empty() {
#[test]
fn adds() {
const CASES: &[(usize, usize, usize)] = &[
(5, 3, 8),
(0, 228, 228),
(usize::max_value(), 1, 0),
];
const CASES: &[(usize, usize, usize)] = &[(5, 3, 8), (0, 228, 228), (usize::max_value(), 1, 0)];
let code = r#"
(module
@@ -110,4 +106,21 @@ fn if_without_result() {
assert_eq!(execute_wat(code, 2, 3), 2);
}
#[test]
fn function_call() {
let code = r#"
(module
(func (param i32) (param i32) (result i32)
(call 1)
(get_local 0)
)
(func
)
)
"#;
assert_eq!(execute_wat(code, 2, 3), 2);
}
// TODO: Add a test that checks argument passing via the stack.