{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}

module Byron.Spec.Ledger.Delegation.Test (coverDelegFailures) where

import Byron.Spec.Ledger.Delegation
import Data.Data (Data)
import GHC.Stack (HasCallStack)
import Hedgehog (MonadTest)
import Hedgehog.Internal.Property (CoverPercentage)
import qualified Test.Control.State.Transition.Generator as Generator

coverDelegFailures ::
  forall m a.
  ( MonadTest m
  , HasCallStack
  , Data a
  ) =>
  CoverPercentage ->
  a ->
  m ()
coverDelegFailures :: forall (m :: * -> *) a.
(MonadTest m, HasCallStack, Data a) =>
CoverPercentage -> a -> m ()
coverDelegFailures CoverPercentage
coverPercentage =
  forall (m :: * -> *) s a.
(MonadTest m, HasCallStack, Data (PredicateFailure s), Data a) =>
CoverPercentage -> [PredicateFailure s] -> a -> m ()
Generator.coverFailures @_ @SDELEG
    CoverPercentage
coverPercentage
    [ EpochDiff -> SdelegPredicateFailure
EpochInThePast (Epoch -> Epoch -> EpochDiff
EpochDiff Epoch
0 Epoch
0) -- The value here is ignored, only the constructor is compared
    , EpochDiff -> SdelegPredicateFailure
EpochPastNextEpoch (Epoch -> Epoch -> EpochDiff
EpochDiff Epoch
0 Epoch
0) -- The value here is ignored, only the constructor is compared
    , SdelegPredicateFailure
IsAlreadyScheduled
    , SdelegPredicateFailure
IsNotGenesisKey
    , SdelegPredicateFailure
HasAlreadyDelegated
    , SdelegPredicateFailure
DoesNotVerify
    ]