Skip to content

Commit

Permalink
Remove camelCase hint
Browse files Browse the repository at this point in the history
  • Loading branch information
carbolymer committed Apr 10, 2024
1 parent 045f347 commit 02c407e
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 72 deletions.
4 changes: 1 addition & 3 deletions cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Gen.QuickCheck as Q
import qualified Hedgehog.Range as Range

{- HLINT ignore "Reduce duplication" -}
{- HLINT ignore "Use let" -}

genAddressByron :: Gen (Address ByronAddr)
genAddressByron = makeByronAddress <$> genNetworkId
Expand Down Expand Up @@ -933,7 +931,7 @@ genProtocolParameters era = do
protocolParamPoolPledgeInfluence <- genRationalInt64
protocolParamMonetaryExpansion <- genRational
protocolParamTreasuryCut <- genRational
protocolParamCostModels <- pure mempty
let protocolParamCostModels = mempty
--TODO: Babbage figure out how to deal with
-- asymmetric cost model JSON instances
protocolParamPrices <- Gen.maybe genExecutionUnitPrices
Expand Down
2 changes: 0 additions & 2 deletions cardano-api/gen/Test/Hedgehog/Roundtrip/CBOR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import qualified GHC.Stack as GHC

import qualified Hedgehog as H

{- HLINT ignore "Use camelCase" -}

-- | Assert that CBOR serialisation and deserialisation roundtrips.
trippingCbor :: ()
=> HasCallStack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import Hedgehog.Extras.Aeson
import Test.Tasty (TestTree)
import Test.Tasty.Hedgehog (testProperty)

{- HLINT ignore "Use camelCase" -}

exampleSimpleScriptV1_All :: SimpleScript
exampleSimpleScriptV1_All =
RequireAllOf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import Test.Hedgehog.Roundtrip.CBOR (trippingCbor)
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.Hedgehog (testProperty)

{- HLINT ignore "Use camelCase" -}

prop_roundtrip_byron_key_CBOR :: Property
prop_roundtrip_byron_key_CBOR = H.property $ do
seed <- H.forAll $ deterministicSigningKey AsByronKey <$> Gen.genSeedForKey AsByronKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,25 @@ import qualified Hedgehog as H
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.Hedgehog (testProperty)

{- HLINT ignore "Use camelCase" -}

-- Address CBOR round trips

prop_roundtrip_shelley_address :: Property
prop_roundtrip_shelley_address =
roundtrip_serialise_address AsShelleyAddress genAddressShelley
roundtripSerialiseAddress AsShelleyAddress genAddressShelley


prop_roundtrip_byron_address :: Property
prop_roundtrip_byron_address =
roundtrip_serialise_address AsByronAddress genAddressByron
roundtripSerialiseAddress AsByronAddress genAddressByron


-- -----------------------------------------------------------------------------

