hscdio-0.1.0.0: test/Sound/Libcdio/Cdio/Test/Classes.hs
{-|
Description:
Copyright: (c) 2020-2021 Sam May
License: GPL-3.0-or-later
Maintainer: ag@eitilt.life
Stability: experimental
Portability: portable
-}
module Sound.Libcdio.Cdio.Test.Classes
( laws
, genCdioError
, genCdioErrorType
) where
import qualified Hedgehog as H
import qualified Hedgehog.Gen as H.G
import qualified Hedgehog.Classes as H.C
import Sound.Libcdio
import Test.Libcdio.Property.Common
laws :: [LawsGroup]
laws =
[ ("CdioErrrorType", map (\f -> f genCdioErrorType)
[ H.C.eqLaws
, H.C.showLaws
, H.C.showReadLaws
]
), ("CdioErrror", map (\f -> f genCdioError)
[ H.C.eqLaws
, H.C.showLaws
, H.C.showReadLaws
]
)]
genCdioErrorType :: H.Gen CdioErrorType
genCdioErrorType = H.G.frequency
[ (6, H.G.element
[ DriverError
, BadParameter
, NotPermitted
, SessionClosed
, Unsupported
])
, (1, FreeformCdioError <$> genSample)
]
genCdioError :: H.Gen CdioError
genCdioError = CdioError <$> genCdioErrorType <*> genSample