syntax support for ref.ops and pass ref_null.wast

This commit is contained in:
Ilya Rezvov
2022-01-30 16:21:22 -07:00
parent 99532adb63
commit 960acac955
6 changed files with 67 additions and 2 deletions
+4
View File
@@ -122,6 +122,8 @@ runScript onAssertFail script = do
asArg [Struct.F32Const v] = Interpreter.VF32 v
asArg [Struct.I64Const v] = Interpreter.VI64 v
asArg [Struct.F64Const v] = Interpreter.VF64 v
asArg [Struct.RefNull Struct.FuncRef] = Interpreter.RF Nothing
asArg [Struct.RefNull Struct.ExternRef] = Interpreter.RE Nothing
asArg _ = error "Only const instructions supported as arguments for actions"
runAction :: ScriptState -> Action -> IO (Maybe [Interpreter.Value])
@@ -139,6 +141,8 @@ runScript onAssertFail script = do
isValueEqual (Interpreter.VI64 v1) (Interpreter.VI64 v2) = v1 == v2
isValueEqual (Interpreter.VF32 v1) (Interpreter.VF32 v2) = (isNaN v1 && isNaN v2) || identicalIEEE v1 v2
isValueEqual (Interpreter.VF64 v1) (Interpreter.VF64 v2) = (isNaN v1 && isNaN v2) || identicalIEEE v1 v2
isValueEqual (Interpreter.RF f1) (Interpreter.RF f2) = f1 == f2
isValueEqual (Interpreter.RE e1) (Interpreter.RE e2) = e1 == e2
isValueEqual _ _ = False
isNaNReturned :: Action -> Assertion -> AssertM ()