on 33bf7c8 help sign in
vty/test/BenchImageFuzz.hs
29 lines 602 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
16random_image :: IO Image
17random_image = rand
19random_picture = pic_for_image <$> random_image
21bench_0 = do
22 vty <- mkVty
23 DisplayRegion w h <- display_bounds $ terminal vty
24 let pictures = replicateM 3000 random_picture
25 bench ps = do
26 forM ps (update vty)
27 shutdown vty
28 return $ Bench pictures bench