-- Do not edit! Automatically created with doctest-extract from src/Data/Interval.hs {-# LINE 109 "src/Data/Interval.hs" #-} module Test.Data.Interval where import Data.Interval import Test.DocTest.Base import qualified Test.DocTest.Driver as DocTest {-# LINE 110 "src/Data/Interval.hs" #-} import Data.IntervalTest import qualified Data.Sequence as Seq import qualified Data.List as List import Data.Function (on) import Data.Maybe (isJust, fromJust, catMaybes) import Data.Foldable (toList) import Test.QuickCheck ((==>)) without' :: (Int,Int) -> (Int,Int) -> [(Int,Int)]; without' = without test :: DocTest.T () test = do DocTest.printPrefix "Data.Interval:181: " {-# LINE 181 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 181 "src/Data/Interval.hs" #-} (forevery genNonNestedIntervalSeq $ \xs -> propSplit (\subseq -> hullSeqNonNested subseq == hullSeq subseq) (splitSeq xs)) DocTest.printPrefix "Data.Interval:176: " {-# LINE 176 "src/Data/Interval.hs" #-} DocTest.example {-# LINE 176 "src/Data/Interval.hs" #-} (propSplit (\xs -> hullSeqNonNested xs == hullSeq xs) . splitSeq . sortByRight $ Seq.fromList ([(1,3),(2,4),(4,5),(3,6)] :: [(Int,Int)])) [ExpectedLine [LineChunk "False"]] DocTest.printPrefix "Data.Interval:229: " {-# LINE 229 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 229 "src/Data/Interval.hs" #-} (forevery genInterval $ \i -> overlapTime i i == intervalDuration i) DocTest.printPrefix "Data.Interval:230: " {-# LINE 230 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 230 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> not (i `properlyIntersects` j) ==> overlapTime i j == 0) DocTest.printPrefix "Data.Interval:231: " {-# LINE 231 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 231 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> overlapTime i j == (sum $ fmap intervalDuration $ maybeIntersection i j)) DocTest.printPrefix "Data.Interval:241: " {-# LINE 241 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 241 "src/Data/Interval.hs" #-} (forevery genInterval $ \i c -> prevailing i (Seq.singleton (c,i)) == Just (c::Char)) DocTest.printPrefix "Data.Interval:242: " {-# LINE 242 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 242 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genLabeledSeq $ \i js -> isJust (prevailing i js) == any (intersects i . snd) js) DocTest.printPrefix "Data.Interval:243: " {-# LINE 243 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 243 "src/Data/Interval.hs" #-} (forevery genInterval $ \i -> foreveryPair genLabeledSeq $ \js ks -> all (flip elem $ catMaybes [prevailing i js, prevailing i ks]) $ prevailing i (js<>ks)) DocTest.printPrefix "Data.Interval:266: " {-# LINE 266 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 266 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> isJust (maybeUnion i j) ==> fromJust (maybeUnion i j) `contains` i && fromJust (maybeUnion i j) `contains` j) DocTest.printPrefix "Data.Interval:267: " {-# LINE 267 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 267 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> i `intersects` j ==> (maybeUnion i j >>= maybeIntersection i) == Just i) DocTest.printPrefix "Data.Interval:275: " {-# LINE 275 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 275 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> i `intersects` j ==> i `contains` fromJust (maybeIntersection i j)) DocTest.printPrefix "Data.Interval:283: " {-# LINE 283 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 283 "src/Data/Interval.hs" #-} (\xs -> isJust (hull xs) ==> all (\x -> fromJust (hull xs) `contains` x) (xs :: [(Int,Int)])) DocTest.printPrefix "Data.Interval:300: " {-# LINE 300 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 300 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> length (i `without` j) <= 2) DocTest.printPrefix "Data.Interval:301: " {-# LINE 301 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 301 "src/Data/Interval.hs" #-} (forevery genInterval $ \i -> i `without` i == []) DocTest.printPrefix "Data.Interval:302: " {-# LINE 302 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 302 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> all (contains i) (i `without` j)) DocTest.printPrefix "Data.Interval:303: " {-# LINE 303 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 303 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> not $ any (properlyIntersects j) (i `without` j)) DocTest.printPrefix "Data.Interval:291: " {-# LINE 291 "src/Data/Interval.hs" #-} DocTest.example {-# LINE 291 "src/Data/Interval.hs" #-} (without' (1,5) (4,5)) [ExpectedLine [LineChunk "[(1,4)]"]] DocTest.printPrefix "Data.Interval:293: " {-# LINE 293 "src/Data/Interval.hs" #-} DocTest.example {-# LINE 293 "src/Data/Interval.hs" #-} (without' (1,5) (2,3)) [ExpectedLine [LineChunk "[(1,2),(3,5)]"]] DocTest.printPrefix "Data.Interval:295: " {-# LINE 295 "src/Data/Interval.hs" #-} DocTest.example {-# LINE 295 "src/Data/Interval.hs" #-} (without' (1,5) (1,5)) [ExpectedLine [LineChunk "[]"]] DocTest.printPrefix "Data.Interval:297: " {-# LINE 297 "src/Data/Interval.hs" #-} DocTest.example {-# LINE 297 "src/Data/Interval.hs" #-} (without' (1,5) (0,1)) [ExpectedLine [LineChunk "[(1,5)]"]] DocTest.printPrefix "Data.Interval:319: " {-# LINE 319 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 319 "src/Data/Interval.hs" #-} (forevery genSortedIntervals $ all (\xs -> and $ List.zipWith intersects xs (tail xs)) . contiguous) DocTest.printPrefix "Data.Interval:320: " {-# LINE 320 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 320 "src/Data/Interval.hs" #-} (forevery genSortedIntervals $ all ((1==).length.components) . contiguous) DocTest.printPrefix "Data.Interval:335: " {-# LINE 335 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 335 "src/Data/Interval.hs" #-} (forevery genSortedIntervals $ \xs -> all (\i -> any (flip contains i) (components xs)) xs) DocTest.printPrefix "Data.Interval:336: " {-# LINE 336 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 336 "src/Data/Interval.hs" #-} (forevery genSortedIntervals $ \xs -> let cs = components xs in all (\(i,j) -> i == j || not (i `intersects` j)) [(c1,c2) | c1 <- cs, c2 <- cs]) DocTest.printPrefix "Data.Interval:355: " {-# LINE 355 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 355 "src/Data/Interval.hs" #-} (forevery genSortedIntervals $ \xs -> componentsSeq (Seq.fromList xs) == Seq.fromList (components xs)) DocTest.printPrefix "Data.Interval:356: " {-# LINE 356 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 356 "src/Data/Interval.hs" #-} (forevery genSortedIntervalSeq $ \xs -> let cs = componentsSeq xs in all (\(i,j) -> i == j || not (i `intersects` j)) $ do {c1 <- cs; c2 <- cs; return (c1,c2)}) DocTest.printPrefix "Data.Interval:369: " {-# LINE 369 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 369 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genIntervalSeq $ \i js -> all (contains i) (covered i js)) DocTest.printPrefix "Data.Interval:370: " {-# LINE 370 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 370 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genIntervalSeq $ \i js -> covered i (covered i js) == covered i js) DocTest.printPrefix "Data.Interval:376: " {-# LINE 376 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 376 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> j `contains` i == i `coveredBy` [j]) DocTest.printPrefix "Data.Interval:377: " {-# LINE 377 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 377 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genSortedIntervals $ \i js -> i `coveredBy` js ==> any (flip contains i) (components js)) DocTest.printPrefix "Data.Interval:383: " {-# LINE 383 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 383 "src/Data/Interval.hs" #-} (foreveryPairOf genNonEmptyInterval genIntervalSeq $ \i js -> i `coveredBy` js == (fractionCovered i js >= (1::Rational))) DocTest.printPrefix "Data.Interval:384: " {-# LINE 384 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 384 "src/Data/Interval.hs" #-} (foreveryPairOf genNonEmptyInterval genNonEmptyIntervalSeq $ \i js -> any (properlyIntersects i) js == (fractionCovered i js > (0::Rational))) DocTest.printPrefix "Data.Interval:403: " {-# LINE 403 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 403 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> i `intersects` j == (overlap i j == EQ)) DocTest.printPrefix "Data.Interval:421: " {-# LINE 421 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 421 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> i `properlyIntersects` j == (properOverlap i j == EQ)) DocTest.printPrefix "Data.Interval:433: " {-# LINE 433 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 433 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> (lb i <= ub i && lb j <= ub j && i `intersects` j) == (max (lb i) (lb j) <= min (ub i) (ub j))) DocTest.printPrefix "Data.Interval:430: " {-# LINE 430 "src/Data/Interval.hs" #-} DocTest.example {-# LINE 430 "src/Data/Interval.hs" #-} (((1,2)::(Int,Int)) `intersects` ((2,3)::(Int,Int))) [ExpectedLine [LineChunk "True"]] DocTest.printPrefix "Data.Interval:444: " {-# LINE 444 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 444 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> ((i `intersects` j) && not (i `properlyIntersects` j)) == (ub i == lb j || ub j == lb i)) DocTest.printPrefix "Data.Interval:450: " {-# LINE 450 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 450 "src/Data/Interval.hs" #-} (forevery genInterval $ \i -> i `contains` i) DocTest.printPrefix "Data.Interval:451: " {-# LINE 451 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 451 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> (i `contains` j && j `contains` i) == (i==j)) DocTest.printPrefix "Data.Interval:452: " {-# LINE 452 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 452 "src/Data/Interval.hs" #-} (foreveryPair genInterval $ \i j -> i `contains` j == (maybeUnion i j == Just i)) DocTest.printPrefix "Data.Interval:464: " {-# LINE 464 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 464 "src/Data/Interval.hs" #-} (forevery genSortedList $ \xs -> (components $ toList $ fromEndPoints xs) == if length xs < 2 then [] else [(head xs, last xs)]) DocTest.printPrefix "Data.Interval:465: " {-# LINE 465 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 465 "src/Data/Interval.hs" #-} (forevery genSortedList $ \xs -> hullSeqNonNested (fromEndPoints xs) == if length xs < 2 then Nothing else Just (head xs,last xs)) DocTest.printPrefix "Data.Interval:478: " {-# LINE 478 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 478 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genSortedIntervalSeq $ \i js -> toList (getIntersects i (FromSortedSeq js)) `List.isSubsequenceOf` toList js) DocTest.printPrefix "Data.Interval:479: " {-# LINE 479 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 479 "src/Data/Interval.hs" #-} (forevery genSortedIntervalSeq $ \xs -> propSplit (\subseq -> subseq == sortByRight subseq) (splitSeq xs)) DocTest.printPrefix "Data.Interval:496: " {-# LINE 496 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 496 "src/Data/Interval.hs" #-} (forevery genSortedIntervalSeq $ \xs -> hullSeq xs == if Seq.null xs then Nothing else Just (minimum (fmap lb xs),maximum (fmap ub xs))) DocTest.printPrefix "Data.Interval:497: " {-# LINE 497 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 497 "src/Data/Interval.hs" #-} (forevery genSortedIntervalSeq $ \xs -> hullSeq xs == hull (toList xs)) DocTest.printPrefix "Data.Interval:516: " {-# LINE 516 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 516 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genNonNestedIntervalSeq $ \i js' -> let js = toList js' in fst (splitIntersecting i js) == filter (intersects i) js) DocTest.printPrefix "Data.Interval:517: " {-# LINE 517 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 517 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genNonNestedIntervalSeq $ \i js' -> let js = toList js' in all (\j -> not (ub j < ub i)) (snd (splitIntersecting i js))) DocTest.printPrefix "Data.Interval:513: " {-# LINE 513 "src/Data/Interval.hs" #-} DocTest.example {-# LINE 513 "src/Data/Interval.hs" #-} (splitIntersecting ((2,5) :: (Int,Int)) ([(0,1),(2,2),(2,3),(3,6),(6,7)] :: [(Int,Int)])) [ExpectedLine [LineChunk "([(2,2),(2,3),(3,6)],[(3,6),(6,7)])"]] DocTest.printPrefix "Data.Interval:537: " {-# LINE 537 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 537 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genNonNestedIntervalSeq $ \i js' -> let js = toList js' in fst (splitProperlyIntersecting i js) == filter (properlyIntersects i) js) DocTest.printPrefix "Data.Interval:538: " {-# LINE 538 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 538 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genNonNestedIntervalSeq $ \i js' -> let js = toList js' in all (not.properlyContains i) (snd (splitProperlyIntersecting i js))) DocTest.printPrefix "Data.Interval:534: " {-# LINE 534 "src/Data/Interval.hs" #-} DocTest.example {-# LINE 534 "src/Data/Interval.hs" #-} (splitProperlyIntersecting ((2,5) :: (Int,Int)) ([(0,1),(2,3),(2,2),(3,5),(5,6),(6,7)] :: [(Int,Int)])) [ExpectedLine [LineChunk "([(2,3),(3,5)],[(5,6),(6,7)])"]] DocTest.printPrefix "Data.Interval:570: " {-# LINE 570 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 570 "src/Data/Interval.hs" #-} (forevery genSortedIntervalSeq $ \xs -> hullSeq xs == hullOfTree (itree 4 xs)) DocTest.printPrefix "Data.Interval:581: " {-# LINE 581 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 581 "src/Data/Interval.hs" #-} (forevery genIntervalSeq $ \xs -> invariant . itree 4 $ xs) DocTest.printPrefix "Data.Interval:591: " {-# LINE 591 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 591 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genIntervalSeq $ \i t -> on (==) sortByRight (getIntersects i $ itree 2 t) (i `intersecting` t)) DocTest.printPrefix "Data.Interval:602: " {-# LINE 602 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 602 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genIntervalSeq $ \i t -> on (==) sortByRight (getProperIntersects i $ itree 2 t) (i `intersectingProperly` t)) DocTest.printPrefix "Data.Interval:734: " {-# LINE 734 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 734 "src/Data/Interval.hs" #-} (forevery genIntervalSeq $ \is -> joinSeq (splitSeq is) == is) DocTest.printPrefix "Data.Interval:796: " {-# LINE 796 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 796 "src/Data/Interval.hs" #-} (forevery genNonNestedIntervalSeq $ \xs -> hullSeqNonNested xs == hullSeq xs) DocTest.printPrefix "Data.Interval:813: " {-# LINE 813 "src/Data/Interval.hs" #-} DocTest.property {-# LINE 813 "src/Data/Interval.hs" #-} (foreveryPairOf genInterval genNonNestedIntervalSeq $ \i js -> getIntersects i (FromSortedSeq js) == intersecting i js)