1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- {-# LANGUAGE TemplateHaskell #-}
- module Internal.Utils.NonEmptyList ( tests ) where
- import Data.List.NonEmpty (NonEmpty(..), nonEmpty)
- import qualified Data.List.NonEmpty as NonEmpty
- import Data.Maybe
- import Internal.Helpers
- import Agda.Utils.Impossible
- instance Arbitrary a => Arbitrary (NonEmpty a) where
- arbitrary = fromMaybe __IMPOSSIBLE__ . nonEmpty . getNonEmpty <$> arbitrary
- shrink = map (fromMaybe __IMPOSSIBLE__ . nonEmpty . getNonEmpty) . shrink . (NonEmpty . NonEmpty.toList)
- prop_NonemptyList_roundtrip :: Eq a => NonEmpty a -> Bool
- prop_NonemptyList_roundtrip l = maybe False (l ==) $ nonEmpty $ NonEmpty.toList l
- return []
- tests :: TestTree
- tests = testProperties "Internal.Utils.NonemptyList" $allProperties
|