mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
ec4248cbb4
27 [-Wunused-matches] 7 [-Wmissing-export-lists] 6 [-Wunused-imports] 5 [-Wmissing-signatures] 2 [-Wincomplete-uni-patterns] 1 [-Wunused-top-binds] 1 [-Wtype-defaults]
21 lines
745 B
Haskell
21 lines
745 B
Haskell
{-# LANGUAGE PackageImports #-}
|
|
|
|
module Data.Graph.Spec (spec) where
|
|
|
|
import SpecHelpers
|
|
|
|
import "semantic" Data.Graph
|
|
import qualified Algebra.Graph.Class as Class
|
|
|
|
spec :: Spec
|
|
spec = describe "Data.Graph" $
|
|
it "has a valid topological sort" $ do
|
|
let topo = topologicalSort
|
|
topo (Class.path "ab") `shouldBe` "ba"
|
|
topo (Class.path "abc") `shouldBe` "cba"
|
|
topo ((vertex 'a' `connect` vertex 'b') `connect` vertex 'c') `shouldBe` "cba"
|
|
topo (vertex 'a' `connect` (vertex 'b' `connect` vertex 'c')) `shouldBe` "cba"
|
|
topo ((vertex 'a' `connect` vertex 'b') <> (vertex 'a' `connect` vertex 'c')) `shouldBe` "cba"
|
|
topo (Class.path "abd" <> Class.path "acd") `shouldBe` "dcba"
|
|
topo (Class.path "aba") `shouldBe` "ab"
|