From 55a6b482efead066826de897f780ef2b4640e1a0 Mon Sep 17 00:00:00 2001 From: Ilya Rezvov Date: Mon, 19 Feb 2018 18:48:50 -0800 Subject: [PATCH] fix mem arg parsing --- src/Language/Wasm/Binary.hs | 2 +- tests/Test.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Language/Wasm/Binary.hs b/src/Language/Wasm/Binary.hs index c17a863..40ee635 100644 --- a/src/Language/Wasm/Binary.hs +++ b/src/Language/Wasm/Binary.hs @@ -267,7 +267,7 @@ instance Serialize Index where get = Index <$> getULEB128 instance Serialize MemArg where - put (MemArg offset align) = putULEB128 align >> putULEB128 offset + put (MemArg align offset) = putULEB128 align >> putULEB128 offset get = MemArg <$> getULEB128 <*> getULEB128 instance Serialize Instruction where diff --git a/tests/Test.hs b/tests/Test.hs index 2838950..a44c981 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -41,7 +41,7 @@ main = do let Right mod = Parser.parseModule <$> Lexer.scanner content let Right mod' = Binary.decodeModuleLazy $ Binary.dumpModuleLazy mod return $ testCase ("Dump module to binary and parse back: " ++ file) $ - assertBool "Module matched" $ mod == mod' + assertEqual "Module matched" mod mod' defaultMain $ testGroup "tests" [ testGroup "Syntax parsing" syntaxTestCases, testGroup "Binary format" binaryTestCases