{-# LANGUAGE TemplateHaskell #-}

module Test.Cardano.Chain.Common.Attributes (
  tests,
)
where

import Cardano.Prelude
import Hedgehog (assert, forAll, property)
import Hedgehog.Internal.Show (mkValue)
import Test.Cardano.Chain.Common.Gen (genAddrAttributes, genAttributes)
import Test.Cardano.Prelude
import Test.Options (TSGroup, TSProperty, withTestsTS)

-- | Test wether instance Show (Attributes AddrAttributes) makes a string that
-- is useful for gebugging. More specifically, Hedgehog is able to parse it.
ts_prop_show_AddressAttributes_is_haskell :: TSProperty
ts_prop_show_AddressAttributes_is_haskell :: TSProperty
ts_prop_show_AddressAttributes_is_haskell =
  TestLimit -> Property -> TSProperty
withTestsTS TestLimit
1000 forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. HasCallStack => PropertyT IO () -> Property
property forall a b. (a -> b) -> a -> b
$ do
    Attributes AddrAttributes
attr <- forall (m :: * -> *) a.
(Monad m, Show a, HasCallStack) =>
Gen a -> PropertyT m a
forAll forall a b. (a -> b) -> a -> b
$ forall a. Gen a -> Gen (Attributes a)
genAttributes Gen AddrAttributes
genAddrAttributes
    forall (m :: * -> *). (MonadTest m, HasCallStack) => Bool -> m ()
assert forall a b. (a -> b) -> a -> b
$ forall a. Maybe a -> Bool
isJust forall a b. (a -> b) -> a -> b
$ forall a. Show a => a -> Maybe Value
mkValue Attributes AddrAttributes
attr

tests :: TSGroup
tests :: TSGroup
tests = $$discoverPropArg