Skip to content

Commit

Permalink
Apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Jul 11, 2024
1 parent 299868d commit e28fadb
Show file tree
Hide file tree
Showing 135 changed files with 2,272 additions and 2,269 deletions.
2 changes: 1 addition & 1 deletion cardano-api-gen/src/Test/Gen/Cardano/Api/Empty.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Test.Gen.Cardano.Api.Empty where

import Test.Gen.Cardano.Api ()
import Test.Gen.Cardano.Api ()

-- | This module is empty, but it is needed to prevent unused-packages warning
11 changes: 7 additions & 4 deletions cardano-api/gen/Test/Gen/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ import qualified Cardano.Ledger.BaseTypes as Ledger
import qualified Cardano.Ledger.Coin as Ledger
import qualified Cardano.Ledger.Plutus.CostModels as Plutus
import qualified Cardano.Ledger.Plutus.Language as Alonzo
import Cardano.Ledger.Shelley.TxAuxData (Metadatum (..), ShelleyTxAuxData (..))
import Cardano.Ledger.Shelley.TxAuxData (Metadatum (..), ShelleyTxAuxData (..))

import qualified Data.Map.Strict as Map
import Data.Word (Word64)
import Hedgehog (Gen, Range)
import Data.Word (Word64)

import Test.Gen.Cardano.Api.Typed (genCostModel, genRational)

import Hedgehog (Gen, Range)
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Internal.Range as Range
import Test.Gen.Cardano.Api.Typed (genCostModel, genRational)

genMetadata :: Ledger.Era era => Gen (ShelleyTxAuxData era)
genMetadata = do
Expand Down
19 changes: 11 additions & 8 deletions cardano-api/gen/Test/Gen/Cardano/Api/Byron.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ module Test.Gen.Cardano.Api.Byron
)
where

import Cardano.Api hiding (txIns)
import Cardano.Api.Byron
import Data.Proxy
import Hedgehog
import Test.Gen.Cardano.Api.Typed
import Test.Hedgehog.Roundtrip.CBOR
import Test.Tasty
import Test.Tasty.Hedgehog
import Cardano.Api hiding (txIns)
import Cardano.Api.Byron

import Data.Proxy

import Test.Gen.Cardano.Api.Typed

import Hedgehog
import Test.Hedgehog.Roundtrip.CBOR
import Test.Tasty
import Test.Tasty.Hedgehog

prop_byron_roundtrip_txbody_CBOR :: Property
prop_byron_roundtrip_txbody_CBOR = property $ do
Expand Down
14 changes: 9 additions & 5 deletions cardano-api/gen/Test/Gen/Cardano/Api/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ module Test.Gen.Cardano.Api.Era
)
where

import Cardano.Api hiding (txIns)
import Cardano.Api.Shelley
import Cardano.Api hiding (txIns)
import Cardano.Api.Shelley

import qualified Cardano.Ledger.BaseTypes as Ledger
import qualified Cardano.Ledger.Core as Ledger

import qualified Data.Functor.Identity as Ledger
import Test.Cardano.Ledger.Conway.Arbitrary ()
import Test.Cardano.Ledger.Core.Arbitrary ()
import Test.QuickCheck (Arbitrary (..))

import Test.Cardano.Ledger.Conway.Arbitrary ()
import Test.Cardano.Ledger.Core.Arbitrary ()

import Test.QuickCheck (Arbitrary (..))

shelleyBasedEraTestConstraints
:: ()
Expand Down
14 changes: 8 additions & 6 deletions cardano-api/gen/Test/Gen/Cardano/Api/Metadata.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ module Test.Gen.Cardano.Api.Metadata
)
where

import Cardano.Api
import Data.Aeson (ToJSON (..))
import Cardano.Api

import Data.Aeson (ToJSON (..))
import qualified Data.Aeson as Aeson
import qualified Data.Aeson.Key as Aeson
import Data.ByteString (ByteString)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Base16 as Base16
import qualified Data.Map.Strict as Map
import Data.Text (Text)
import Data.Text (Text)
import qualified Data.Text as Text
import qualified Data.Text.Encoding as Text
import Data.Word (Word64)
import Hedgehog (Gen)
import Data.Word (Word64)

