module QC where import Test.QuickCheck import Data.RangeMin import Debug.Trace import Data.Vector.Unboxed import qualified Data.Vector.Generic as G import qualified Data.Vector.Fusion.Stream as S import Prelude hiding (minimum, length) import qualified Prelude stable :: [Int] -> Property stable [] = property True stable xs0 = do let !xs = fromList xs0 let !ixs = G.unstream (S.map (\ (a, b) -> (b, a)) $ S.indexed (G.stream xs)) let !n = length xs i0 <- choose (0, n-1) j0 <- choose (0, n-1) let i = min i0 j0 let m = max i0 j0 - i + 1 property (unsafeIntRangeMin xs i m == unsafeVecRangeMin (ixs :: Vector (Int, Int)) i m)