module Ouroboros.Consensus.Util.Tests (tests) where import Ouroboros.Consensus.Util import Test.Tasty import Test.Tasty.QuickCheck tests :: TestTree tests :: TestTree tests = TestName -> [TestTree] -> TestTree testGroup TestName "Ouroboros.Consensus.Util" ([TestTree] -> TestTree) -> [TestTree] -> TestTree forall a b. (a -> b) -> a -> b $ [ TestName -> (Fun Int Bool -> [Int] -> Property) -> TestTree forall a. Testable a => TestName -> a -> TestTree testProperty TestName "split" Fun Int Bool -> [Int] -> Property prop_split ] prop_split :: Fun Int Bool -> [Int] -> Property prop_split :: Fun Int Bool -> [Int] -> Property prop_split (Fun (Int :-> Bool, Bool, Shrunk) _ Int -> Bool p) [Int] as = NonEmpty [Int] -> [Int] forall (t :: * -> *) a. Foldable t => t [a] -> [a] concat ((Int -> Bool) -> [Int] -> NonEmpty [Int] forall a. (a -> Bool) -> [a] -> NonEmpty [a] split Int -> Bool p [Int] as) [Int] -> [Int] -> Property forall a. (Eq a, Show a) => a -> a -> Property === (Int -> Bool) -> [Int] -> [Int] forall a. (a -> Bool) -> [a] -> [a] filter (Bool -> Bool not (Bool -> Bool) -> (Int -> Bool) -> Int -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c . Int -> Bool p) [Int] as Property -> Property -> Property forall prop1 prop2. (Testable prop1, Testable prop2) => prop1 -> prop2 -> Property .&&. NonEmpty [Int] -> Int forall a. NonEmpty a -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length ((Int -> Bool) -> [Int] -> NonEmpty [Int] forall a. (a -> Bool) -> [a] -> NonEmpty [a] split Int -> Bool p [Int] as) Int -> Int -> Property forall a. (Eq a, Show a) => a -> a -> Property === [Int] -> Int forall a. [a] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length ((Int -> Bool) -> [Int] -> [Int] forall a. (a -> Bool) -> [a] -> [a] filter Int -> Bool p [Int] as) Int -> Int -> Int forall a. Num a => a -> a -> a + Int 1