Skip to content

Commit

Permalink
Test that the larger predicate is monotone.
Browse files Browse the repository at this point in the history
  • Loading branch information
robrix committed Jul 5, 2020
1 parent b77df88 commit 310d109
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/Data/IntervalSet/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Data.IntervalSet.Test
( tests
) where

import Control.Monad (when)
import Data.Foldable (foldl')
import Data.Functor.I
import Data.Functor.Interval
Expand All @@ -23,6 +24,13 @@ tests = testGroup "IntervalSet"
s <- insert i <$> forAll gs
insert i s === s
]
, testGroup "larger"
[ testProperty "monotone" . property $ do
i1 <- forAll gi
i2 <- forAll gi
i3 <- forAll gi
when (larger i1 (Just i2)) $ larger i1 (Just (i2 <> i3)) === True
]
]
where
gp = Gen.int (Range.linear 0 100)
Expand Down

0 comments on commit 310d109

Please sign in to comment.