Basic form of a function call
This commit is contained in:
23
src/tests.rs
23
src/tests.rs
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user