File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ setOpTests = testGroup "Set operations"
3737 , mkGroup " invertBits" prop_invertBits
3838
3939 , testProperty " invertInPlace" prop_invertInPlace
40+ , testProperty " invertInPlace around" prop_invertInPlace_around
4041 , testProperty " invertInPlaceWords" prop_invertInPlaceWords
4142 , testProperty " invertInPlace middle" prop_invertInPlace_middle
4243 , testProperty " invertInPlaceLong middle" prop_invertInPlaceLong_middle
@@ -138,6 +139,17 @@ prop_invertInPlace :: U.Vector Bit -> Property
138139prop_invertInPlace xs =
139140 U. map complement xs === U. modify invertInPlace xs
140141
142+ prop_invertInPlace_around :: U. Vector Bit -> Property
143+ prop_invertInPlace_around xs = ioProperty $ do
144+ let l = U. length xs
145+ when (l < 2 ) discard
146+ ys <- U. thaw xs
147+ let zs = MU. slice 1 (l - 2 ) ys
148+ invertInPlace zs
149+ hd <- MU. read ys 0
150+ lst <- MU. read ys (MU. length ys - 1 )
151+ pure $ hd === U. head xs .&&. lst === U. last xs
152+
141153prop_invertInPlaceWords :: Large (U. Vector Bit ) -> Property
142154prop_invertInPlaceWords = prop_invertInPlace . getLarge
143155
You can’t perform that action at this time.
0 commit comments