2-- Module : Streamly.Test.Common
3-- Copyright : (c) 2020 Composewell Technologies
5-- License : BSD-3-Clause
6-- Maintainer : streamly@composewell.com
7-- Stability : experimental
10module Streamly.Test.Common
17import Control.Monad (when)
18import Control.Monad.IO.Class (MonadIO(..))
19import Data.List ((\\))
20import Test.QuickCheck (Property, Gen, choose, counterexample)
21import Test.QuickCheck.Monadic (PropertyM, assert, monitor, monadicIO)
25 => (a -> a -> Bool) -> a -> a -> PropertyM m ()
26equals eq stream list = do
27 when (not $ stream `eq` list) $
30 "stream " <> show stream
31 <> "\nlist " <> show list
33 assert (stream `eq` list)
36 :: (Show a, Eq a, MonadIO m)
37 => ([a] -> [a] -> Bool) -> [a] -> [a] -> PropertyM m ()
38listEquals eq stream list = do
39 when (not $ stream `eq` list) $ liftIO $ putStrLn $
40 "stream " <> show stream
41 <> "\nlist " <> show list
42 <> "\nstream length " <> show (length stream)
43 <> "\nlist length " <> show (length list)
44 <> "\nstream \\\\ list " <> show (stream \\ list)
45 <> "\nlist \\\\ stream " <> show (list \\ stream)
46 when (not $ stream `eq` list) $
49 "stream " <> show stream
50 <> "\nlist " <> show list
51 <> "\nstream length " <> show (length stream)
52 <> "\nlist length " <> show (length list)
53 <> "\nstream \\\\ list " <> show (stream \\ list)
54 <> "\nlist \\\\ stream " <> show (list \\ stream)
56 assert (stream `eq` list)
58checkListEqual :: (Show a, Eq a) => [a] -> [a] -> Property
59checkListEqual ls_1 ls_2 = monadicIO (listEquals (==) ls_1 ls_2)
61chooseInt :: (Int, Int) -> Gen Int
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list