From d9cfad8f6823212477cd8a5a2c660cbea0152402 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Mon, 13 Feb 2023 11:09:07 +0100 Subject: [PATCH] Add new acceptance test scenario: 061 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` Error: × Main thread panicked. ├─▶ at crates/uplc/src/optimize.rs:16:68 ╰─▶ called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text: "tests_tx_1", unique: Unique(14) }) ``` --- examples/acceptance_tests/061/aiken.lock | 13 ++++ examples/acceptance_tests/061/aiken.toml | 8 ++ examples/acceptance_tests/061/lib/tests.ak | 85 ++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 examples/acceptance_tests/061/aiken.lock create mode 100644 examples/acceptance_tests/061/aiken.toml create mode 100644 examples/acceptance_tests/061/lib/tests.ak diff --git a/examples/acceptance_tests/061/aiken.lock b/examples/acceptance_tests/061/aiken.lock new file mode 100644 index 00000000..0423f31b --- /dev/null +++ b/examples/acceptance_tests/061/aiken.lock @@ -0,0 +1,13 @@ +# This file was generated by Aiken +# You typically do not need to edit this file + +[[requirements]] +name = "aiken-lang/stdlib" +version = "main" +source = "github" + +[[packages]] +name = "aiken-lang/stdlib" +version = "main" +requirements = [] +source = "github" diff --git a/examples/acceptance_tests/061/aiken.toml b/examples/acceptance_tests/061/aiken.toml new file mode 100644 index 00000000..1b2e4d85 --- /dev/null +++ b/examples/acceptance_tests/061/aiken.toml @@ -0,0 +1,8 @@ +name = 'aiken-lang/acceptance_test_061' +version = '0.0.0' +description = '' + +[[dependencies]] +name = 'aiken-lang/stdlib' +version = 'main' +source = 'github' diff --git a/examples/acceptance_tests/061/lib/tests.ak b/examples/acceptance_tests/061/lib/tests.ak new file mode 100644 index 00000000..176b3ff0 --- /dev/null +++ b/examples/acceptance_tests/061/lib/tests.ak @@ -0,0 +1,85 @@ +use aiken/dict +use aiken/interval.{Interval, IntervalBound, PositiveInfinity} +use aiken/transaction.{ + InlineDatum, Input, Output, OutputReference, Transaction, TransactionId, +} +use aiken/transaction/credential.{ + Address, ScriptCredential, StakeCredential, VerificationKeyCredential, +} +use aiken/transaction/value + +const keyhash = #"010203040506" + +const scripthash = #"060504030201" + +pub fn keyhash_address(with_stake_credential: Option) { + Address { + payment_credential: VerificationKeyCredential(keyhash), + stake_credential: with_stake_credential, + } +} + +pub fn scripthash_address(with_stake_credential: Option) { + Address { + payment_credential: ScriptCredential(scripthash), + stake_credential: with_stake_credential, + } +} + +type SampleData { + a: Int, + b: ByteArray, +} + +pub fn tx_1() -> Transaction { + let sample_datum = SampleData { a: 1, b: #"01" } + let tx = + Transaction { + inputs: [ + Input { + output_reference: OutputReference { + transaction_id: TransactionId { hash: #"" }, + output_index: 0, + }, + output: Output { + address: scripthash_address(None), + value: value.zero(), + datum: InlineDatum(sample_datum), + reference_script: None, + }, + }, + ], + reference_inputs: [], + outputs: [ + Output { + address: keyhash_address(None), + value: value.from_lovelace(10000), + datum: InlineDatum(sample_datum), + reference_script: None, + }, + ], + fee: value.zero(), + mint: value.from_asset(#"000000", #"00", -1), + certificates: [], + withdrawals: dict.new(), + validity_range: Interval { + lower_bound: IntervalBound { + bound_type: PositiveInfinity, + is_inclusive: True, + }, + upper_bound: IntervalBound { + bound_type: PositiveInfinity, + is_inclusive: True, + }, + }, + extra_signatories: [keyhash], + redeemers: dict.new(), + datums: dict.new(), + id: TransactionId { hash: #"" }, + } + tx +} + +test some_test() { + tx_1() == tx_1() +}