Review & fix acceptance tests
Temporarily using the 'specialize-dict-key' branch from the stdlib which makes use of Pair where relevant. Once this is merged back into 'main' we should update the acceptance test toml files to keep getting them automatically upgraded. This commit also fixes an oversight in the reification of data-types now properly distinguishing between pairs and 2-tuples. Co-authored-by: Microproofs <kasey.white@cardanofoundation.org>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use aiken/dict
|
||||
use aiken/list
|
||||
use aiken/transaction.{Mint, ScriptContext}
|
||||
use aiken/transaction/value
|
||||
|
||||
@@ -36,6 +37,7 @@ fn assert_mint(purpose, transaction) {
|
||||
}
|
||||
|
||||
fn assert_redeemers(ctx, my_redeemer) {
|
||||
expect Some(redeemer) = dict.get(ctx.transaction.redeemers, ctx.purpose)
|
||||
my_redeemer == redeemer && dict.size(ctx.transaction.redeemers) == 1
|
||||
expect Some(Pair(_, redeemer)) =
|
||||
list.find(ctx.transaction.redeemers, fn(kv) { kv.1st == ctx.purpose })
|
||||
my_redeemer == redeemer && list.length(ctx.transaction.redeemers) == 1
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use aiken/dict
|
||||
use aiken/list
|
||||
use aiken/transaction.{ScriptContext}
|
||||
use aiken/transaction/credential.{
|
||||
Inline, ScriptCredential, VerificationKeyCredential,
|
||||
@@ -21,15 +21,17 @@ validator {
|
||||
)
|
||||
|
||||
and {
|
||||
when dict.get(ctx.transaction.withdrawals, alice) is {
|
||||
when
|
||||
list.find(ctx.transaction.withdrawals, fn(kv) { kv.1st == alice })
|
||||
is {
|
||||
None -> fail @"alice's withdrawal not found"
|
||||
Some(value) -> value == 42
|
||||
Some(value) -> value.2nd == 42
|
||||
},
|
||||
when dict.get(ctx.transaction.withdrawals, bob) is {
|
||||
when list.find(ctx.transaction.withdrawals, fn(kv) { kv.1st == bob }) is {
|
||||
None -> fail @"bob's withdrawal not found"
|
||||
Some(value) -> value == 14
|
||||
Some(value) -> value.2nd == 14
|
||||
},
|
||||
dict.keys(ctx.transaction.withdrawals) == [alice, bob],
|
||||
list.map(ctx.transaction.withdrawals, fn(kv) { kv.1st }) == [alice, bob],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user