graph-core 0.2.2.0 → 0.3.0.0
raw patch · 8 files changed
+36/−26 lines, 8 filesdep ~QuickCheckPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck
API changes (from Hackage documentation)
- Data.Core.Graph: src :: Edge -> !Node
- Data.Core.Graph: tgt :: Edge -> !Node
- Data.Core.Graph.NodeManager: instance Arbitrary v => Arbitrary (IntMap v)
- Data.Core.Graph.NodeManager: instance Eq k => Eq (NodeManager k)
- Data.Core.Graph.NodeManager: instance Show k => Show (NodeManager k)
- Data.Core.Graph.Persistence: instance Eq k => Eq (PersistentGraph k)
- Data.Core.Graph.Persistence: instance Show k => Show (PersistentGraph k)
+ Data.Core.Graph: [src] :: Edge -> !Node
+ Data.Core.Graph: [tgt] :: Edge -> !Node
+ Data.Core.Graph.NodeManager: instance GHC.Classes.Eq k => GHC.Classes.Eq (Data.Core.Graph.NodeManager.NodeManager k)
+ Data.Core.Graph.NodeManager: instance GHC.Show.Show k => GHC.Show.Show (Data.Core.Graph.NodeManager.NodeManager k)
+ Data.Core.Graph.Persistence: instance GHC.Classes.Eq k => GHC.Classes.Eq (Data.Core.Graph.Persistence.PersistentGraph k)
+ Data.Core.Graph.Persistence: instance GHC.Show.Show k => GHC.Show.Show (Data.Core.Graph.Persistence.PersistentGraph k)
- Data.Core.Graph.NodeManager: isConsistent :: Ord k => NodeManager k -> Bool
+ Data.Core.Graph.NodeManager: isConsistent :: (Ord k) => NodeManager k -> Bool
Files
- LICENSE +1/−1
- graph-core.cabal +5/−6
- src/Data/Core/Graph/NodeManager.hs +0/−4
- src/Data/Core/Graph/PureCore.hs +0/−11
- src/Test/Arbitrary.hs +23/−0
- src/Test/Core.hs +1/−0
- src/Test/NodeManager.hs +3/−2
- src/Test/Persistence.hs +3/−2
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2014 factis research GmbH+Copyright (c) 2014 - 2016 factis research GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
graph-core.cabal view
@@ -1,5 +1,5 @@ name: graph-core-version: 0.2.2.0+version: 0.3.0.0 synopsis: Fast, memory efficient and persistent graph implementation description: A small package providing a powerful and easy to use Haskell graph implementation. homepage: https://github.com/factisresearch/graph-core@@ -7,7 +7,7 @@ license-file: LICENSE author: Stefan Wehr <wehr@cp-med.com>, David Leuschner <leuschner@cp-med.com>, Niklas Baumstark, Jonathan Dimond, Alexander Thiemann <thiemann@cp-med.com> maintainer: Alexander Thiemann <thiemann@cp-med.com>-copyright: (c) 2014 factis research GmbH+copyright: (c) 2014 - 2016 factis research GmbH category: Data build-type: Simple cabal-version: >=1.8@@ -22,16 +22,15 @@ safe >=0.3, deepseq >=1.3, vector >=0.10,- QuickCheck >=2.6, mtl >=2.1 hs-source-dirs: src- ghc-options: -Wall -fno-warn-orphans+ ghc-options: -Wall test-suite graph-core-tests type: exitcode-stdio-1.0 hs-source-dirs: src main-is: Tests.hs- other-modules: Test.NodeManager, Test.Core, Test.Persistence+ other-modules: Test.NodeManager, Test.Core, Test.Persistence, Test.Arbitrary build-depends: base >=4.6 && <5, hashable >=1.2, unordered-containers >=0.2,@@ -46,4 +45,4 @@ source-repository head type: git- location: git://github.com/factisresearch/graph-core.git+ location: https://github.com/factisresearch/graph-core.git
src/Data/Core/Graph/NodeManager.hs view
@@ -16,7 +16,6 @@ import Control.Monad.State.Strict import Data.Hashable import Data.Maybe-import Test.QuickCheck (NonNegative(..), Arbitrary(..)) import qualified Data.HashMap.Strict as HM import qualified Data.IntMap.Strict as IM import qualified Data.IntSet as IS@@ -110,6 +109,3 @@ unsafeLookupNode :: Node -> NodeManager k -> k unsafeLookupNode i nm = fromJust $ lookupNode i nm--instance Arbitrary v => Arbitrary (IM.IntMap v) where- arbitrary = fmap (IM.fromList . map (\(NonNegative i, x) -> (i, x))) arbitrary
src/Data/Core/Graph/PureCore.hs view
@@ -18,7 +18,6 @@ import Data.Hashable import Data.Maybe import Data.STRef-import Test.QuickCheck import qualified Data.Foldable as F import qualified Data.HashSet as HS import qualified Data.IntMap.Strict as IM@@ -191,13 +190,3 @@ else do newAcc <- f acc x let succs = IM.findWithDefault VU.empty x adj go (IS.insert x visited) newAcc (xs ++ VU.toList succs)--instance Arbitrary Graph where- arbitrary = frequency [(1, return empty), (20, denseGraph)]- where denseGraph =- do n <- choose (0, 30::Int)- let nodeList = [1..n]- adj <- forM nodeList $ \i ->- do bits <- vectorOf n arbitrary- return (i, [ x | (x,b) <- zip nodeList bits, b ])- return $ fromAdj adj
+ src/Test/Arbitrary.hs view
@@ -0,0 +1,23 @@+module Test.Arbitrary where++import Test.QuickCheck+import Control.Monad (forM)+import Data.Core.Graph.NodeManager (NodeMap)+import Data.Core.Graph.PureCore (Graph, empty, fromAdj)+import qualified Data.IntMap.Strict as IM+++newtype TestNodeMap v = TestNodeMap(NodeMap v) deriving Show++instance Arbitrary v => Arbitrary (TestNodeMap v) where+ arbitrary = fmap (TestNodeMap . IM.fromList . map (\(NonNegative i, x) -> (i, x))) arbitrary++instance Arbitrary Graph where+ arbitrary = frequency [(1, return empty), (20, denseGraph)]+ where denseGraph =+ do n <- choose (0, 30::Int)+ let nodeList = [1..n]+ adj <- forM nodeList $ \i ->+ do bits <- vectorOf n arbitrary+ return (i, [ x | (x,b) <- zip nodeList bits, b ])+ return $ fromAdj adj
src/Test/Core.hs view
@@ -5,6 +5,7 @@ import Data.Core.Graph.NodeManager (Node) import Control.Monad+import Test.Arbitrary () import Test.Framework import qualified Data.IntSet as IS
src/Test/NodeManager.hs view
@@ -3,6 +3,7 @@ import Data.Core.Graph.NodeManager +import Test.Arbitrary import Test.Framework import Control.Monad.State.Strict import qualified Data.IntMap.Strict as IM@@ -11,8 +12,8 @@ assertConsistent :: StateT (NodeManager Char) IO () assertConsistent = get >>= liftIO . assertEqual True . isConsistent -prop_init :: NodeMap String -> Property-prop_init m = uniqueValues m && all (>=0) (IM.keys m)+prop_init :: TestNodeMap String -> Property+prop_init (TestNodeMap m) = uniqueValues m && all (>=0) (IM.keys m) ==> isConsistent new && m == getNodeMap new where new = initNodeManager m uniqueValues im = IM.size im == length (L.nub $ IM.elems im)
src/Test/Persistence.hs view
@@ -5,10 +5,11 @@ import Data.Core.Graph.NodeManager import Data.Core.Graph.Persistence +import Test.Arbitrary import Test.Framework -prop_persistence :: NodeMap Char -> Graph -> Bool-prop_persistence nodeMap graph =+prop_persistence :: TestNodeMap Char -> Graph -> Bool+prop_persistence (TestNodeMap nodeMap) graph = let nodeMgr = initNodeManager nodeMap (nodeMgr', graph') = loadGraph (persistGraph nodeMgr graph) in (nodeMgr' == nodeMgr && graph == graph')