Skip to content

Commit

Permalink
test: fix acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rvcas committed Aug 16, 2023
1 parent 80e4a5c commit f4d0f23
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 55 deletions.
16 changes: 8 additions & 8 deletions examples/acceptance_tests/038/lib/tests.ak
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
pub fn and(self: List<Bool>) -> Bool {
pub fn and_f(self: List<Bool>) -> Bool {
when self is {
[] ->
True
[x, ..xs] ->
x && and(xs)
x && and_f(xs)
}
}

test and_1() {
and([True, True])
test and_f_1() {
and_f([True, True])
}

pub fn or(self: List<Bool>) -> Bool {
pub fn or_f(self: List<Bool>) -> Bool {
when self is {
[] ->
False
[x, ..xs] ->
x || or(xs)
x || or_f(xs)
}
}

test or_1() {
or([True, True])
test or_f_1() {
or_f([True, True])
}
4 changes: 2 additions & 2 deletions examples/acceptance_tests/055/lib/tests.ak
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use aiken/bytearray
use aiken/dict
use aiken/hash.{Hash, Sha2_256, sha2_256}
use aiken/interval.{between, intersection, is_empty, strictly_between}
use aiken/interval.{between, intersection, is_empty, entirely_between}
use aiken/list
use aiken/transaction.{InlineDatum}

Expand Down Expand Up @@ -87,7 +87,7 @@ test intersection_3() {
let iv1 =
between(0, 1)
let iv2 =
strictly_between(1, 2)
entirely_between(1, 2)
intersection(iv1, iv2)
|> is_empty
}
Expand Down
2 changes: 1 addition & 1 deletion examples/acceptance_tests/061/lib/tests.ak
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn tx_1() -> Transaction {
},
],
fee: value.zero(),
mint: value.from_asset(#"000000", #"00", -1),
mint: value.from_asset(#"000000", #"00", -1) |> value.to_minted_value,
certificates: [],
withdrawals: dict.new(),
validity_range: Interval {
Expand Down
8 changes: 4 additions & 4 deletions examples/acceptance_tests/068/lib/tests.ak
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ pub fn flatten_with(
self: Value,
transform: fn(PolicyId, AssetName, Int) -> Option<result>,
) -> List<result> {
dict.fold(
dict.foldr(
self.inner,
[],
fn(policy_id, asset, assets) {
dict.fold(
dict.foldr(
asset,
assets,
fn(asset_name, quantity, xs) {
when transform(policy_id, asset_name, quantity) is {
None ->
Expand All @@ -82,10 +84,8 @@ pub fn flatten_with(
[x, ..xs]
}
},
assets,
)
},
[],
)
}

Expand Down
4 changes: 2 additions & 2 deletions examples/acceptance_tests/077/plutus.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
}
}
],
"compiledCode": "5901ac010000323232323232323232323223222232533300b32323232533300f3370e9000180700089919191919191919191919299980e98100010991919299980e99b874800000454ccc074c8cc004004030894ccc08800452809919299981099baf3301d301f00248000068528899802002000981300118120008a99980e99b87002480084cdc780180b8a501616301b014375a603a0046eb8c06c00458c078004c8c94ccc068cdc3a4004002297adef6c601323756604000260300046030002646600200200444a66603a0022980103d87a8000132323232533301e3371e01c004266e95200033022374c00297ae01330060060033756603e0066eb8c074008c084008c07c004dd5980e000980e000980d800980d000980c8011bac3017001300f005375c602a002601a0022c60260026026004602200260120042930b19299980599b874800000454ccc038c02400c526161533300b3370e90010008a99980718048018a4c2c2c60120046eb8004cc0040052000222233330073370e0020060184666600a00a66e000112002300e001002002230053754002460066ea80055cd2ab9d5573caae7d5d02ba15745",
"hash": "d6a785c18cf272d65dbbaee1c06b4024dd8e42ab4ade95872020b1ea"
"compiledCode": "5901f4010000323232323232323232323223222232533300b32323232533300f3370e9000180700089919191919191919191919299980e98100010991919299980e99b874800000454ccc074c8cc004004030894ccc08800452809919299981099baf3301d301f00248000068528899802002000981300118120008a99980e99b87002480084cdc780180b8a501616301b014375a603a0046eb8c06c00458c078004c8c8c94ccc06ccdc3a4004002297adef6c601323756604200260320046032002646600200200444a66603c0022980103d87a8000132323232533301f3371e01e004266e95200033023374c00297ae0133006006003375660400066eb8c078008c088008c080004c8cc004004008894ccc07400452f5bded8c0264646464a66603c66e3d221000021003133022337606ea4008dd3000998030030019bab301f003375c603a0046042004603e0026eacc070004c070004c06c004c068004c064008dd6180b80098078029bae3015001300d001163013001301300230110013009002149858c94ccc02ccdc3a40000022a66601c60120062930b0a99980599b874800800454ccc038c02400c52616163009002375c0026600200290001111199980399b8700100300c233330050053370000890011807000801001118029baa001230033754002ae6955ceaab9e5573eae815d0aba201",
"hash": "d9923c678f323fa0aa77a78dedc323df6686c54ba9ceb8a1baef639f"
}
],
"definitions": {
Expand Down
3 changes: 2 additions & 1 deletion examples/acceptance_tests/077/validators/spend.ak
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ validator(token_name: ByteArray, utxo_ref: OutputReference) {
transaction

expect [(asset_name, amount)] = mint
|> value.from_minted_value
|> value.tokens(policy_id)
|> dict.to_list()

Expand All @@ -34,4 +35,4 @@ validator(token_name: ByteArray, utxo_ref: OutputReference) {
todo @"burn"
}
}
}
}
6 changes: 2 additions & 4 deletions examples/acceptance_tests/082/lib/tests.ak
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ test satisfying() {
fn(n: NativeScript, s: List<ByteArray>, v: ValidityRange) {
!satisfied(n, s, v)
}
list.and(
[
and {
satisfied(sig1, [keyHash1], validRange(0, 1))?,
satisfied(sig2, [keyHash1, keyHash2], validRange(0, 1))?,
satisfied(allOf, [keyHash1, keyHash2], validRange(0, 1))?,
Expand Down Expand Up @@ -181,6 +180,5 @@ test satisfying() {
unsatisfied(vesting, [keyHash3], validRange(10, 10))?,
unsatisfied(vesting, [keyHash3], validRange(0, 5))?,
unsatisfied(vesting, [keyHash3], validRange(15, 20))?,
],
)
}
}
16 changes: 8 additions & 8 deletions examples/acceptance_tests/script_context/plutus.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"$ref": "#/definitions/Void"
}
},
"compiledCode": "59041101000032323232323232323232322225333008323232300200132323301033300c3233300d3375e660126016002900b26126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff004a0944cc020c02801520004c0103d87a80004c0103d87980003301033300c3232533300e3370e900100089919299980819baf3300c300e00148001300126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff0013370e6eb4cc030c038005200248000528180a00098060010b1806000998041805002a4004980103d87a80004c0103d87980003301033300c32325333011001161325333012001132323008001330143330103375e66018601c00290011ba6300548202a35ae41d30103d87a80004c0103d8798000330143330103375e66018601c66018601c002900024000980122d8799f581c11111111111111111111111111111111111111111111111111111111ff004c0103d87a80004c0103d879800033014333010323253330123370e9000000899250301000214a2602000266018601c66018601c002900024004980103d87a80004c0103d8798000330143330103375e66018601c0029002260103d87980004c0103d87a80004c0103d8798000330143330103375e66018601c0029003260103d87a80004c0103d87a80004c0103d87980004bd70180a0010b180a0009bac33009300b00148010cc020c02801520004c0103d87a80004c0103d87980003301033300c323375e66012601600290031ba6300248150cc020c02801520004c103d87a80004c0103d87980004bd701299980619b870014800052f5bded8c0264646600200297adef6c6022533301200113301333760981014000374c00697adef6c6013232323253330133375e66012911000024c103d879800013301733760981014000374c00e00a2a66602666e3d22100002133017337609801014000374c00e00626602e66ec0dd48011ba600133006006003375660280066eb8c048008c058008c050004c8cc0040052f5bded8c044a66602200226602466ec13001014000375000697adef6c6013232323253330123375e66010911000024c103d879800013301633760981014000375000e00a2a66602466e3d22100002133016337609801014000375000e00626602c66ec0dd48011ba800133006006003375a60260066eb8c044008c054008c04c004894ccc030cdc80010008a6103d87980001533300c3371e0040022980103d87a800014c103d87b8000300100122533300d00114a226464a6660180042660080080022940c044008cdc3a400460166ea8c03c0045261633001001480008888cccc01ccdc38008018061199980280299b8000448008c0380040080088c014dd5000918019baa0015734aae7555cf2ab9f5740ae855d101",
"hash": "5c94c8313d993d3fc3ffc48351494f24cac01d35004f15b243878fcd"
"compiledCode": "590350010000323232323232323232323222253330085333008323330093375e6600a600e002900b260126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff004a0944cc010c0180052000153330083232533300a3370e900100089919299980619baf33008300a0014800130126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff0013370e6eb4cc020c028005200248000528180800098040010b1804000998021803000a400426464a6660146464a66601e0022c264a666020002264a66601c66ebccc028c0300052002374c600a9040546b5c838a99980719baf3300a300c3300a300c0014800120004c122d8799f581c11111111111111111111111111111111111111111111111111111111ff001533300e323253330103370e9000000899250300e00214a2601c0026601460186601460180029000240042a66601c66ebccc028c03000520044c0103d879800013375e6601460180029003260103d87a800014a029405280a50301200216301200137586600e60120029002198031804001a400026466ebccc01cc0240052006374c6004902a198031804001a4000294094ccc028cdc3800a4000297adef6c6013232330010014bd6f7b63011299980800089980899bb04c01014000374c00697adef6c6013232323253330113375e66012911000024c103d879800013301533760981014000374c00e00a2a66602266e3d22100002133015337609801014000374c00e00626602a66ec0dd48011ba600133006006003375660240066eb8c040008c050008c048004c8cc0040052f5bded8c044a66601e00226602066ec13001014000375000697adef6c6013232323253330103375e66010911000024c103d879800013301433760981014000375000e00a2a66602066e3d22100002133014337609801014000375000e00626602866ec0dd48011ba800133006006003375a60220066eb8c03c008c04c008c044004894ccc028cdc80010008a6103d87980001533300a3371e0040022980103d87a800014c103d87b800014a029405261633001001480008888cccc01ccdc38008018061199980280299b8000448008c0380040080088c014dd5000918019baa0015734aae7555cf2ab9f5740ae855d11",
"hash": "215e00b8448b9d2742520a2fa9e8c64ee8211817fcf8e83589b31c43"
},
{
"title": "deploy.spend",
Expand All @@ -36,8 +36,8 @@
"$ref": "#/definitions/Data"
}
},
"compiledCode": "5902f90100003232323232323232323232222533300832323230020013300e33300a3375e00a980103d87980004c0103d87a80004c0103d87980003300e33300a33232232533300e3370e900018068008991919299980899baf4c106d8799f182aff0000213370e600c00a90020a503253330113370e900000089919299980b180c8010a4c2c6eb4c05c004c03c00858c03c004c050004c03000458c8c8cc00400400c894ccc04c004530103d87a800013232323253330143371e00e004266e952000330180014bd70099803003001980a8019bae3013002301700230150013237280026ecd30106d8799f182aff00300100122533300f0011480004c8cdc0240046600600600260240026eaccc018c020cc018c02000d20004805130103d87a80004c0103d87980003300e33300a32533300e00116132533300f0011613232533300e3230060013301233300e3375e660146018004900226126d87a9f5820fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273ff004c0103d87a80004c0103d87980003301233300e3375e6601460180049003260122d8799f581ce37db487fbd58c45d059bcbf5cd6b1604d3bec16cf888f1395a4ebc4ff004c0103d87a80004c0103d87980004bd7009918030009980919980719baf3300a300c3300a300c0014800120024c12ad8799fd8799fd8799f581c66666666666666666666666666666666666666666666666666666666ffffff004c0103d87a80004c0103d87980003301233300e323253330103370e9002000899251300e00216300e0013300a300c0014801130103d87a80004c0103d87980004bd700a5030120023011002301100137586600c60106600c6010006900024008980103d87a80004c0103d87980004bd7018008009129998068008a5113232533300c00213300400400114a0602200466e1d2002300b3754601e0022930b19800800a40004444666600e66e1c00400c0308cccc014014cdc000224004601c0020040044600a6ea80048c00cdd5000ab9a5573aaae7955cfaba05742ae89",
"hash": "7952981319aa78416c03695a3527e9ec34cba485d6c46afd5b1f89e5"
"compiledCode": "5902480100003232323232323232323232222533300853330083375e00698103d87980001533300833232232533300c3370e900018058008991919299980799baf4c0106d8799f182aff0000213370e600c00a90020a5032533300f3370e900000089919299980a180b8010a4c2c6eb4c054004c03400858c034004c048004c02800458c8c8cc00400400c894ccc044004530103d87a800013232323253330123371e00e004266e952000330160014bd7009980300300198098019bae3011002301500230130013237280026ecd30106d8799f182aff00300100122533300d0011480004c8cdc0240046600600600260200026eaccc010c018cc010c0180052000480504c94ccc030004584c94ccc034004584c8c94ccc0314ccc030cdd79980418050012400898126d87a9f5820fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273ff0013375e6601060140049003260122d8799f581ce37db487fbd58c45d059bcbf5cd6b1604d3bec16cf888f1395a4ebc4ff0014a02a66601866ebccc020c028cc020c0280052000480093012ad8799fd8799fd8799f581c66666666666666666666666666666666666666666666666666666666ffffff0013232533300e3370e9002000899251300c00216300c00133008300a001480105280a503010002300f002300f001375866008600c66008600c00290002400829405280a4c2c6600200290001111199980399b8700100300c233330050053370000890011807000801001118029baa001230033754002ae6955ceaab9e5573eae815d0aba201",
"hash": "401017bb7492cde875cbfa9cec46ba71a4285de9c15e2b87bf12d46c"
},
{
"title": "mint.mint",
Expand All @@ -47,8 +47,8 @@
"$ref": "#/definitions/Data"
}
},
"compiledCode": "590360010000323232323232323232323222533300732332300100122533300d00114a226464a6660180042660080080022940c044008cdc3a400460166ea8c03c004004c8c8cc034ccc024cc8c88c8c94ccc044c0500084c94ccc03ccdc3a4000601c0022646466e3c010004dd7180a80098068008b198051806001a40042c6eb8c048004c8c8c8c014004cc01c0052210030050013756660106014660106014002900024010600200244a66601c002297ae013232323301237520026600a00a0046eb8c038008c048008c04000400d300103d87a80004c0103d87980003300d3330093322533300b3370e9000180500109919191919299980819b8748008004584c8c8cdc3800a41e4286eb4c058004c038008c038004c8cc004004008894ccc04c004530103d87a800013232323253330143371e91103666f6f0000213374a90001980c1ba80014bd700998030030019bad3015003375c6026004602e004602a00266446464a66602266e1d200200114bd6f7b6300991bab3017001300f002300f001323300100100322533301400114c0103d87a800013232323253330153371e00e004266e95200033019374c00297ae01330060060033756602c0066eb8c050008c060008c058004c8c018004dd5998049805801a40100026eb8c044004c02400858cc014c01c00d20023300530070034800130103d87a80004c0103d87980003300d3330093332322232533300e3370e9000180680089919299980819baf00400113370e64600e0026eaccc030c038cc030c038015200048049200214a0602800260180022c6644646600200200644a6660280022980103d87a800013232323253330153375e00e004266e952000330190014bd70099803003001980b001980a001180c001180b0009bab33009300b33009300b00248001201233009300b00248008c004004894ccc0380045200013233700900119801801800980880080180226103d87a80004c0103d87980004bd70119801000a4410022323300100100322533300e00114bd6f7b630099191919299980799b8f0070021003133013337606ea4008dd3000998030030019bab3010003375c601c004602400460200022930b19800800a40004444666600e66e1c00400c0308cccc014014cdc000224004601c0020040044600a6ea80048c00cdd5000ab9a5573aaae7955cfaba05742ae89",
"hash": "6bc1de8b758d615f10ada056e8c95e0c9e38ce60cdd498535fbb3404"
"compiledCode": "590301010000323232323232323232323222533300732325333009332322323253330113014002132533300f3370e900018070008991919b8f004001375c602a002601a0022c66014601800690010b1bae301200132323230050013300700148810030050013756660106014660106014002900024010600200244a66601c002297ae013232323301237520026600a00a0046eb8c038008c048008c04000400c54ccc024cc894ccc02ccdc3a4000601400426464646464a66602066e1d200200116132323370e00290790a1bad3016001300e002300e001323300100100222533301300114c103d87a800013232323253330143371e91103666f6f0000213374a90001980c1ba80014bd700998030030019bad3015003375c6026004602e004602a00266446464a66602266e1d200200114bd6f7b6300991bab3017001300f002300f001323300100100322533301400114c0103d87a800013232323253330153371e00e004266e95200033019374c00297ae01330060060033756602c0066eb8c050008c060008c058004c8c018004dd5998049805801a40100026eb8c044004c02400858cc014c01c00d2002330053007003480004ccc8c888c94ccc038cdc3a4000601a00226464a66602066ebc0100044cdc39918038009bab3300c300e3300c300e00548001201248008528180a00098060008b1991191980080080191299980a0008a60103d87a800013232323253330153375e00e004266e952000330190014bd70099803003001980b001980a001180c001180b0009bab33009300b33009300b00248001201233009300b00248008c004004894ccc038004520001323370090011980180180098088008018020a5014a046600400291010022323300100100322533300e00114bd6f7b630099191919299980799b8f0070021003133013337606ea4008dd3000998030030019bab3010003375c601c004602400460200022930b19800800a40004444666600e66e1c00400c0308cccc014014cdc000224004601c0020040044600a6ea80048c00cdd5000ab9a5573aaae7955cfaba05742ae89",
"hash": "f1b23827b230c507b6553ff0733385755c1903c0b23850f720eaf156"
},
{
"title": "withdrawals.spend",
Expand All @@ -64,8 +64,8 @@
"$ref": "#/definitions/Void"
}
},
"compiledCode": "5902600100003232323232323232323232222533300832332300100122533300e00114a226464a66601a0042660080080022940c048008cdc3a400460186ea8c040004004c8cc034ccc024c8c94ccc02ccdc3a40040022c2646466e1c0052054375a602200260120046012002660026eaccc014c01ccc014c01c009200048031300126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff004c0103d87a80004c0103d87980003300d3330093232533300b3370e90010008b0991919b8700148070dd6980880098048011804800998009bab33005300733005300700248001200c4c126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff004c0103d87a80004c0103d87980003300d3330093375e6e9ccc8c88c008004c004004894ccc03800452f5c02646464660240026600a00a004601c004602400460200026eaccc014c01ccc014c01c009200048030dd399806a6126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff003300d4c126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff004bd7026103d87a80004c0103d87980004bd701119198008008019129998078008a6103d87a800013232323253330103375e00e004266e95200033014375000297ae0133006006003375a6022006601e004602600460220022930b19800800a40004444666600e66e1c00400c0308cccc014014cdc000224004601c0020040044600a6ea80048c00cdd5000ab9a5573aaae7955cfaba05742ae89",
"hash": "01981ce85b9080b75b298fda6204475724d9534843d438371e1bde6e"
"compiledCode": "590201010000323232323232323232323222253330083253330093232533300b3370e90010008b0991919b8700148150dd6980880098048011804800998009bab33005300733005300700248001200c4c126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff00153330093232533300b3370e90010008b0991919b8700148070dd6980880098048011804800998009bab33005300733005300700248001200c4c0126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff0013375e6e9ccc8c88c008004c004004894ccc03800452f5c02646464660240026600a00a004601c004602400460200026eaccc014c01ccc014c01c009200048030dd399806a6126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff003300d4c126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff004bd700a5014a044646600200200644a66601e002298103d87a800013232323253330103375e00e004266e95200033014375000297ae0133006006003375a6022006601e004602600460220022930b19800800a40004444666600e66e1c00400c0308cccc014014cdc000224004601c0020040044600a6ea80048c00cdd5000ab9a5573aaae7955cfaba05742ae89",
"hash": "c672d5841647d03d10fae5a472e2c33dc14388fd699c1a6be9257ebf"
}
],
"definitions": {
Expand Down
11 changes: 4 additions & 7 deletions examples/acceptance_tests/script_context/validators/basic.ak
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
use aiken/list
use aiken/option
use aiken/transaction.{NoDatum, ScriptContext, Spend, TransactionId}
use aiken/transaction/credential.{VerificationKeyCredential}
use aiken/transaction/value

validator {
fn spend(_datum: Void, _redeemer: Void, ctx: ScriptContext) {
[
and {
assert_id(ctx.transaction),
assert_purpose(ctx.purpose),
assert_outputs(ctx.transaction),
assert_fee(ctx.transaction),
]
|> list.and
}
}
}

Expand All @@ -39,16 +37,15 @@ fn assert_fee(transaction) {
fn assert_outputs(transaction) {
when transaction.outputs is {
[output] ->
[
and {
output.value == value.from_lovelace(1000000000),
output.address.payment_credential == VerificationKeyCredential(
#"11111111111111111111111111111111111111111111111111111111",
),
option.is_none(output.address.stake_credential),
output.datum == NoDatum,
output.reference_script == None,
]
|> list.and
}
_ -> fail @"unexpected number of outputs"
}
}
Loading

0 comments on commit f4d0f23

Please sign in to comment.