-
Notifications
You must be signed in to change notification settings - Fork 43
Collapse assert_return_canonical_nan and assert_return_arithmetic_nan to assert_return #142
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,7 +377,7 @@ let run_assertion ass = | |
| _ -> Assert.error ass.at "expected instantiation error" | ||
) | ||
|
||
| AssertReturn (act, vs) -> | ||
| AssertReturn (act, vs, modifier) -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I foresee There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There wouldn't be a modifier here. Instead, |
||
trace ("Asserting return..."); | ||
let got_vs = run_action act in | ||
let expect_vs = List.map (fun v -> v.it) vs in | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,15 +11,20 @@ and action' = | |
| Invoke of var option * Ast.name * Ast.literal list | ||
| Get of var option * Ast.name | ||
|
||
type assert_return_comparison = comparison' Source.phrase | ||
and comparison' = | ||
| AssertReturnConstant of Ast.literal list | ||
| AssertReturnArithmeticNan (* TODO f32x4 | f64x2 *) | ||
| AssertReturnCanonicalNan (* TODO f32x4 | f64x2 *) | ||
(* TODO (ref.any) | (ref.func) *) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't seem to find types for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those would be added the reference types proposal. |
||
|
||
type assertion = assertion' Source.phrase | ||
and assertion' = | ||
| AssertMalformed of definition * string | ||
| AssertInvalid of definition * string | ||
| AssertUnlinkable of definition * string | ||
| AssertUninstantiable of definition * string | ||
| AssertReturn of action * Ast.literal list | ||
| AssertReturnCanonicalNaN of action | ||
| AssertReturnArithmeticNaN of action | ||
| AssertReturn of action * assert_return_comparison | ||
| AssertTrap of action * string | ||
| AssertExhaustion of action * string | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -448,11 +448,7 @@ let assertion mode ass = | |
| AssertUninstantiable (def, re) -> | ||
Node ("assert_trap", [definition mode None def; Atom (string re)]) | ||
| AssertReturn (act, lits) -> | ||
Node ("assert_return", action act :: List.map literal lits) | ||
| AssertReturnCanonicalNaN act -> | ||
Node ("assert_return_canonical_nan", [action act]) | ||
| AssertReturnArithmeticNaN act -> | ||
Node ("assert_return_arithmetic_nan", [action act]) | ||
Node ("assert_return", [action act]) (* TODO :: List.map literal lits) *) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will need to handle |
||
| AssertTrap (act, re) -> | ||
Node ("assert_trap", [action act; Atom (string re)]) | ||
| AssertExhaustion (act, re) -> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,7 @@ let inline_type_explicit (c : context) x ft at = | |
%token MODULE BIN QUOTE | ||
%token SCRIPT REGISTER INVOKE GET | ||
%token ASSERT_MALFORMED ASSERT_INVALID ASSERT_SOFT_INVALID ASSERT_UNLINKABLE | ||
%token ASSERT_RETURN ASSERT_RETURN_CANONICAL_NAN ASSERT_RETURN_ARITHMETIC_NAN ASSERT_TRAP ASSERT_EXHAUSTION | ||
%token ASSERT_RETURN CANONICAL_NAN ARITHMETIC_NAN ASSERT_TRAP ASSERT_EXHAUSTION | ||
%token INPUT OUTPUT | ||
%token EOF | ||
|
||
|
@@ -795,12 +795,16 @@ assertion : | |
{ AssertUnlinkable (snd $3, $4) @@ at () } | ||
| LPAR ASSERT_TRAP script_module STRING RPAR | ||
{ AssertUninstantiable (snd $3, $4) @@ at () } | ||
| LPAR ASSERT_RETURN action const_list RPAR { AssertReturn ($3, $4) @@ at () } | ||
| LPAR ASSERT_RETURN_CANONICAL_NAN action RPAR { AssertReturnCanonicalNaN $3 @@ at () } | ||
| LPAR ASSERT_RETURN_ARITHMETIC_NAN action RPAR { AssertReturnArithmeticNaN $3 @@ at () } | ||
| LPAR ASSERT_RETURN action assert_return_modifier RPAR { AssertReturn ($3, $4) @@ at () } | ||
| LPAR ASSERT_TRAP action STRING RPAR { AssertTrap ($3, $4) @@ at () } | ||
| LPAR ASSERT_EXHAUSTION action STRING RPAR { AssertExhaustion ($3, $4) @@ at () } | ||
|
||
assert_return_modifier : | ||
| const_list { AssertReturnConstant ($1) @@ at () } | ||
| LPAR ARITHMETIC_NAN /* TODO f32x4 | f64x2 */ RPAR { AssertReturnArithmeticNan @@ at () } | ||
| LPAR CANONICAL_NAN /* TODO f32x4 | f64x2 */ RPAR { AssertReturnCanonicalNan @@ at () } | ||
/* TODO (ref.any) | (ref.func) */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I be able to implement the branches for |
||
|
||
cmd : | ||
| action { Action $1 @@ at () } | ||
| assertion { Assertion $1 @@ at () } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly sure if I understand what this is for; is it generating JS code? If that is the case, I likely need to match and emit different code for each branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is for generating a JS version of the test.