on master help sign in
fix hlint complaint
fe6bcd5AgentM
test/TransactionGraph/Persist.hs+6−2
@@ -16,6 +16,7 @@ import TutorialD.Interpreter.DatabaseContextExpr
16import qualified Data.Map as M
16import qualified Data.Map as M
17import qualified Data.Set as S
17import qualified Data.Set as S
18import Data.Time.Clock
18import Data.Time.Clock
19+import Data.Time.Calendar
19
20
20main :: IO ()
21main :: IO ()
21main = do
22main = do
@@ -27,12 +28,15 @@ testList = TestList [testBootstrapDB,
27 testDBSimplePersistence,
28 testDBSimplePersistence,
28 testFunctionPersistence]
29 testFunctionPersistence]
29
30
31+stamp :: UTCTime
32+stamp = UTCTime (fromGregorian 1980 01 01) (secondsToDiffTime 1000)
33+
30{- bootstrap a database, ensure that it can be read -}
34{- bootstrap a database, ensure that it can be read -}
31testBootstrapDB :: Test
35testBootstrapDB :: Test
32testBootstrapDB = TestCase $ withSystemTempDirectory "m36testdb" $ \tempdir -> do
36testBootstrapDB = TestCase $ withSystemTempDirectory "m36testdb" $ \tempdir -> do
33 let dbdir = tempdir </> "dbdir"
37 let dbdir = tempdir </> "dbdir"
34 freshId <- nextRandom
38 freshId <- nextRandom
35− stamp <- getCurrentTime
39+
36 _ <- bootstrapDatabaseDir NoDiskSync dbdir (bootstrapTransactionGraph stamp freshId dateExamples)
40 _ <- bootstrapDatabaseDir NoDiskSync dbdir (bootstrapTransactionGraph stamp freshId dateExamples)
37 loadedGraph <- transactionGraphLoad dbdir emptyTransactionGraph Nothing
41 loadedGraph <- transactionGraphLoad dbdir emptyTransactionGraph Nothing
38 assertBool "transactionGraphLoad" $ isRight loadedGraph
42 assertBool "transactionGraphLoad" $ isRight loadedGraph
@@ -42,7 +46,7 @@ testDBSimplePersistence :: Test
42testDBSimplePersistence = TestCase $ withSystemTempDirectory "m36testdb" $ \tempdir -> do
46testDBSimplePersistence = TestCase $ withSystemTempDirectory "m36testdb" $ \tempdir -> do
43 let dbdir = tempdir </> "dbdir"
47 let dbdir = tempdir </> "dbdir"
44 freshId <- nextRandom
48 freshId <- nextRandom
45− stamp <- getCurrentTime
49+
46 let graph = bootstrapTransactionGraph stamp freshId dateExamples
50 let graph = bootstrapTransactionGraph stamp freshId dateExamples
47 _ <- bootstrapDatabaseDir NoDiskSync dbdir graph
51 _ <- bootstrapDatabaseDir NoDiskSync dbdir graph
48 case transactionForHead "master" graph of
52 case transactionForHead "master" graph of