Skip to content
Snippets Groups Projects
Commit 8d61d4f9 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

Fix tests after SSEGraph changes

parent 0729c2c9
No related tags found
No related merge requests found
...@@ -3,11 +3,13 @@ module Compare.PreprocessSpec (spec) where ...@@ -3,11 +3,13 @@ module Compare.PreprocessSpec (spec) where
import Test.Hspec import Test.Hspec
import qualified Data.Graph.Inductive.Graph as G
import Lens.Micro import Lens.Micro
import Compare.Preprocess import Compare.Preprocess
import Compare.Types import Compare.Types
import Compare.Types.Lenses import Compare.Types.Lenses
import Compare.SSEGraph
spec :: Spec spec :: Spec
spec = do spec = do
...@@ -18,31 +20,32 @@ spec = do ...@@ -18,31 +20,32 @@ spec = do
renameStartOSSpec :: Spec renameStartOSSpec :: Spec
renameStartOSSpec = do renameStartOSSpec = do
it "does nothing for a graph without StartOS label" $ it "does nothing for a graph without StartOS label" $
let g = mkGraph ["a", "b"] [("a", "b", "edge")] "a" let g = mkGraph ["a", "b"] [("a", "b", "edge/Foo")] "a"
in preprocess g `shouldBe` g in preprocess (g & edges %~ SSEEdgeLabel) `shouldBe` g
it "renames the StartOS label" $ it "renames the StartOS label" $
let g1 = mkGraph ["a", "b"] [("a", "b", "ABB13/StartOS")] "a" let g1 = mkGraph ["a", "b"] [("a", "b", "ABB13/StartOS")] "a"
g2 = mkGraph ["a", "b"] [("a", "b", "StartOS")] "a" g2 = mkGraph ["a", "b"] [("a", "b", "StartOS")] "a"
in preprocess g1 `shouldBe` g2 in preprocess (g1 & edges %~ SSEEdgeLabel) `shouldBe` g2
renameIdleSpec :: Spec renameIdleSpec :: Spec
renameIdleSpec = do renameIdleSpec = do
it "does nothing for a graph without StartOS label" $ it "does nothing for a graph without StartOS label" $
let g = mkGraph ["a", "b"] [("a", "b", "edge")] "a" let g = mkGraph ["a", "b"] [("a", "b", "edge/Foo")] "a"
in preprocess g `shouldBe` g in preprocess (g & edges %~ SSEEdgeLabel) `shouldBe` g
it "renames the idle loop edge label" $ it "renames the idle loop edge label" $
let g1 = mkGraph ["a", "b"] [("a", "b", "ABB25/Idle")] "a" let g1 = mkGraph ["a", "b"] [("a", "b", "ABB25/Idle")] "a"
g2 = mkGraph ["a", "b"] [("a", "b", "Idle")] "a" g2 = mkGraph ["a", "b"] [("a", "b", "Idle")] "a"
in preprocess g1 `shouldBe` g2 in preprocess (g1 & edges %~ SSEEdgeLabel) `shouldBe` g2
renameIdleKickoffSpec :: Spec renameIdleKickoffSpec :: Spec
renameIdleKickoffSpec = renameIdleKickoffSpec =
it "renames the kickoff label to the idle thread" $ it "renames the kickoff label to the idle thread" $
let g1 = mkGraph ["PreIdle", "Idle"] [ ("PreIdle", "Idle", "ABB42/kickoff") let g1 = mkGraph ["PreIdle", "Idle"] [ ("PreIdle", "Idle", "ABB42/kickoff")
, ("Idle", "Idle", "Idle") -- self loop , ("Idle", "Idle", "ABB5/Idle") -- self loop
] ]
"PreIdle" "PreIdle"
g2 = g1 & edges . filtered (=="ABB42/kickoff") .~ "IdleKickoff" g2 = g1 & edges . filtered (=="ABB42/kickoff") .~ "IdleKickoff"
in preprocess g1 `shouldBe` g2 & edges . filtered (=="ABB5/Idle") .~ "Idle"
in preprocess (g1 & _graph %~ G.emap SSEEdgeLabel) `shouldBe` g2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment