{-| Description: Copyright: (c) 2021 Sam May License: GPL-3.0-or-later Maintainer: ag@eitilt.life Stability: experimental Portability: portable -} module Foreign.Libcdio.Logging.Test.Classes ( laws , genLogEntry , genLogLevel ) where import qualified Hedgehog as H import qualified Hedgehog.Gen as H.G import qualified Hedgehog.Classes as H.C import qualified Data.Text as T import Foreign.Libcdio.Logging import Test.Libcdio.Property.Common laws :: [LawsGroup] laws = [ ("LogLevel", map (\f -> f genLogLevel) [ H.C.eqLaws , ordLaws' , H.C.showLaws , H.C.showReadLaws , H.C.boundedEnumLaws ] ), ("LogEntry", map (\f -> f genLogEntry) [ H.C.eqLaws , H.C.showLaws , H.C.showReadLaws , storableLaws' ] )] genLogLevel :: H.Gen LogLevel genLogLevel = H.G.enumBounded genLogEntry :: H.Gen LogEntry genLogEntry = do l <- genLogLevel m <- genSample return $ LogEntry { logLevel = l , logMessage = T.unpack m }