-
Notifications
You must be signed in to change notification settings - Fork 485
Add goldenBundle
and goldenBundle'
test functions
#7057
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Conversation
0dd1b67
to
e3382de
Compare
@@ -26,7 +26,7 @@ import PlutusTx.TH (compile) | |||
|
|||
tests :: TestTree | |||
tests = | |||
runTestNested ["test-plugin", "Spec", "Data", "SriptContext"] . pure . testNestedGhc $ | |||
runTestNested ["test-plugin", "Spec", "Data", "ScriptContext"] . pure . testNestedGhc $ |
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 causes the following file renames:
plutus-ledger-api/test-plugin/Spec/Data/ScriptContext/9.6/alwaysSucceeds.pir.golden
plutus-ledger-api/test-plugin/Spec/Data/ScriptContext/9.6/alwaysSucceeds.uplc.golden
plutus-ledger-api/test-plugin/Spec/Data/ScriptContext/9.6/succeedsIfHasDatum.pir.golden
plutus-ledger-api/test-plugin/Spec/Data/ScriptContext/9.6/succeedsIfHasDatum.uplc.golden
But the contents stayed the same
|
||
, goldenBudget "sumAtIndices" (compiledSumAtIndices `unsafeApplyCode` sumAtIndicesInput) | ||
, goldenUPlcReadable "sumAtIndices" compiledSumAtIndices | ||
, goldenPirReadableU "sumAtIndices" compiledSumAtIndices |
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 assume this is a typo: goldenPirReadableU
was meant to be goldenPirReadable
.
The new goldenBundle'
function uses goldenPirReadable
and this is why we get a different .pir.golden
|
||
, goldenBudget "show" compiledShow | ||
, goldenUPlcReadable "show" compiledShow | ||
, goldenPirReadable "show" compiledShow |
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.
goldenEvalCekCatch
missing for "show"
. I assumed this is an oversight, and replaced these tests with goldenBundle
@@ -0,0 +1 @@ | |||
(con integer -2469135780) |
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.
@@ -0,0 +1,27 @@ | |||
(program |
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.
@@ -0,0 +1,54 @@ | |||
(let |
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.
, goldenUPlcReadable "inlineLocalOnce" compiledInlineLocalOnce | ||
, goldenEvalCekCatch | ||
"inlineLocalOnce" | ||
[compiledInlineLocalOnce `unsafeApplyCode` liftCodeDef 2] |
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.
goldenBudget
missing for inlineLocalOnce
. I assumed this is an oversight, and replaced these tests with goldenBundle
@@ -0,0 +1,3 @@ | |||
cpu: 597469 |
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.
, goldenEvalCekCatch "ifThenElse2" [compiledIfThenElse2] | ||
|
||
, goldenBudget "matchAsDataE" matchAsData | ||
, goldenEvalCekCatch "matchAsDataE" [matchAsData] |
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.
goldenPirReadable
and goldenUPlcReadable
missing for "matchAsDataE". I assumed this is an oversight, and replaced these tests with goldenBundle
@@ -1,10 +1,9 @@ | |||
\(d-1579 : data) -> | |||
\(d : data) -> |
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.
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.
Good idea.
For many budget tests we want a golden PIR test, a golden UPLC test, a golden budget test and a golden evaluation test, so we write these four lines:
This is quite repetitive. This PR introduces two new functions
goldenBundle
andgoldenBundle'
that do these four things.