summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-12-08 14:21:19 -0600
committersanine <sanine.not@pm.me>2023-12-08 14:21:19 -0600
commitb2a8a61b287d232db8dcbb78c9e4a88ab7b8c2a7 (patch)
tree85dc1013f3d1ad79dca583f3733883a17019559e /test
parent15a0b3d4658faced5e5e09c582f4c22365b31ad7 (diff)
prevent applying invalid proposalsrefactor-haskell
Diffstat (limited to 'test')
-rw-r--r--test/LatticeTest.hs16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/LatticeTest.hs b/test/LatticeTest.hs
index 9edff30..40c0a85 100644
--- a/test/LatticeTest.hs
+++ b/test/LatticeTest.hs
@@ -94,7 +94,7 @@ proposalApplication = testGroup "apply proposal lists to lattices" $
in
lattice' @?= [
[ LatticeCell Plant (Just False)
- , LatticeCell Plant (Just True)
+ , LatticeCell Plant Nothing -- reset by the application process
, LatticeCell Plant (Just True)
]
]
@@ -113,5 +113,19 @@ proposalApplication = testGroup "apply proposal lists to lattices" $
[ LatticeCell Plant (MergeInt $ 0-6)
]
]
+ , testCase "invalid proposals are not applied" $
+ let
+ plant = LatticeCell Plant Nothing
+ empty = LatticeCell Empty Nothing
+ lattice = [[ empty, plant, empty ]]
+ proposals :: LatticePropList GrowKind (Maybe Bool)
+ proposals = LatticePropList
+ [ LatticeProposal (0, 0) Plant Plant Nothing
+ , LatticeProposal (1, 0) Plant Empty Nothing
+ , LatticeProposal (2, 0) Empty Plant Nothing
+ ]
+ lattice' = applyLatticeProposals lattice proposals
+ in
+ lattice' @?= [[ empty, empty, plant ]]
]