on eaef624 help sign in
vty/test/BenchImageFuzz.hs
31 lines 625 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
18random_image :: IO Image
19random_image = rand
21random_picture = pic_for_image <$> random_image
23bench_0 = do
24 vty <- mkVty def
25 (w,h) <- display_bounds $ output_iface vty
26 let pictures = replicateM 3000 random_picture
27 bench ps = do
28 forM ps (update vty)
29 shutdown vty
30 return $ Bench pictures bench