summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-11-30 17:34:58 -0600
committersanine <sanine.not@pm.me>2023-11-30 17:34:58 -0600
commit450ac00012ba57fc70d655c5a8c4fb8eb5e6d5d3 (patch)
tree05a831a4acf2bde010af45c2aa8c7a85f158b179 /test
parent671c632d5c8085a1d14a66e96890555192237be5 (diff)
begin implementing lattice proposal list merging
Diffstat (limited to 'test')
-rw-r--r--test/WorldTypesTest.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/WorldTypesTest.hs b/test/WorldTypesTest.hs
index 3c48c4e..f1822fc 100644
--- a/test/WorldTypesTest.hs
+++ b/test/WorldTypesTest.hs
@@ -8,6 +8,7 @@ import World.Types
, Compatible (..)
, Pos
, LatticeProposal (..)
+ , LatticePropList (..)
, AgentProposal (..)
, Proposal (..)
)
@@ -75,4 +76,16 @@ latticePropTests = testGroup "lattice proposal tests" $
LatticeProposal (0, 0) (Just 2) (Just 4) (Just $ MockMerge 4) @?= merge
(LatticeProposal (0, 0) (Just 2) Nothing Nothing)
(LatticeProposal (0, 0) Nothing (Just 4) (Just $ MockMerge 4))
+
+ , testCase "merge lattice proposal lists" $
+ let
+ a = LatticeProposal (0, 0) Nothing (Just 2) (Just $ MockMerge 4) :: LatticeProposal Int MockMerge
+ b = LatticeProposal (1, 0) Nothing (Just 2) (Just $ MockMerge 4) :: LatticeProposal Int MockMerge
+ c = LatticeProposal (0, 0) (Just 3) (Just 2) (Just $ MockMerge 4) :: LatticeProposal Int MockMerge
+ d = LatticeProposal (0, 0) (Just 3) (Just 2) (Just $ MockMerge 5) :: LatticeProposal Int MockMerge
+ in do
+ (LatticePropList [a, b]) @=? merge (LatticePropList [a]) (LatticePropList [b])
+ (LatticePropList [c, b]) @=? merge (LatticePropList [a]) (LatticePropList [b, c])
+ (LatticePropList [c]) @=? merge (LatticePropList [a, b]) (LatticePropList [c, d])
+ (LatticePropList [b, d]) @=? merge (LatticePropList [b]) (LatticePropList [d])
]