mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 18:42:30 +03:00
1abb1dee69
https://github.com/hasura/graphql-engine-mono/pull/1740 GitOrigin-RevId: e807952058243a97f67cd9969fa434933a08652f
23 lines
745 B
Haskell
23 lines
745 B
Haskell
module Test.QuickCheck.Arbitrary.Extended
|
|
( arbitraryExcluding
|
|
, distinctExcluding
|
|
, distinctExcluding1
|
|
, sublistOf1
|
|
) where
|
|
|
|
import Data.Containers.ListUtils (nubOrd)
|
|
import Hasura.Prelude
|
|
import Test.QuickCheck
|
|
|
|
arbitraryExcluding :: (Arbitrary a, Eq a) => [a] -> Gen a
|
|
arbitraryExcluding exclusions = arbitrary `suchThat` (`notElem` exclusions)
|
|
|
|
distinctExcluding :: (Arbitrary a, Ord a) => [a] -> Gen [a]
|
|
distinctExcluding = fmap nubOrd . listOf . arbitraryExcluding
|
|
|
|
distinctExcluding1 :: (Arbitrary a, Ord a) => [a] -> Gen [a]
|
|
distinctExcluding1 = fmap nubOrd . listOf1 . arbitraryExcluding
|
|
|
|
sublistOf1 :: [a] -> Gen [a]
|
|
sublistOf1 xs = sublistOf xs `suchThat` (not . null)
|