-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ts newstyle specs #4314
base: master
Are you sure you want to change the base?
Ts newstyle specs #4314
Conversation
38b4263
to
d78d73b
Compare
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Gov.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Instances.hs
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Instances.hs
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Instances.hs
Show resolved
Hide resolved
libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/Gov.hs
Outdated
Show resolved
Hide resolved
bc6ff1d
to
87d7cd0
Compare
@TimSheard may I suggest - to make the Another thing I've been thinking about is it it wouldn't be better to just bite the bullet and implement |
e132b2d
to
191a9e6
Compare
So my experience with maps suggests a solution for List. We can add that later. |
0b11983
to
08a72c4
Compare
276731a
to
6de375e
Compare
Added ToDelta as operation on Coin, RngSetFn as operation on Map Added a tractible type PParamSubset as a SimpleRep type for PParam specs Added PPUdates, canFollow abstraction Added CertState, UTxOState, LedgerState, EpochState Use reify to propagate invariants Added class WellFormed Made a few changes to Base.hs, replacing (MemberSpec []) with ErrorSpec Added HSpec tests Work on canFollow and dependencies, added (>=.) Added MinValSize to track size when using rngSet_ Fix omissions and problems with cardinality Improved SizeSpec's in Sets, List, and Maps. Also add typeSpecOpt to Map and Set
6de375e
to
fcebece
Compare
go n cont = do | ||
a <- g | ||
if p a then pure a else scaleT (+ 1) $ go (n - 1) cont | ||
Loose -> (100 :: Int, genError) -- TODO: Maybe 1 is not the right number here! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment seems outdated
|
||
-- | When a test on a Map spec fails, this function traces the steps, to help | ||
-- discover what went wrong. | ||
manualMapTest :: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be turned into a test instead?
Use the new style constrained generators to build Specifications of well formed type used in the Cardano Ledger.
Well formed means that constraints that should hold in the NewEpochState on the chain will hold on the randomly generated
values. The (WellFormed t) class has a has a member function with type ( wff :: Gen t )
These Specifications will probably have to be refined over time. But they are complete in that the machinery exists for every
type in the Ledger. Currently they mimic the constraints in the oldstyle constrained generators. They are significantly simpler and much more composeable.
The PR also has a few fixes that were necessary to handle the constraints we wrote. This PR exercised the constrained generators library quite a bit, and it needed some additions. These include
Checklist
.cabal
andCHANGELOG.md
files according to theversioning process.
.cabal
files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)CHANGELOG.md
for the affected packages. New section is never added with the code changes. (See RELEASING.md)fourmolu
(usescripts/fourmolize.sh
)scripts/cabal-format.sh
)hie.yaml
has been updated (usescripts/gen-hie.sh
)