import Hedgehog (Gen)
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Internal.Gen as Gen
import qualified Hedgehog.Range as Range
Expand Down
17 changes: 10 additions & 7 deletions cardano-api/gen/Test/Gen/Cardano/Api/ProtocolParameters.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
module Test.Gen.Cardano.Api.ProtocolParameters where

import Cardano.Api
import Cardano.Api.Ledger
import Cardano.Api.ProtocolParameters
import Hedgehog (MonadGen)
import Cardano.Api
import Cardano.Api.Ledger
import Cardano.Api.ProtocolParameters

import Test.Gen.Cardano.Api.Typed (genCostModels)

import Test.Cardano.Ledger.Alonzo.Arbitrary ()
import Test.Cardano.Ledger.Conway.Arbitrary ()

import Hedgehog (MonadGen)
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Gen.QuickCheck as Q
import Test.Cardano.Ledger.Alonzo.Arbitrary ()
import Test.Cardano.Ledger.Conway.Arbitrary ()
import Test.Gen.Cardano.Api.Typed (genCostModels)

genStrictMaybe :: MonadGen m => m a -> m (StrictMaybe a)
genStrictMaybe gen =
Expand Down
61 changes: 32 additions & 29 deletions cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -126,51 +126,54 @@ module Test.Gen.Cardano.Api.Typed
)
where

import Cardano.Api hiding (txIns)
import Cardano.Api hiding (txIns)
import qualified Cardano.Api as Api
import Cardano.Api.Byron
( KeyWitness (ByronKeyWitness)
, WitnessNetworkIdOrByronAddress (..)
)
import Cardano.Api.Byron (KeyWitness (ByronKeyWitness),
WitnessNetworkIdOrByronAddress (..))
import qualified Cardano.Api.Byron as Byron
import Cardano.Api.Eon.AllegraEraOnwards (allegraEraOnwardsToShelleyBasedEra)
import Cardano.Api.Error
import Cardano.Api.Eon.AllegraEraOnwards (allegraEraOnwardsToShelleyBasedEra)
import Cardano.Api.Error
import qualified Cardano.Api.Ledger as L
import qualified Cardano.Api.Ledger.Lens as A
import Cardano.Api.Script (scriptInEraToRefScript)
import Cardano.Api.Shelley
import Cardano.Api.Script (scriptInEraToRefScript)
import Cardano.Api.Shelley
import qualified Cardano.Api.Shelley as ShelleyApi

import qualified Cardano.Binary as CBOR
import qualified Cardano.Crypto.Hash as Crypto
import qualified Cardano.Crypto.Hash.Class as CRYPTO
import qualified Cardano.Crypto.Seed as Crypto
import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo
import qualified Cardano.Ledger.BaseTypes as Ledger
import qualified Cardano.Ledger.Core as Ledger
import Cardano.Ledger.SafeHash (unsafeMakeSafeHash)
import Control.Applicative (Alternative (..), optional)
import Data.ByteString (ByteString)
import Cardano.Ledger.SafeHash (unsafeMakeSafeHash)

import Control.Applicative (Alternative (..), optional)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Short as SBS
import Data.Coerce
import Data.Int (Int64)
import Data.Maybe
import Data.OSet.Strict (OSet)
import Data.Coerce
import Data.Int (Int64)
import Data.Maybe
import Data.OSet.Strict (OSet)
import qualified Data.OSet.Strict as OSet
import Data.Ratio (Ratio, (%))
import Data.String
import Data.Word (Word16, Word32, Word64)
import Hedgehog (Gen, MonadGen, Range)
import Data.Ratio (Ratio, (%))
import Data.String
import Data.Word (Word16, Word32, Word64)
import Numeric.Natural (Natural)

import Test.Gen.Cardano.Api.Era
import Test.Gen.Cardano.Api.Metadata (genTxMetadata)

import Test.Cardano.Chain.UTxO.Gen (genVKWitness)
import Test.Cardano.Crypto.Gen (genProtocolMagicId)
import Test.Cardano.Ledger.Conway.Arbitrary ()
import Test.Cardano.Ledger.Core.Arbitrary ()

