-
Notifications
You must be signed in to change notification settings - Fork 483
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
Ledger types testing #6618
Ledger types testing #6618
Conversation
@@ -136,6 +137,8 @@ tests = testGroup "plutus-ledger-api" | |||
, Spec.CostModelParams.tests | |||
, Spec.ContextDecoding.tests | |||
, Value.test_Value | |||
, Value.test_FaceValue | |||
, OutputDatum.testOutputDatum |
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.
I get errors:
No instance for ‘Arbitrary DatumHash’
arising from a use of ‘arbitrary’
...
No instance for ‘Arbitrary Datum’
arising from a use of ‘arbitrary’
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.
Not here though, in OutputDatum
.
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 one isn't gonna cut it, sorry. It doesn't test anything useful and for it to build you basically need to draw the rest of the owl.
#6624 seems to have the whole owl, so I'm gonna review that PR and then we'll decide what to do with this one.
Meanwhile, maybe I can interest you in resolving some simple issues like this one?
@@ -136,6 +137,8 @@ tests = testGroup "plutus-ledger-api" | |||
, Spec.CostModelParams.tests | |||
, Spec.ContextDecoding.tests | |||
, Value.test_Value | |||
, Value.test_FaceValue | |||
, OutputDatum.testOutputDatum |
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.
Not here though, in OutputDatum
.
test_roundTripFaceValue :: TestTree | ||
test_roundTripFaceValue = testProperty "unFaceValue followed by FaceValue returns the original" $ | ||
\(faceValue :: FaceValue) -> | ||
unFaceValue (FaceValue $ unFaceValue faceValue) === unFaceValue faceValue |
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.
That's a completely useless test unfortunately, this property is guaranteed by GHC.
@@ -69,6 +69,9 @@ instance Arbitrary FaceValue where | |||
, (1, FaceValue . fromIntegral <$> arbitrary @Int) | |||
] | |||
|
|||
instance Show FaceValue where | |||
show (FaceValue value) = show value |
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.
You could just derive it, but OK.
oneof | ||
[ pure NoOutputDatum | ||
, OutputDatumHash <$> arbitrary | ||
, OutputDatum <$> arbitrary |
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.
Yeah, that relies on a whole lot other Arbitrary
instances existing.
Thank you! I hoped I could build up from here to the whole picture but since it was completed by someone else it makes no sense to spend time on it. I'll look into another issue, thank you - I was looking for something else to do. |
This is an experiment, it consists of two parts:
Pre-submit checklist:
Arbitrary
instances for Ledger types #6210