import Test.QuickCheck import Data.RangeMin import Data.Vector.Primitive import Prelude hiding (length) main = quickCheckWith stdArgs{maxSize = 10000} testAll testAll :: [Int] -> Property testAll xs = goodMin xs .&. goodIntMin xs goodIntMin :: [Int] -> Property goodIntMin [] = property True goodIntMin xs = do i0 <- choose (0, n-1) j0 <- choose (0, n-1) let i = min i0 j0 let m = max i0 j0 + 1 - i property (rM i m == i + minIndex (slice i m ys)) where ys :: Vector Int !ys = fromList xs !n = length ys !rM = intRangeMin ys goodMin :: [Int] -> Property goodMin [] = property True goodMin xs = do i0 <- choose (0, n-1) j0 <- choose (0, n-1) let i = min i0 j0 let m = max i0 j0 + 1 - i property (rM i m == i + minIndex (slice i m ys)) where ys :: Vector Int !ys = fromList xs !n = length ys !rM = vecRangeMin ys