summaryrefslogtreecommitdiff
path: root/test/ctor-eval/basics.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/ctor-eval/basics.wast')
-rw-r--r--test/ctor-eval/basics.wast33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/ctor-eval/basics.wast b/test/ctor-eval/basics.wast
new file mode 100644
index 000000000..a81b2de2f
--- /dev/null
+++ b/test/ctor-eval/basics.wast
@@ -0,0 +1,33 @@
+(module
+ (type $v (func))
+ (memory 256 256)
+ (data (i32.const 10) "waka waka waka waka waka")
+ (table 1 1 anyfunc)
+ (elem (i32.const 0) $call-indirect)
+ (export "test1" $test1)
+ (export "test2" $test2)
+ (export "test3" $test3)
+ (func $test1
+ (drop (i32.const 0)) ;; no work at all, really
+ (call $safe-to-call) ;; safe to call
+ (call_indirect $v (i32.const 0)) ;; safe to call
+ )
+ (func $test2
+ (drop (i32.load (i32.const 12))) ;; a safe load
+ (drop (i32.load16 (i32.const 12)))
+ (drop (i32.load8 (i32.const 12)))
+ )
+ (func $test3
+ (i32.store (i32.const 12) (i32.const 115)) ;; a safe store, should alter memory
+ (i32.store16 (i32.const 20) (i32.const 31353))
+ (i32.store8 (i32.const 23) (i32.const 120))
+ )
+ (func $safe-to-call
+ (drop (i32.const 1))
+ (i32.store8 (i32.const 10) (i32.const 110)) ;; safe write too (lowest possible)
+ (i32.store8 (i32.const 33) (i32.const 109)) ;; safe write too (highest possible)
+ )
+ (func $call-indirect
+ (i32.store8 (i32.const 40) (i32.const 67))
+ )
+)