vty/test/BenchImageFuzz.hs

32 lines
615 B
Haskell
Raw Normal View History

module BenchImageFuzz where
import Graphics.Vty
import Graphics.Vty.Debug
import Verify.Graphics.Vty.Image
import Verify
import Control.Applicative
import Control.Monad
2014-01-27 01:25:13 +04:00
import Data.Default (def)
import System.Random
rand :: Arbitrary a => IO a
rand = head <$> sample' arbitrary
randomImage :: IO Image
randomImage = rand
randomPicture = picForImage <$> randomImage
bench0 = do
2014-01-27 01:25:13 +04:00
vty <- mkVty def
(w,h) <- displayBounds $ outputIface vty
let pictures = replicateM 3000 randomPicture
bench ps = do
forM ps (update vty)
shutdown vty
return $ Bench pictures bench