Regenerate .travis.yml
[hsc2hs.git] / Spec.hs
1 module Main where
2
3 import Test.Tasty.Hspec
4 import ATTParser
5 import Control.Monad (forM_)
6
7 main :: IO ()
8 main = hspec $ do
9 describe "asm parser" $ do
10 forM_ [("x86_64 linux", "test/asm/x86_64-linux.s")
11 ,("x86_64 macos", "test/asm/x86_64-mac.s")
12 ,("x86_64 mingw", "test/asm/x86_64-mingw32.s")
13 ,("aarch64 ios", "test/asm/aarch64-ios.s")
14 ,("aarch64 linux","test/asm/aarch64.s")]
15 $ \(d, f) ->do
16 context d $ do
17 x <- runIO $ parse f
18
19 it "x should be 1" $ do
20 lookupInteger "x" x `shouldBe` (Just 1)
21 it "z should be 0xffffffffffffffff" $ do
22 lookupInteger "y" x `shouldBe` (Just 0xffffffffffffffff)
23 it "z should be -1" $ do
24 lookupInteger "z" x `shouldBe` (Just (-1))
25
26 it "t should be \"Hello World\\\"\\n\\0\"" $ do
27 lookupString "t" x `shouldBe` (Just "Hello World\" 12345\0")
28
29 forM_ [("arm ios", "test/asm/arm-ios.s")
30 ,("arm linux", "test/asm/arm.s")
31 ,("x86 linux", "test/asm/x86-linux.s")]
32 $ \(d, f) ->do
33 context d $ do
34 x <- runIO $ parse f
35
36 it "x should be 1" $ do
37 lookupInteger "x" x `shouldBe` (Just 1)
38 it "z should be 0xffffffff" $ do
39 lookupInteger "y" x `shouldBe` (Just 0xffffffff)
40 it "z should be -1" $ do
41 lookupInteger "z" x `shouldBe` (Just (-1))
42
43 it "t should be \"Hello World\\\"\\n\\0\"" $ do
44 lookupString "t" x `shouldBe` (Just "Hello World\" 12345\0")
45
46