-
Notifications
You must be signed in to change notification settings - Fork 486
Add goldenBundle
and goldenBundle'
test functions
#7057
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
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.
See this comment https://github.com/IntersectMBO/plutus/pull/7057/files#r2057929435
@@ -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.
See this comment https://github.com/IntersectMBO/plutus/pull/7057/files#r2057938509
@@ -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.
See this comment https://github.com/IntersectMBO/plutus/pull/7057/files#r2057938509
, 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.
See this comment https://github.com/IntersectMBO/plutus/pull/7057/files#r2057934202
, 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.
See this comment https://github.com/IntersectMBO/plutus/pull/7057/files#r2057916196
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.
9d28d91
to
4f18c97
Compare
d94ada7
to
31c0144
Compare
31c0144
to
351a4e8
Compare
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.