blob: 6138ca4fada2edcf721f1de2a7cf8dc5fb44ab92 (
plain)
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
|
(module
(func (export "new") (param $i i32) (result (ref i31))
(ref.i31 (local.get $i))
)
(func (export "get_u") (param $i i32) (result i32)
(i31.get_u (ref.i31 (local.get $i)))
)
(func (export "get_s") (param $i i32) (result i32)
(i31.get_s (ref.i31 (local.get $i)))
)
)
(assert_return (invoke "get_u" (i32.const 0)) (i32.const 0))
(assert_return (invoke "get_u" (i32.const 100)) (i32.const 100))
(assert_return (invoke "get_u" (i32.const -1)) (i32.const 0x7fffffff))
(assert_return (invoke "get_u" (i32.const 0x3fffffff)) (i32.const 0x3fffffff))
(assert_return (invoke "get_u" (i32.const 0x40000000)) (i32.const 0x40000000))
(assert_return (invoke "get_u" (i32.const 0x7fffffff)) (i32.const 0x7fffffff))
(assert_return (invoke "get_u" (i32.const 0xaaaaaaaa)) (i32.const 0x2aaaaaaa))
(assert_return (invoke "get_u" (i32.const 0xcaaaaaaa)) (i32.const 0x4aaaaaaa))
(assert_return (invoke "get_s" (i32.const 0)) (i32.const 0))
(assert_return (invoke "get_s" (i32.const 100)) (i32.const 100))
(assert_return (invoke "get_s" (i32.const -1)) (i32.const -1))
(assert_return (invoke "get_s" (i32.const 0x3fffffff)) (i32.const 0x3fffffff))
(assert_return (invoke "get_s" (i32.const 0x40000000)) (i32.const -0x40000000))
(assert_return (invoke "get_s" (i32.const 0x7fffffff)) (i32.const -1))
(assert_return (invoke "get_s" (i32.const 0xaaaaaaaa)) (i32.const 0x2aaaaaaa))
(assert_return (invoke "get_s" (i32.const 0xcaaaaaaa)) (i32.const 0xcaaaaaaa))
|