import Hedgehog (Gen, MonadGen, Range)
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Gen.QuickCheck as Q
import qualified Hedgehog.Range as Range
import Numeric.Natural (Natural)
import Test.Cardano.Chain.UTxO.Gen (genVKWitness)
import Test.Cardano.Crypto.Gen (genProtocolMagicId)
import Test.Cardano.Ledger.Conway.Arbitrary ()
import Test.Cardano.Ledger.Core.Arbitrary ()
import Test.Gen.Cardano.Api.Era
import Test.Gen.Cardano.Api.Metadata (genTxMetadata)

{- HLINT ignore "Reduce duplication" -}
{- HLINT ignore "Use let" -}
Expand Down Expand Up @@ -987,7 +990,7 @@ genProtocolParameters era = do
protocolParamUTxOCostPerByte <-
inEonForEra @BabbageEraOnwards (pure Nothing) (const (Just <$> genLovelace)) era

pure ProtocolParameters {..}
pure ProtocolParameters{..}

-- | Generate valid protocol parameters which pass validations in Cardano.Api.ProtocolParameters
genValidProtocolParameters :: ShelleyBasedEra era -> Gen (LedgerProtocolParameters era)
Expand Down Expand Up @@ -1024,7 +1027,7 @@ genProtocolParametersUpdate era = do
protocolUpdateUTxOCostPerByte <-
inEonForEra @BabbageEraOnwards (pure Nothing) (const (Just <$> genLovelace)) era

pure ProtocolParametersUpdate {..}
pure ProtocolParametersUpdate{..}

genUpdateProposal :: CardanoEra era -> Gen UpdateProposal
genUpdateProposal era =
Expand Down
8 changes: 5 additions & 3 deletions cardano-api/gen/Test/Gen/Cardano/Crypto/Seed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ module Test.Gen.Cardano.Crypto.Seed
)
where

import Cardano.Api (AsType, Key)
import Cardano.Api (AsType, Key)
import qualified Cardano.Api as API
import Cardano.Crypto.Seed (Seed)

import Cardano.Crypto.Seed (Seed)
import qualified Cardano.Crypto.Seed as C
import Hedgehog (MonadGen, Range)

import Hedgehog (MonadGen, Range)
import qualified Hedgehog.Gen as G
import qualified Hedgehog.Range as R

Expand Down
18 changes: 10 additions & 8 deletions cardano-api/gen/Test/Hedgehog/Golden/ErrorMessage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

module Test.Hedgehog.Golden.ErrorMessage where

import Cardano.Api (Error (..))
import Cardano.Api.Pretty
import Data.Data
import GHC.Stack (HasCallStack, withFrozenCallStack)
import Hedgehog
import Cardano.Api (Error (..))
import Cardano.Api.Pretty

import Data.Data
import GHC.Stack (HasCallStack, withFrozenCallStack)
import System.FilePath ((</>))

import Hedgehog
import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.Golden as H
import System.FilePath ((</>))
import Test.Tasty
import Test.Tasty.Hedgehog
import Test.Tasty
import Test.Tasty.Hedgehog

-- | Generate test tree for the list of values. This 'TestTree' will serialize the values using 'Error'
-- instance and compare them against golden files in the provided location.
Expand Down
5 changes: 3 additions & 2 deletions cardano-api/gen/Test/Hedgehog/Roundtrip/Bech32.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ module Test.Hedgehog.Roundtrip.Bech32
)
where

import Cardano.Api
import Hedgehog (Gen, Property)
import Cardano.Api

import Hedgehog (Gen, Property)
import qualified Hedgehog as H

roundtrip_Bech32
Expand Down
6 changes: 4 additions & 2 deletions cardano-api/gen/Test/Hedgehog/Roundtrip/CBOR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ module Test.Hedgehog.Roundtrip.CBOR
)
where

import Cardano.Api
import GHC.Stack (HasCallStack)
import Cardano.Api

import GHC.Stack (HasCallStack)
import qualified GHC.Stack as GHC

import qualified Hedgehog as H

{- HLINT ignore "Use camelCase" -}
Expand Down
Loading

0 comments on commit e28fadb

Please sign in to comment.