roundtrip_serialise_address
roundtripSerialiseAddress
:: ( SerialiseAddress a
, Eq a
, Show a) => AsType a -> H.Gen a -> Property
roundtrip_serialise_address asType g =
roundtripSerialiseAddress asType g =
H.property $ do
v <- H.forAll g
H.tripping v serialiseAddress (deserialiseAddress asType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import Test.Hedgehog.Roundtrip.CBOR
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.Hedgehog (testProperty)

{- HLINT ignore "Use camelCase" -}

-- TODO: Need to add PaymentExtendedKey roundtrip tests however
-- we can't derive an Eq instance for Crypto.HD.XPrv
prop_roundtrip_txbody_CBOR :: Property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,81 +16,79 @@ import qualified Hedgehog as H
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.Hedgehog (testProperty)

{- HLINT ignore "Use camelCase" -}

prop_roundtrip_ByronVerificationKey_envelope :: Property
prop_roundtrip_ByronVerificationKey_envelope =
roundtrip_VerificationKey_envelope AsByronKey
roundtripVerificationKeyEnvelope AsByronKey

prop_roundtrip_ByronSigningKey_envelope :: Property
prop_roundtrip_ByronSigningKey_envelope =
roundtrip_SigningKey_envelope AsByronKey
roundtripSigningKeyEnvelope AsByronKey

prop_roundtrip_PaymentVerificationKey_envelope :: Property
prop_roundtrip_PaymentVerificationKey_envelope =
roundtrip_VerificationKey_envelope AsPaymentKey
roundtripVerificationKeyEnvelope AsPaymentKey

prop_roundtrip_PaymentSigningKey_envelope :: Property
prop_roundtrip_PaymentSigningKey_envelope =
roundtrip_SigningKey_envelope AsPaymentKey
roundtripSigningKeyEnvelope AsPaymentKey


prop_roundtrip_StakeVerificationKey_envelope :: Property
prop_roundtrip_StakeVerificationKey_envelope =
roundtrip_VerificationKey_envelope AsStakeKey
roundtripVerificationKeyEnvelope AsStakeKey

prop_roundtrip_StakeSigningKey_envelope :: Property
prop_roundtrip_StakeSigningKey_envelope =
roundtrip_SigningKey_envelope AsStakeKey
roundtripSigningKeyEnvelope AsStakeKey


prop_roundtrip_StakePoolVerificationKey_envelope :: Property
prop_roundtrip_StakePoolVerificationKey_envelope =
roundtrip_VerificationKey_envelope AsStakePoolKey
roundtripVerificationKeyEnvelope AsStakePoolKey

prop_roundtrip_StakePoolSigningKey_envelope :: Property
prop_roundtrip_StakePoolSigningKey_envelope =
roundtrip_SigningKey_envelope AsStakePoolKey
roundtripSigningKeyEnvelope AsStakePoolKey


prop_roundtrip_GenesisVerificationKey_envelope :: Property
prop_roundtrip_GenesisVerificationKey_envelope =
roundtrip_VerificationKey_envelope AsGenesisKey
roundtripVerificationKeyEnvelope AsGenesisKey

prop_roundtrip_GenesisSigningKey_envelope :: Property
prop_roundtrip_GenesisSigningKey_envelope =
roundtrip_SigningKey_envelope AsGenesisKey
roundtripSigningKeyEnvelope AsGenesisKey


prop_roundtrip_GenesisDelegateVerificationKey_envelope :: Property
prop_roundtrip_GenesisDelegateVerificationKey_envelope =
roundtrip_VerificationKey_envelope AsGenesisDelegateKey
roundtripVerificationKeyEnvelope AsGenesisDelegateKey

prop_roundtrip_GenesisDelegateSigningKey_envelope :: Property
prop_roundtrip_GenesisDelegateSigningKey_envelope =
roundtrip_SigningKey_envelope AsGenesisDelegateKey
roundtripSigningKeyEnvelope AsGenesisDelegateKey


prop_roundtrip_KesVerificationKey_envelope :: Property
prop_roundtrip_KesVerificationKey_envelope =
roundtrip_VerificationKey_envelope AsKesKey
roundtripVerificationKeyEnvelope AsKesKey

prop_roundtrip_KesSigningKey_envelope :: Property
prop_roundtrip_KesSigningKey_envelope =
roundtrip_SigningKey_envelope AsKesKey
roundtripSigningKeyEnvelope AsKesKey


prop_roundtrip_VrfVerificationKey_envelope :: Property
prop_roundtrip_VrfVerificationKey_envelope =
roundtrip_VerificationKey_envelope AsVrfKey
roundtripVerificationKeyEnvelope AsVrfKey

prop_roundtrip_VrfSigningKey_envelope :: Property
prop_roundtrip_VrfSigningKey_envelope =
roundtrip_SigningKey_envelope AsVrfKey
roundtripSigningKeyEnvelope AsVrfKey

-- -----------------------------------------------------------------------------

roundtrip_VerificationKey_envelope :: ()
roundtripVerificationKeyEnvelope :: ()
#if MIN_VERSION_base(4,17,0)
-- GHC 8.10 considers the HasTypeProxy constraint redundant but ghc-9.2 and above complains if its
-- not present.
Expand All @@ -99,17 +97,17 @@ roundtrip_VerificationKey_envelope :: ()
=> Key keyrole
=> AsType keyrole
-> Property
roundtrip_VerificationKey_envelope roletoken =
roundtripVerificationKeyEnvelope roletoken =
H.property $ do
vkey <- H.forAll (genVerificationKey roletoken)
H.tripping vkey (serialiseToTextEnvelope Nothing)
(deserialiseFromTextEnvelope (AsVerificationKey roletoken))

roundtrip_SigningKey_envelope :: (Key keyrole,
roundtripSigningKeyEnvelope :: (Key keyrole,
Eq (SigningKey keyrole),
Show (SigningKey keyrole))
=> AsType keyrole -> Property
roundtrip_SigningKey_envelope roletoken =
roundtripSigningKeyEnvelope roletoken =
H.property $ do
vkey <- H.forAll (genSigningKey roletoken)
H.tripping vkey (serialiseToTextEnvelope Nothing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import qualified Hedgehog.Gen as Gen
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.Hedgehog (testProperty)

{- HLINT ignore "Use camelCase" -}

prop_roundtrip_praos_nonce_JSON :: Property
prop_roundtrip_praos_nonce_JSON = H.property $ do
pNonce <- forAll $ Gen.just genMaybePraosNonce
Expand Down
18 changes: 8 additions & 10 deletions cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/Ord.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ import qualified Hedgehog as H
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.Hedgehog (testProperty)

{- HLINT ignore "Use camelCase" -}

ord_distributive :: (Show a, Ord a, Ord b)
ordDistributive :: (Show a, Ord a, Ord b)
=> H.Gen a -> (a -> b) -> Property
ord_distributive gen to =
ordDistributive gen to =
H.property $ do
x <- H.forAll gen
y <- H.forAll gen
Expand All @@ -27,30 +25,30 @@ ord_distributive gen to =

prop_ord_distributive_TxId :: Property
prop_ord_distributive_TxId =
ord_distributive genTxId toShelleyTxId
ordDistributive genTxId toShelleyTxId

prop_ord_distributive_TxIn :: Property
prop_ord_distributive_TxIn =
ord_distributive genTxIn toShelleyTxIn
ordDistributive genTxIn toShelleyTxIn

prop_ord_distributive_Address :: Property
prop_ord_distributive_Address =
ord_distributive genAddressShelley (toShelleyAddr . toAddressInAnyEra)
ordDistributive genAddressShelley (toShelleyAddr . toAddressInAnyEra)
where
toAddressInAnyEra :: Address ShelleyAddr -> AddressInEra ShelleyEra
toAddressInAnyEra = anyAddressInShelleyBasedEra ShelleyBasedEraShelley . toAddressAny

prop_ord_distributive_StakeAddress :: Property
prop_ord_distributive_StakeAddress =
ord_distributive genStakeAddress toShelleyStakeAddr
ordDistributive genStakeAddress toShelleyStakeAddr

prop_ord_distributive_TxMetadata :: Property
prop_ord_distributive_TxMetadata =
ord_distributive genTxMetadataValue toShelleyMetadatum
ordDistributive genTxMetadataValue toShelleyMetadatum

prop_ord_distributive_ScriptData :: Property
prop_ord_distributive_ScriptData =
ord_distributive (getScriptData <$> genHashableScriptData) toPlutusData
ordDistributive (getScriptData <$> genHashableScriptData) toPlutusData

-- -----------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,75 +16,73 @@ import qualified Hedgehog as H
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.Hedgehog (testProperty)

{- HLINT ignore "Use camelCase" -}

-- Address CBOR round trips

prop_roundtrip_shelley_address_raw :: Property
prop_roundtrip_shelley_address_raw =
roundtrip_raw_bytes AsShelleyAddress genAddressShelley
roundtripRawBytes AsShelleyAddress genAddressShelley


prop_roundtrip_byron_address_raw :: Property
prop_roundtrip_byron_address_raw =
roundtrip_raw_bytes AsByronAddress genAddressByron
roundtripRawBytes AsByronAddress genAddressByron

prop_roundtrip_stake_address_raw :: Property
prop_roundtrip_stake_address_raw =
roundtrip_raw_bytes AsStakeAddress genStakeAddress
roundtripRawBytes AsStakeAddress genStakeAddress

prop_roundtrip_script_hash_raw :: Property
prop_roundtrip_script_hash_raw =
roundtrip_raw_bytes AsScriptHash genScriptHash
roundtripRawBytes AsScriptHash genScriptHash

prop_roundtrip_verification_ByronKey_hash_raw :: Property
prop_roundtrip_verification_ByronKey_hash_raw =
roundtrip_verification_key_hash_raw AsByronKey
roundtripVerificationKeyHashRaw AsByronKey

prop_roundtrip_verification_PaymentKey_hash_raw :: Property
prop_roundtrip_verification_PaymentKey_hash_raw =
roundtrip_verification_key_hash_raw AsPaymentKey
roundtripVerificationKeyHashRaw AsPaymentKey

prop_roundtrip_verification_StakeKey_hash_raw :: Property
prop_roundtrip_verification_StakeKey_hash_raw =
roundtrip_verification_key_hash_raw AsStakeKey
roundtripVerificationKeyHashRaw AsStakeKey

prop_roundtrip_verification_StakePoolKey_hash_raw :: Property
prop_roundtrip_verification_StakePoolKey_hash_raw =
roundtrip_verification_key_hash_raw AsStakePoolKey
roundtripVerificationKeyHashRaw AsStakePoolKey

prop_roundtrip_verification_GenesisKey_hash_raw :: Property
prop_roundtrip_verification_GenesisKey_hash_raw =
roundtrip_verification_key_hash_raw AsGenesisKey
roundtripVerificationKeyHashRaw AsGenesisKey

prop_roundtrip_verification_GenesisDelegateKey_hash_raw :: Property
prop_roundtrip_verification_GenesisDelegateKey_hash_raw =
roundtrip_verification_key_hash_raw AsGenesisDelegateKey
roundtripVerificationKeyHashRaw AsGenesisDelegateKey

prop_roundtrip_verification_KesKey_hash_raw :: Property
prop_roundtrip_verification_KesKey_hash_raw =
roundtrip_verification_key_hash_raw AsKesKey
roundtripVerificationKeyHashRaw AsKesKey

prop_roundtrip_verification_VrfKey_hash_raw :: Property
prop_roundtrip_verification_VrfKey_hash_raw =
roundtrip_verification_key_hash_raw AsVrfKey
roundtripVerificationKeyHashRaw AsVrfKey

prop_roundtrip_verification_GenesisUTxOKey_hash_raw :: Property
prop_roundtrip_verification_GenesisUTxOKey_hash_raw =
roundtrip_verification_key_hash_raw AsGenesisUTxOKey
roundtripVerificationKeyHashRaw AsGenesisUTxOKey

-- -----------------------------------------------------------------------------

roundtrip_raw_bytes
roundtripRawBytes
:: ( SerialiseAsRawBytes a
, Eq a
, Show a) => AsType a -> H.Gen a -> Property
roundtrip_raw_bytes asType g =
roundtripRawBytes asType g =
H.property $ do
v <- H.forAll g
H.tripping v serialiseToRawBytes (deserialiseFromRawBytes asType)

roundtrip_verification_key_hash_raw :: ()
roundtripVerificationKeyHashRaw :: ()
#if MIN_VERSION_base(4,17,0)
-- GHC 9.2 and above needs an extra constraint.
=> HasTypeProxy keyrole
Expand All @@ -94,7 +92,7 @@ roundtrip_verification_key_hash_raw :: ()
=> Show (Hash keyrole)
=> AsType keyrole
-> Property
roundtrip_verification_key_hash_raw roletoken =
roundtripVerificationKeyHashRaw roletoken =
H.property $ do
vKey <- H.forAll $ genVerificationKey roletoken
let vKeyHash = verificationKeyHash vKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import qualified Hedgehog as H
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.Hedgehog (testProperty)

{- HLINT ignore "Use camelCase" -}

-- | Check the txOuts in a TxBodyContent after a ledger roundtrip.
prop_roundtrip_txbodycontent_txouts:: Property
prop_roundtrip_txbodycontent_txouts =
Expand Down

0 comments on commit 02c407e

Please sign in to comment.