A “Demo”
prop_Insert :: Integer -> [Integer] -> Property
prop_Insert x xs =
ordered xs ==>
collect (length xs) $ ordered (insert x xs)
ordered xs = and (zipWith (<=) xs (drop 1 xs))
Main> quickCheck prop_Insert
OK, passed 100 tests.
46% 0.
26% 1.
19% 2.
8% 3.
1% 4.
A random list is
unlikely to be ordered
unless it is very short!
Föregående bild
Nästa bild
Tillbaka till första bilden
Visa grafisk version