on 08c42ea help sign in
vty/test/BenchImageFuzz.hs
30 lines 630 B history raw
1{-# LANGUAGE MultiWayIf #-}
2module BenchImageFuzz where
3import Graphics.Vty
4import Graphics.Vty.Debug
6import Verify.Graphics.Vty.Image
7import Verify
9import Control.Applicative
10import Control.Monad
12import System.Random
14rand :: Arbitrary a => IO a
15rand = head <$> sample' arbitrary
17random_image :: IO Image
18random_image = rand
20random_picture = pic_for_image <$> random_image
22bench_0 = do
23 vty <- mkVty
24 DisplayRegion w h <- display_bounds $ terminal vty
25 let pictures = replicateM 3000 random_picture
26 bench ps = do
27 forM ps (update vty)
28 shutdown vty
29 return $ Bench pictures bench