Add new acceptance scenario: 065

-> The provided Plutus code called 'error'.

  This scenario _could_ work if `choose_data` was lazy in its arguments.
  Which is a reasonable thing to expect from `choose_data`. Since we
  don't have any way to introduce on-demand lazyness in the language
  (and we are not looking for ways), we need to make a special case for
  `choose_data` which is a perfect (and singular) use case for it.
This commit is contained in:
KtorZ 2023-02-17 16:59:07 +01:00 committed by Kasey
parent 553eb88d3d
commit dbef4474fa
3 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# This file was generated by Aiken
# You typically do not need to edit this file
requirements = []
packages = []

View File

@ -0,0 +1,3 @@
name = 'aiken-lang/acceptance_test_065'
version = '0.0.0'
description = ''

View File

@ -0,0 +1,49 @@
use aiken/builtin
type MyData {
Integer(Int)
Bytes(ByteArray)
}
test foo() {
inspect(42) == Integer(42) && inspect(#"ff") == Bytes(#"ff")
}
fn inspect(data: Data) -> MyData {
expect result: MyData =
builtin.choose_data(
data,
inspect_constr(data),
inspect_map(data),
inspect_list(data),
inspect_integer(data),
inspect_bytearray(data),
)
result
}
fn inspect_constr(_data: Data) -> Data {
todo
}
fn inspect_map(_data: Data) -> Data {
todo
}
fn inspect_list(_data: Data) -> Data {
todo
}
fn inspect_integer(data: Data) -> Data {
let result: Data =
builtin.un_i_data(data)
|> Integer
result
}
fn inspect_bytearray(data: Data) -> Data {
let result: Data =
builtin.un_b_data(data)
|> Bytes
result
}