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 ((\\))
20#if __GLASGOW_HASKELL__ < 808
21import Data.Semigroup ((<>))
23import Test.QuickCheck (Property, Gen, choose, counterexample)
24import Test.QuickCheck.Monadic (PropertyM, assert, monitor, monadicIO)
28 => (a -> a -> Bool) -> a -> a -> PropertyM m ()
29equals eq stream list = do
30 when (not $ stream `eq` list) $
33 "stream " <> show stream
34 <> "\nlist " <> show list
36 assert (stream `eq` list)
39 :: (Show a, Eq a, MonadIO m)
40 => ([a] -> [a] -> Bool) -> [a] -> [a] -> PropertyM m ()
41listEquals eq stream list = do
42 when (not $ stream `eq` list) $ liftIO $ putStrLn $
43 "stream " <> show stream
44 <> "\nlist " <> show list
45 <> "\nstream length " <> show (length stream)
46 <> "\nlist length " <> show (length list)
47 <> "\nstream \\\\ list " <> show (stream \\ list)
48 <> "\nlist \\\\ stream " <> show (list \\ stream)
49 when (not $ stream `eq` list) $
52 "stream " <> show stream
53 <> "\nlist " <> show list
54 <> "\nstream length " <> show (length stream)
55 <> "\nlist length " <> show (length list)
56 <> "\nstream \\\\ list " <> show (stream \\ list)
57 <> "\nlist \\\\ stream " <> show (list \\ stream)
59 assert (stream `eq` list)
61checkListEqual :: (Show a, Eq a) => [a] -> [a] -> Property
62checkListEqual ls_1 ls_2 = monadicIO (listEquals (==) ls_1 ls_2)
64chooseInt :: (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