on master help sign in
all tests pass again
0f030d0AgentM
ProjectM36/RelationalExpression.hs+2−2
@@ -18,7 +18,7 @@ import Data.Char (isUpper)
18import qualified Data.Text as T
18import qualified Data.Text as T
19import qualified Data.Vector as V
19import qualified Data.Vector as V
20import qualified ProjectM36.TypeConstructorDef as TCD
20import qualified ProjectM36.TypeConstructorDef as TCD
21−--import Debug.Trace
21+import Debug.Trace
22
22
23--relvar state is needed in evaluation of relational expression but only as read-only in order to extract current relvar values
23--relvar state is needed in evaluation of relational expression but only as read-only in order to extract current relvar values
24evalRelationalExpr :: RelationalExpr -> DatabaseState (Either RelationalError Relation)
24evalRelationalExpr :: RelationalExpr -> DatabaseState (Either RelationalError Relation)
@@ -528,7 +528,7 @@ evalTupleExpr context attrs (TupleExpr tupMap) = do
528 tConss = typeConstructorMapping context
528 tConss = typeConstructorMapping context
529 finalAttrs = fromMaybe tupAttrs attrs
529 finalAttrs = fromMaybe tupAttrs attrs
530 --verify that the attributes match
530 --verify that the attributes match
531− when (not $ A.attributesEqual finalAttrs tupAttrs) (Left (TupleAttributeTypeMismatchError tupAttrs))
531+ when (A.attributeNameSet finalAttrs /= A.attributeNameSet tupAttrs) (traceShow (finalAttrs,tupAttrs) $ Left (TupleAttributeTypeMismatchError tupAttrs))
532 tup' <- resolveTypesInTuple finalAttrs (reorderTuple finalAttrs tup)
532 tup' <- resolveTypesInTuple finalAttrs (reorderTuple finalAttrs tup)
533 _ <- validateTuple tup' tConss
533 _ <- validateTuple tup' tConss
534 pure tup'
534 pure tup'
ProjectM36/TransactionGraph.hs+1−2
@@ -7,7 +7,6 @@ import ProjectM36.Relation
7import ProjectM36.TupleSet
7import ProjectM36.TupleSet
8import ProjectM36.Tuple
8import ProjectM36.Tuple
9import ProjectM36.DataTypes.Primitive
9import ProjectM36.DataTypes.Primitive
10−import ProjectM36.TransactionGraph.Show.Dot
11import qualified Data.Vector as V
10import qualified Data.Vector as V
12import qualified ProjectM36.Attribute as A
11import qualified ProjectM36.Attribute as A
13import qualified Data.UUID as U
12import qualified Data.UUID as U
@@ -19,7 +18,7 @@ import GHC.Generics
19import Data.Binary
18import Data.Binary
20import ProjectM36.TransactionGraph.Merge
19import ProjectM36.TransactionGraph.Merge
21import Data.Either (lefts, rights, isRight)
20import Data.Either (lefts, rights, isRight)
22−import Debug.Trace
21+--import Debug.Trace
23
22
24--operators which manipulate a transaction graph
23--operators which manipulate a transaction graph
25data TransactionGraphOperator = JumpToHead HeadName |
24data TransactionGraphOperator = JumpToHead HeadName |
ProjectM36/TransactionGraph/Persist.hs+1−1
@@ -138,7 +138,7 @@ writeGraphUUIDFile sync destDirectory (TransactionGraph _ transSet) = writeFileS
138 graphFile = destDirectory </> "m36v1"
138 graphFile = destDirectory </> "m36v1"
139 uuidInfo = intercalate "\n" graphLines
139 uuidInfo = intercalate "\n" graphLines
140 graphLines = S.toList $ S.map graphLine transSet
140 graphLines = S.toList $ S.map graphLine transSet
141− graphLine trans = U.toString (transactionUUID trans) ++ " " ++ intercalate " " (S.toList (S.map U.toString $ transactionParentUUIDs trans))
141+ graphLine trans = U.toString (transactionUUID trans) ++ " " ++ intercalate " " (S.toList (S.map U.toString $ transactionParentIds trans))
142
142
143readGraphUUIDFile :: FilePath -> IO (Either PersistenceError [(U.UUID, [U.UUID])])
143readGraphUUIDFile :: FilePath -> IO (Either PersistenceError [(U.UUID, [U.UUID])])
144readGraphUUIDFile dbdir = do
144readGraphUUIDFile dbdir = do
ProjectM36/Tuple.hs+2−2
@@ -56,7 +56,7 @@ vectorIndicesForAttributeNames attrNameVec attrs = if not $ V.null unknownAttrNa
56 where
56 where
57 unknownAttrNames = V.filter ((flip V.notElem) (attributeNames attrs)) attrNameVec
57 unknownAttrNames = V.filter ((flip V.notElem) (attributeNames attrs)) attrNameVec
58 mapper attrName = case V.elemIndex attrName (V.map attributeName attrs) of
58 mapper attrName = case V.elemIndex attrName (V.map attributeName attrs) of
59− Nothing -> undefined
59+ Nothing -> error "logic failure in vectorIndicesForAttributeNames"
60 Just index -> index
60 Just index -> index
61
61
62relationForAttributeName :: AttributeName -> RelationTuple -> Either RelationalError Relation
62relationForAttributeName :: AttributeName -> RelationTuple -> Either RelationalError Relation
@@ -198,6 +198,6 @@ reorderTuple attrs tupIn = if tupleAttributes tupIn == attrs then
198 RelationTuple attrs (V.map mapper attrs)
198 RelationTuple attrs (V.map mapper attrs)
199 where
199 where
200 mapper attr = case atomForAttributeName (attributeName attr) tupIn of
200 mapper attr = case atomForAttributeName (attributeName attr) tupIn of
201− Left _ -> undefined
201+ Left _ -> error "logic failure in reorderTuple"
202 Right atom -> atom
202 Right atom -> atom
203
203
project-m36.cabal+15
@@ -257,6 +257,7 @@ Executable project-m36-server
257 list-t,
257 list-t,
258 base64-bytestring
258 base64-bytestring
259 Main-Is: ProjectM36/Server/project-m36-server.hs
259 Main-Is: ProjectM36/Server/project-m36-server.hs
260+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
260 GHC-Options: -Wall -threaded -rtsopts
261 GHC-Options: -Wall -threaded -rtsopts
261 GHC-Prof-Options: -fprof-auto -rtsopts -threaded -Wall
262 GHC-Prof-Options: -fprof-auto -rtsopts -threaded -Wall
262 Default-Language: Haskell2010
263 Default-Language: Haskell2010
@@ -345,6 +346,7 @@ Executable bigrel
345 TutorialD.Interpreter.Types
346 TutorialD.Interpreter.Types
346 main-is: benchmark/bigrel.hs
347 main-is: benchmark/bigrel.hs
347 GHC-Options: -Wall -threaded -rtsopts
348 GHC-Options: -Wall -threaded -rtsopts
349+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
348 GHC-Prof-Options: -fprof-auto -rtsopts -threaded -Wall
350 GHC-Prof-Options: -fprof-auto -rtsopts -threaded -Wall
349 if os(windows)
351 if os(windows)
350 Build-Depends: Win32 >= 2.3 && < 2.4
352 Build-Depends: Win32 >= 2.3 && < 2.4
@@ -360,6 +362,7 @@ Test-Suite test-tutoriald
360 main-is: test/TutorialD/Interpreter.hs
362 main-is: test/TutorialD/Interpreter.hs
361 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers, list-t
363 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers, list-t
362 GHC-Options: -Wall
364 GHC-Options: -Wall
365+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
363 if os(windows)
366 if os(windows)
364 Build-Depends: Win32 >= 2.3 && < 2.4
367 Build-Depends: Win32 >= 2.3 && < 2.4
365 Other-Modules: ProjectM36.Win32Handle
368 Other-Modules: ProjectM36.Win32Handle
@@ -374,6 +377,7 @@ Test-Suite test-relation
374 main-is: test/Relation/Basic.hs
377 main-is: test/Relation/Basic.hs
375 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
378 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
376 GHC-Options: -Wall
379 GHC-Options: -Wall
380+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
377
381
378Test-Suite test-static-optimizer
382Test-Suite test-static-optimizer
379 Default-Language: Haskell2010
383 Default-Language: Haskell2010
@@ -381,6 +385,7 @@ Test-Suite test-static-optimizer
381 main-is: test/Relation/StaticOptimizer.hs
385 main-is: test/Relation/StaticOptimizer.hs
382 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
386 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
383 GHC-Options: -Wall
387 GHC-Options: -Wall
388+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
384
389
385Test-Suite test-transactiongraph-persist
390Test-Suite test-transactiongraph-persist
386 Default-Language: Haskell2010
391 Default-Language: Haskell2010
@@ -388,6 +393,7 @@ Test-Suite test-transactiongraph-persist
388 main-is: test/TransactionGraph/Persist.hs
393 main-is: test/TransactionGraph/Persist.hs
389 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
394 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
390 GHC-Options: -Wall
395 GHC-Options: -Wall
396+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
391 if os(windows)
397 if os(windows)
392 Build-Depends: Win32 >= 2.3 && < 2.4
398 Build-Depends: Win32 >= 2.3 && < 2.4
393 Other-Modules: ProjectM36.Win32Handle
399 Other-Modules: ProjectM36.Win32Handle
@@ -402,6 +408,7 @@ Test-Suite test-relation-import-csv
402 main-is: test/Relation/Import/CSV.hs
408 main-is: test/Relation/Import/CSV.hs
403 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
409 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
404 GHC-Options: -Wall
410 GHC-Options: -Wall
411+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
405
412
406Test-Suite test-tutoriald-import-tutoriald
413Test-Suite test-tutoriald-import-tutoriald
407 Default-Language: Haskell2010
414 Default-Language: Haskell2010
@@ -409,6 +416,7 @@ Test-Suite test-tutoriald-import-tutoriald
409 main-is: test/TutorialD/Interpreter/Import/TutorialD.hs
416 main-is: test/TutorialD/Interpreter/Import/TutorialD.hs
410 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
417 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
411 GHC-Options: -Wall
418 GHC-Options: -Wall
419+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
412
420
413Test-Suite test-relation-export-csv
421Test-Suite test-relation-export-csv
414 Default-Language: Haskell2010
422 Default-Language: Haskell2010
@@ -416,6 +424,7 @@ Test-Suite test-relation-export-csv
416 main-is: test/Relation/Export/CSV.hs
424 main-is: test/Relation/Export/CSV.hs
417 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
425 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, stm-containers
418 GHC-Options: -Wall
426 GHC-Options: -Wall
427+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
419
428
420Test-Suite test-persistent-driver
429Test-Suite test-persistent-driver
421 Default-Language: Haskell2010
430 Default-Language: Haskell2010
@@ -423,6 +432,7 @@ Test-Suite test-persistent-driver
423 main-is: test/persistent-driver/test.hs
432 main-is: test/persistent-driver/test.hs
424 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, template-haskell, transformers, aeson, persistent-template, conduit, persistent >= 2.2 && < 2.3, either, path-pieces, http-api-data, stm-containers, list-t
433 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, template-haskell, transformers, aeson, persistent-template, conduit, persistent >= 2.2 && < 2.3, either, path-pieces, http-api-data, stm-containers, list-t
425 GHC-Options: -Wall
434 GHC-Options: -Wall
435+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
426 if os(windows)
436 if os(windows)
427 Build-Depends: Win32 >= 2.3 && < 2.4
437 Build-Depends: Win32 >= 2.3 && < 2.4
428 Other-Modules: ProjectM36.Win32Handle
438 Other-Modules: ProjectM36.Win32Handle
@@ -438,6 +448,7 @@ Test-Suite test-transactiongraph-merge
438 main-is: test/TransactionGraph/Merge.hs
448 main-is: test/TransactionGraph/Merge.hs
439 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, unix, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, template-haskell, transformers, aeson, persistent-template, conduit, persistent, either, path-pieces, http-api-data, stm-containers, list-t
449 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, unix, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, template-haskell, transformers, aeson, persistent-template, conduit, persistent, either, path-pieces, http-api-data, stm-containers, list-t
440 GHC-Options: -Wall
450 GHC-Options: -Wall
451+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
441 C-sources: ProjectM36/DirectoryFsync.c
452 C-sources: ProjectM36/DirectoryFsync.c
442
453
443benchmark bench
454benchmark bench
@@ -446,6 +457,7 @@ benchmark bench
446 main-is: benchmark/Relation.hs
457 main-is: benchmark/Relation.hs
447 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, criterion, stm-containers
458 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, criterion, stm-containers
448 GHC-Options: -Wall -rtsopts
459 GHC-Options: -Wall -rtsopts
460+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
449
461
450Test-Suite test-server
462Test-Suite test-server
451 Default-Language: Haskell2010
463 Default-Language: Haskell2010
@@ -453,6 +465,7 @@ Test-Suite test-server
453 main-is: test/Server/Main.hs
465 main-is: test/Server/Main.hs
454 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t
466 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t
455 GHC-Options: -Wall
467 GHC-Options: -Wall
468+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
456 if os(windows)
469 if os(windows)
457 Build-Depends: Win32 >= 2.3 && < 2.4
470 Build-Depends: Win32 >= 2.3 && < 2.4
458 Other-Modules: ProjectM36.Win32Handle
471 Other-Modules: ProjectM36.Win32Handle
@@ -467,6 +480,7 @@ Executable Example-SimpleClient
467 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t
480 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t
468 Main-Is: examples/SimpleClient.hs
481 Main-Is: examples/SimpleClient.hs
469 GHC-Options: -Wall
482 GHC-Options: -Wall
483+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
470 Other-Modules: ProjectM36.Atom,
484 Other-Modules: ProjectM36.Atom,
471 ProjectM36.AtomFunction,
485 ProjectM36.AtomFunction,
472 ProjectM36.AtomFunctions.Basic,
486 ProjectM36.AtomFunctions.Basic,
@@ -517,6 +531,7 @@ Executable Example-PersistClient
517 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, persistent, aeson, path-pieces, either, conduit, http-api-data, template-haskell, persistent-template
531 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, network-transport-tcp, distributed-process, distributed-process-extras, distributed-process-client-server, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, parsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, persistent, aeson, path-pieces, either, conduit, http-api-data, template-haskell, persistent-template
518 Main-Is: examples/PersistClient.hs
532 Main-Is: examples/PersistClient.hs
519 GHC-Options: -Wall
533 GHC-Options: -Wall
534+ CPP-Options: -DPROJECTM36_VERSION="v0.1"
520 Other-Modules: Database.Persist.ProjectM36,
535 Other-Modules: Database.Persist.ProjectM36,
521 ProjectM36.Atom,
536 ProjectM36.Atom,
522 ProjectM36.AtomFunction,
537 ProjectM36.AtomFunction,
test/TransactionGraph/Merge.hs−1
@@ -176,7 +176,6 @@ testUnionPreferMergeStrategy = TestCase $ do
176 Right (DisconnectedTransaction _ mergeContext, _) -> do
176 Right (DisconnectedTransaction _ mergeContext, _) -> do
177 assertEqual "branchB relvar preferred in conflict" (Just branchBRelVar) (M.lookup conflictRelVarName (relationVariables mergeContext))
177 assertEqual "branchB relvar preferred in conflict" (Just branchBRelVar) (M.lookup conflictRelVarName (relationVariables mergeContext))
178
178
179−
180-- try various individual component conflicts and check for merge failure
179-- try various individual component conflicts and check for merge failure
181testUnionMergeStrategy :: Test
180testUnionMergeStrategy :: Test
182testUnionMergeStrategy = TestCase $ do
181testUnionMergeStrategy = TestCase $ do
test/TutorialD/Interpreter.hs+21−1
@@ -33,7 +33,7 @@ main = do
33 tcounts <- runTestTT (TestList tests)
33 tcounts <- runTestTT (TestList tests)
34 if errors tcounts + failures tcounts > 0 then exitFailure else exitSuccess
34 if errors tcounts + failures tcounts > 0 then exitFailure else exitSuccess
35 where
35 where
36− tests = map (\(tutd, expected) -> TestCase $ assertTutdEqual basicDatabaseContext expected tutd) simpleRelTests ++ map (\(tutd, expected) -> TestCase $ assertTutdEqual dateExamples expected tutd) dateExampleRelTests ++ [transactionGraphBasicTest, transactionGraphAddCommitTest, transactionRollbackTest, transactionJumpTest, transactionBranchTest, simpleJoinTest, testNotification, testTypeConstructors]
36+ tests = map (\(tutd, expected) -> TestCase $ assertTutdEqual basicDatabaseContext expected tutd) simpleRelTests ++ map (\(tutd, expected) -> TestCase $ assertTutdEqual dateExamples expected tutd) dateExampleRelTests ++ [transactionGraphBasicTest, transactionGraphAddCommitTest, transactionRollbackTest, transactionJumpTest, transactionBranchTest, simpleJoinTest, testNotification, testTypeConstructors, testMergeTransactions]
37 simpleRelTests = [("x:=true", Right relationTrue),
37 simpleRelTests = [("x:=true", Right relationTrue),
38 ("x:=false", Right relationFalse),
38 ("x:=false", Right relationFalse),
39 ("x:=true union false", Right relationTrue),
39 ("x:=true union false", Right relationTrue),
@@ -297,3 +297,23 @@ testTypeConstructors = TestCase $ do
297 executeTutorialD sessionId dbconn "data Tree a = Node a (Tree a) (Tree a) | EmptyNode"
297 executeTutorialD sessionId dbconn "data Tree a = Node a (Tree a) (Tree a) | EmptyNode"
298 executeTutorialD sessionId dbconn "y:=relation{a Tree Int}{tuple{a Node 3 (Node 4 EmptyNode EmptyNode) EmptyNode},tuple{a Node 4 EmptyNode EmptyNode}}"
298 executeTutorialD sessionId dbconn "y:=relation{a Tree Int}{tuple{a Node 3 (Node 4 EmptyNode EmptyNode) EmptyNode},tuple{a Node 4 EmptyNode EmptyNode}}"
299
299
300+testMergeTransactions :: Test
301+testMergeTransactions = TestCase $ do
302+ (sessionId, dbconn) <- dateExamplesConnection emptyNotificationCallback
303+ mapM_ (executeTutorialD sessionId dbconn) [
304+ ":branch branchA",
305+ "conflictrv := relation{conflict Int}{tuple{conflict 1}}",
306+ ":commit",
307+ ":jumphead master",
308+ ":branch branchB",
309+ "conflictrv := relation{conflict Int}{tuple{conflict 2}}",
310+ ":commit",
311+ ":mergetrans union branchA branchB"
312+ ]
313+ case mkRelationFromList (attributesFromList [Attribute "conflict" intAtomType]) [[intAtom 1],[intAtom 2]] of
314+ Left err -> assertFailure (show err)
315+ Right conflictCheck -> do
316+ eRv <- executeRelationalExpr sessionId dbconn (RelationVariable "conflictrv")
317+ case eRv of
318+ Left err -> assertFailure (show err)
319+ Right conflictrv -> assertEqual "conflict union merge relvar" conflictCheck conflictrv