Skip to content

Commit 9eef6f7

Browse files
committed
test(gen): add generators for Cardano era types
1 parent e2c8c26 commit 9eef6f7

File tree

1 file changed

+13
-1
lines changed
  • cardano-api/gen/Test/Gen/Cardano/Api

1 file changed

+13
-1
lines changed

cardano-api/gen/Test/Gen/Cardano/Api/Era.hs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
module Test.Gen.Cardano.Api.Era
88
( shelleyBasedEraTestConstraints
99
, conwayEraOnwardsTestConstraints
10+
, genAnyShelleyBasedEra
11+
, genAnyCardanoEra
1012
)
1113
where
1214

@@ -18,7 +20,9 @@ import Data.Maybe.Strict
1820

1921
import Test.Gen.Cardano.Api.Orphans ()
2022

21-
import Test.QuickCheck
23+
import Hedgehog (Gen)
24+
import Hedgehog.Gen qualified as Gen
25+
import Test.QuickCheck hiding (Gen)
2226

2327
shelleyBasedEraTestConstraints
2428
:: ()
@@ -50,3 +54,11 @@ conwayEraOnwardsTestConstraints
5054
conwayEraOnwardsTestConstraints = \case
5155
ConwayEraOnwardsConway -> id
5256
ConwayEraOnwardsDijkstra -> id
57+
58+
-- | Generator for any Shelley-based era
59+
genAnyShelleyBasedEra :: Gen AnyShelleyBasedEra
60+
genAnyShelleyBasedEra = Gen.element [minBound .. maxBound]
61+
62+
-- | Generator for any Cardano era
63+
genAnyCardanoEra :: Gen AnyCardanoEra
64+
genAnyCardanoEra = Gen.element [minBound .. maxBound]

0 commit comments

Comments
 (0)