on 5.18 help sign in
vty/test/BenchImageFuzz.hs
29 lines 598 B history raw
1module BenchImageFuzz where
2import Graphics.Vty
3import Graphics.Vty.Debug
5import Verify.Graphics.Vty.Image
6import Verify
8import Control.Applicative
9import Control.Monad
11import System.Random
13rand :: Arbitrary a => IO a
14rand = head <$> sample' arbitrary
16randomImage :: IO Image
17randomImage = rand
19randomPicture = picForImage <$> randomImage
21bench0 = do
22 vty <- mkVty defaultConfig
23 (w,h) <- displayBounds $ outputIface vty
24 let pictures = replicateM 3000 randomPicture
25 bench ps = do
26 forM ps (update vty)
27 shutdown vty
28 return $ Bench pictures bench