Skip to content

Commit 1ef54cc

Browse files
committed
Add test for returning negative ints from wasm
Signed-off-by: Matt Leon <mattleon@google.com>
1 parent 87e4f14 commit 1ef54cc

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

test/arg_passing_test.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ TEST_P(ArgPassingTest, WasmCallReturnsWordValue) {
6464
WasmCallWord<0> test_return_u32;
6565
wasm_->wasm_vm()->getFunction("test_return_u32", &test_return_u32);
6666

67-
EXPECT_EQ(test_return_u32(context_), 3333333333U) << context_->getLog();
67+
EXPECT_EQ(test_return_u32(context_).u32(), 3333333333U) << context_->getLog();
68+
}
69+
70+
TEST_P(ArgPassingTest, WasmCallReturnsNegativeWordValue) {
71+
WasmCallWord<0> test_return_i32;
72+
wasm_->wasm_vm()->getFunction("test_return_i32", &test_return_i32);
73+
74+
EXPECT_EQ(test_return_i32(context_).u32(), -1111111111) << context_->getLog();
6875
}
6976

7077
TEST_P(ArgPassingTest, WasmCallReturnsLongValue) {

test/test_data/arg_passing.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ pub extern "C" fn test_return_u32() -> u32 {
6161
return 3333333333;
6262
}
6363

64+
#[no_mangle]
65+
pub extern "C" fn test_return_i32() -> i32 {
66+
return -1111111111;
67+
}
68+
6469
#[no_mangle]
6570
pub extern "C" fn test_return_u64(_: f32) -> u64 {
6671
return 11111111111111111111;

0 commit comments

Comments
 (0)