forked from wasmerio/wasmer-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.rs
47 lines (38 loc) · 732 Bytes
/
tests.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#[no_mangle]
pub extern "C" fn sum(x: i32, y: i32) -> i32 {
x + y
}
#[no_mangle]
pub extern "C" fn arity_0() -> i32 {
42
}
#[no_mangle]
pub extern "C" fn i32_i32(x: i32) -> i32 {
x
}
#[no_mangle]
pub extern "C" fn i64_i64(x: i64) -> i64 {
x
}
#[no_mangle]
pub extern "C" fn f32_f32(x: f32) -> f32 {
x
}
#[no_mangle]
pub extern "C" fn f64_f64(x: f64) -> f64 {
x
}
#[no_mangle]
pub extern "C" fn i32_i64_f32_f64_f64(a: i32, b: i64, c: f32, d: f64) -> f64 {
a as f64 + b as f64 + c as f64 + d
}
#[no_mangle]
pub extern "C" fn bool_casted_to_i32() -> bool {
true
}
#[no_mangle]
pub extern "C" fn string() -> *const u8 {
b"Hello, World!\0".as_ptr()
}
#[no_mangle]
pub extern "C" fn void() {}