fix failing test case
An empty list of [ContentIdenfier] serialized to the same thing as a single ContentIdentifier "". Avoid this ambiguity by requiring the list be non-empty.
This commit is contained in:
parent
be6085cfe5
commit
c0bd202147
3 changed files with 34 additions and 15 deletions
|
@ -17,6 +17,7 @@ import Test.QuickCheck as X
|
|||
import Data.Time.Clock.POSIX
|
||||
import Data.Ratio
|
||||
import System.Posix.Types
|
||||
import Data.List.NonEmpty (NonEmpty(..))
|
||||
import Prelude
|
||||
|
||||
{- Times before the epoch are excluded. Half with decimal and half without. -}
|
||||
|
@ -41,6 +42,10 @@ instance Arbitrary FileID where
|
|||
instance Arbitrary FileOffset where
|
||||
arbitrary = nonNegative arbitrarySizedIntegral
|
||||
|
||||
{- Quickcheck lacks this instance. -}
|
||||
instance Arbitrary l => Arbitrary (NonEmpty l) where
|
||||
arbitrary = (:|) <$> arbitrary <*> arbitrary
|
||||
|
||||
nonNegative :: (Num a, Ord a) => Gen a -> Gen a
|
||||
nonNegative g = g `suchThat` (>= 0)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue