on 5.12 help sign in
vty/test/BenchImageFuzz.hs
31 lines 615 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 Data.Default (def)
13import System.Random
15rand :: Arbitrary a => IO a
16rand = head <$> sample' arbitrary
18randomImage :: IO Image
19randomImage = rand
21randomPicture = picForImage <$> randomImage
23bench0 = do
24 vty <- mkVty def
25 (w,h) <- displayBounds $ outputIface vty
26 let pictures = replicateM 3000 randomPicture
27 bench ps = do
28 forM ps (update vty)
29 shutdown vty
30 return $ Bench pictures bench