-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement testing for .bin.wast files * childish implementation of resume with only the default handler * some tests cases for resume --------- Co-authored-by: Guannan Wei <[email protected]> Co-authored-by: butterunderflow <[email protected]>
- Loading branch information
1 parent
9eaad3d
commit 4865eab
Showing
20 changed files
with
3,131 additions
and
2,728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(module definition binary | ||
"\00\61\73\6d\01\00\00\00\01\90\80\80\80\00\04\60" | ||
"\01\7f\01\7f\5d\00\60\01\7f\00\60\00\01\7f\02\96" | ||
"\80\80\80\00\01\08\73\70\65\63\74\65\73\74\09\70" | ||
"\72\69\6e\74\5f\69\33\32\00\02\03\83\80\80\80\00" | ||
"\02\00\03\07\88\80\80\80\00\01\04\6d\61\69\6e\00" | ||
"\02\09\85\80\80\80\00\01\03\00\01\01\0a\9d\80\80" | ||
"\80\00\02\87\80\80\80\00\00\20\00\41\01\6a\0b\8b" | ||
"\80\80\80\00\00\41\0a\d2\01\e0\01\e3\01\00\0b" | ||
) | ||
(module instance) | ||
(assert_return (invoke "main") (i32.const 0xb)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
(module | ||
;; Import only required for printing | ||
(import "spectest" "print_i32" (func $print_i32 (param i32))) | ||
|
||
(func (param i32) (result i32) | ||
local.get 0 | ||
i32.const 1 | ||
i32.add | ||
) | ||
|
||
(elem declare func 1) | ||
|
||
(func (export "main") (result i32) | ||
i32.const 10 | ||
ref.func 1 | ||
cont.new 1 | ||
(resume 1) | ||
) | ||
|
||
(type (;0;) (func (param i32) (result i32))) | ||
(type (;1;) (cont 0)) | ||
|
||
) | ||
|
||
(assert_return (invoke "main") (i32.const 11)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(module | ||
|
||
;; Import only required for printing | ||
(import "spectest" "print_i32" (func $print_i32 (param i32))) | ||
|
||
(func $process (param $x i32) | ||
(call $print_i32 (local.get $x)) | ||
) | ||
|
||
(func $range (param $from i32) (param $to i32) | ||
(local $i i32) | ||
(local.set $i (local.get $from)) | ||
(block $b | ||
(loop $l | ||
(br_if $b (i32.gt_u (local.get $i) (local.get $to))) | ||
(call $process (local.get $i)) | ||
(local.set $i (i32.add (local.get $i) (i32.const 1))) | ||
(br $l)))) | ||
|
||
(type $task (func (param i32))) | ||
(func $run (param $task1 (ref $task)) (param $task2 (ref $task)) | ||
(call_ref $task (i32.const 10) (local.get $task1)) | ||
(call_ref $task (i32.const 20) (local.get $task2))) | ||
|
||
(elem declare func $task1) | ||
(elem declare func $task2) | ||
|
||
(func $task1 (param $x i32) (call $range (local.get $x) (i32.const 13))) | ||
(func $task2 (param $x i32) (call $range (local.get $x) (i32.const 23))) | ||
(func $main (export "_start") | ||
(call $run (ref.func $task1) (ref.func $task2))) | ||
(start $main) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(module binary | ||
"\00\61\73\6d\01\00\00\00\01\8e\80\80\80\00\04\60" | ||
"\00\00\5d\00\60\01\7f\00\60\00\01\7f\02\96\80\80" | ||
"\80\00\01\08\73\70\65\63\74\65\73\74\09\70\72\69" | ||
"\6e\74\5f\69\33\32\00\02\03\83\80\80\80\00\02\00" | ||
"\03\07\88\80\80\80\00\01\04\6d\61\69\6e\00\02\09" | ||
"\85\80\80\80\00\01\03\00\01\01\0a\9e\80\80\80\00" | ||
"\02\88\80\80\80\00\00\41\b2\f2\19\10\00\0b\8b\80" | ||
"\80\80\00\00\d2\01\e0\01\e3\01\00\41\2a\0b" | ||
) | ||
;; (module instance) | ||
(assert_return (invoke "main") (i32.const 0x2a)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(module | ||
(type $f1 (func)) | ||
(type $c1 (cont $f1)) | ||
(import "spectest" "print_i32" (func $print_i32 (param i32))) | ||
(func $empty | ||
i32.const 424242 | ||
call $print_i32 | ||
) | ||
(elem declare func $empty) | ||
(func (export "main") (result i32) | ||
(resume $c1 (cont.new $c1 (ref.func $empty))) | ||
i32.const 42 | ||
) | ||
) | ||
|
||
(assert_return (invoke "main") (i32.const 42)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.