From 450ac00012ba57fc70d655c5a8c4fb8eb5e6d5d3 Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 30 Nov 2023 17:34:58 -0600 Subject: begin implementing lattice proposal list merging --- test/WorldTypesTest.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') 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]) ] -- cgit v1.2.1