Skip to content

Commit

Permalink
test: Add currently failing stack underflow tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Mar 31, 2020
1 parent 45a0389 commit d92c244
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions test/unittests/validation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,62 @@ TEST(validation, stack_underflow)
from_hex("0061736d0100000001070160027f7f017f030201000a0a010800200020016a6a0b");
EXPECT_THROW_MESSAGE(parse(wasm), validation_error, "stack underflow");
}

TEST(validation, DISABLED_stack_underflow_for_call)
{
/* wat2wasm --no-check
(func $f (param i32) (result i32)
get_local 0
)
(func (result i32)
;; Call argument missing.
call $f
)
*/
const auto wasm =
from_hex("0061736d01000000010a0260017f017f6000017f03030200010a0b02040020000b040010000b");
EXPECT_THROW_MESSAGE(parse(wasm), validation_error, "stack underflow");
}

TEST(validation, DISABLED_stack_underflow_for_unreachable)
{
/* wat2wasm
(func (result i32)
unreachable
i32.eqz
)
*/
const auto wasm = from_hex("0061736d010000000105016000017f030201000a0601040000450b");
parse(wasm);
// TODO: Add max stack height check.
}

TEST(validation, DISABLED_stack_underflow_for_br_unreachable)
{
/* wat2wasm
(func
(block
br 0
i32.eqz
drop
)
)
*/
const auto wasm = from_hex("0061736d01000000010401600000030201000a0b01090002400c00451a0b0b");
parse(wasm);
// TODO: Add max stack height check.
}

TEST(validation, DISABLED_stack_underflow_for_return_unreachable)
{
/* wat2wasm
(func
return
i32.eqz
drop
)
*/
const auto wasm = from_hex("0061736d01000000010401600000030201000a070105000f451a0b");
parse(wasm);
// TODO: Add max stack height check.
}

0 comments on commit d92c244

Please sign in to comment.