aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYann Herklotz Grave <git@yannherklotzgrave.com>2019-02-17 12:37:46 +0000
committerYann Herklotz Grave <git@yannherklotzgrave.com>2019-02-17 12:37:46 +0000
commit928a54419aeac611555b3c15493db00010cbb46e (patch)
tree576f1ca4ba287f03700b9526032126302c0474c1 /test
parent0ea6e208f2c3c41922f8334174fc8e81a21d67f4 (diff)
downloadverismith-928a54419aeac611555b3c15493db00010cbb46e.tar.gz
verismith-928a54419aeac611555b3c15493db00010cbb46e.zip
Indent by 4
Diffstat (limited to 'test')
-rw-r--r--test/Property.hs30
-rw-r--r--test/Unit.hs125
2 files changed, 77 insertions, 78 deletions
diff --git a/test/Property.hs b/test/Property.hs
index 0d1b154..8a32751 100644
--- a/test/Property.hs
+++ b/test/Property.hs
@@ -1,6 +1,6 @@
module Property
- ( propertyTests
- )
+ ( propertyTests
+ )
where
import Data.Either (fromRight, isRight)
@@ -35,35 +35,29 @@ instance QC.Arbitrary AltTestGraph where
simpleGraph :: TestTree
simpleGraph = QC.testProperty "simple graph generation check" $ \graph -> simp graph
- where simp = G.isSimple . getGraph
+ where simp = G.isSimple . getGraph
simpleAltGraph :: TestTree
simpleAltGraph = QC.testProperty "simple alternative graph generation check" $ \graph -> simp graph
- where simp = G.isSimple . getAltGraph
+ where simp = G.isSimple . getAltGraph
parserInput' :: ModDeclSub -> Bool
-parserInput' (ModDeclSub v) =
- isRight $ parse parseModDecl "input_test.v" str
- where
- str = show . GenVerilog $ v
+parserInput' (ModDeclSub v) = isRight $ parse parseModDecl "input_test.v" str
+ where str = show . GenVerilog $ v
parserIdempotent' :: ModDeclSub -> QC.Property
-parserIdempotent' (ModDeclSub v) =
- p sv === (p . p) sv
+parserIdempotent' (ModDeclSub v) = p sv === (p . p) sv
where
vshow = show . GenVerilog
sv = vshow v
- p = vshow . fromRight (error "Failed idempotent test")
- . parse parseModDecl "idempotent_test.v"
+ p = vshow . fromRight (error "Failed idempotent test") . parse parseModDecl "idempotent_test.v"
parserInput :: TestTree
-parserInput = QC.testProperty "parser input" $
- parserInput'
+parserInput = QC.testProperty "parser input" $ parserInput'
parserIdempotent :: TestTree
-parserIdempotent = QC.testProperty "parser idempotence" $
- parserIdempotent'
+parserIdempotent = QC.testProperty "parser idempotence" $ parserIdempotent'
propertyTests :: TestTree
-propertyTests = testGroup "Property Tests" [simpleGraph, simpleAltGraph
- , parserInput, parserIdempotent]
+propertyTests =
+ testGroup "Property Tests" [simpleGraph, simpleAltGraph, parserInput, parserIdempotent]
diff --git a/test/Unit.hs b/test/Unit.hs
index 404c899..d911d2f 100644
--- a/test/Unit.hs
+++ b/test/Unit.hs
@@ -1,6 +1,6 @@
module Unit
- ( unitTests
- )
+ ( unitTests
+ )
where
import Control.Lens
@@ -10,75 +10,80 @@ import VeriFuzz
unitTests :: TestTree
unitTests = testGroup
- "Unit tests"
- [ testCase "Transformation of AST" $ assertEqual
- "Successful transformation"
- transformExpectedResult
- (transform trans transformTestData)
- ]
+ "Unit tests"
+ [ testCase "Transformation of AST" $ assertEqual "Successful transformation"
+ transformExpectedResult
+ (transform trans transformTestData)
+ ]
transformTestData :: Expr
transformTestData = BinOp
- (BinOp (BinOp (Id "id1") BinAnd (Id "id2")) BinAnd (BinOp (Id "id1") BinAnd (Id "id2")))
- BinAnd
- (BinOp
+ (BinOp (BinOp (Id "id1") BinAnd (Id "id2")) BinAnd (BinOp (Id "id1") BinAnd (Id "id2")))
+ BinAnd
(BinOp
- (BinOp (Id "id1") BinAnd (Id "id2"))
- BinAnd
- (BinOp
- (Id "id1")
- BinAnd
- (BinOp (BinOp (Id "id1") BinAnd (Id "id2")) BinAnd (BinOp (Id "id1") BinAnd (Id "id2")))
- )
- )
- BinOr
- (Concat
- [ Concat
- [ Concat [Id "id1", Id "id2", Id "id2"]
- , Id "id2"
- , Id "id2"
- , Concat [Id "id2", Id "id2", Concat [Id "id1", Id "id2"]]
- , Id "id2"
- ]
- , Id "id1"
- , Id "id2"
- ]
+ (BinOp
+ (BinOp (Id "id1") BinAnd (Id "id2"))
+ BinAnd
+ (BinOp
+ (Id "id1")
+ BinAnd
+ (BinOp (BinOp (Id "id1") BinAnd (Id "id2"))
+ BinAnd
+ (BinOp (Id "id1") BinAnd (Id "id2"))
+ )
+ )
+ )
+ BinOr
+ (Concat
+ [ Concat
+ [ Concat [Id "id1", Id "id2", Id "id2"]
+ , Id "id2"
+ , Id "id2"
+ , Concat [Id "id2", Id "id2", Concat [Id "id1", Id "id2"]]
+ , Id "id2"
+ ]
+ , Id "id1"
+ , Id "id2"
+ ]
+ )
)
- )
transformExpectedResult :: Expr
transformExpectedResult = BinOp
- (BinOp (BinOp (Id "id1") BinAnd (Id "Replaced")) BinAnd (BinOp (Id "id1") BinAnd (Id "Replaced")))
- BinAnd
- (BinOp
+ (BinOp (BinOp (Id "id1") BinAnd (Id "Replaced"))
+ BinAnd
+ (BinOp (Id "id1") BinAnd (Id "Replaced"))
+ )
+ BinAnd
(BinOp
- (BinOp (Id "id1") BinAnd (Id "Replaced"))
- BinAnd
- (BinOp
- (Id "id1")
- BinAnd
- (BinOp (BinOp (Id "id1") BinAnd (Id "Replaced"))
- BinAnd
- (BinOp (Id "id1") BinAnd (Id "Replaced"))
+ (BinOp
+ (BinOp (Id "id1") BinAnd (Id "Replaced"))
+ BinAnd
+ (BinOp
+ (Id "id1")
+ BinAnd
+ (BinOp (BinOp (Id "id1") BinAnd (Id "Replaced"))
+ BinAnd
+ (BinOp (Id "id1") BinAnd (Id "Replaced"))
+ )
+ )
+ )
+ BinOr
+ (Concat
+ [ Concat
+ [ Concat [Id "id1", Id "Replaced", Id "Replaced"]
+ , Id "Replaced"
+ , Id "Replaced"
+ , Concat [Id "Replaced", Id "Replaced", Concat [Id "id1", Id "Replaced"]]
+ , Id "Replaced"
+ ]
+ , Id "id1"
+ , Id "Replaced"
+ ]
)
- )
- )
- BinOr
- (Concat
- [ Concat
- [ Concat [Id "id1", Id "Replaced", Id "Replaced"]
- , Id "Replaced"
- , Id "Replaced"
- , Concat [Id "Replaced", Id "Replaced", Concat [Id "id1", Id "Replaced"]]
- , Id "Replaced"
- ]
- , Id "id1"
- , Id "Replaced"
- ]
)
- )
trans :: Expr -> Expr
trans e = case e of
- Id i -> if i == Identifier "id2" then Id $ Identifier "Replaced" else Id i
- _ -> e
+ Id i -> if i == Identifier "id2" then Id $ Identifier "Replaced" else Id i
+ _ -> e