{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Test.Consensus.Ledger.Mock.LedgerTables (tests) where

import           Ouroboros.Consensus.Mock.Ledger
import           Ouroboros.Consensus.Protocol.PBFT
import           Test.Consensus.Ledger.Mock.Generators ()
import           Test.LedgerTables
import           Test.Tasty
import           Test.Tasty.QuickCheck

type Block = SimpleBlock SimpleMockCrypto (SimplePBftExt SimpleMockCrypto PBftMockCrypto)

tests :: TestTree
tests :: TestTree
tests = TestName -> [TestTree] -> TestTree
testGroup TestName
"LedgerTables"
  [ TestName
-> (LedgerState Block EmptyMK
    -> LedgerState Block ValuesMK -> Property)
-> TestTree
forall a. Testable a => TestName -> a -> TestTree
testProperty TestName
"Stowable laws" (forall blk.
(HasLedgerTables (LedgerState blk),
 CanStowLedgerTables (LedgerState blk)) =>
LedgerState blk EmptyMK -> LedgerState blk ValuesMK -> Property
prop_stowable_laws @Block)
  , TestName
-> (LedgerState Block EmptyMK
    -> LedgerTables (LedgerState Block) ValuesMK -> Property)
-> TestTree
forall a. Testable a => TestName -> a -> TestTree
testProperty TestName
"HasLedgerTables laws" (forall blk.
HasLedgerTables (LedgerState blk) =>
LedgerState blk EmptyMK
-> LedgerTables (LedgerState blk) ValuesMK -> Property
prop_hasledgertables_laws @Block)
  ]