Add new acceptance test scenario: 054.

**a**

  ```
  × Main thread panicked.
  ├─▶ at crates/uplc/src/optimize.rs:16:68
  ╰─▶ called `Result::unwrap()` on an `Err` value: FreeUnique(Name { text: "__other_clauses_delayed", unique: Unique(13) })
  ```

  **b**

  ```
  × Main thread panicked.
  ├─▶ at crates/aiken-lang/src/builder.rs:771:14
  ╰─▶ not yet implemented: Assign
  ```

  **c**

  ```
  × choice_4 failed
  help: ┍━ left ━━━━━━━━━━━━━┑
        │ (con data #d87a80) │
        ┕━━━━━━━━━━━━━━━━━━━━┙

        should be equal to

        ┍━ right ━━━━━━━━━━━━━━━━━━┑
        │ (con data #d8799f182aff) │
        ┕━━━━━━━━━━━━━━━━━━━━━━━━━━┙
  ```
This commit is contained in:
KtorZ 2023-02-08 19:14:41 +01:00 committed by Kasey White
parent dfe240ad64
commit d26ff0298f
5 changed files with 78 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_056"
version = "0.0.0"
dependencies = []

View File

@ -0,0 +1,24 @@
// Could possibly be forbidden by the parser instead if we have no intent to support that.
pub fn choice(self: List<Option<a>>) -> Option<a> {
when self is {
[] -> None
[Some(_) as result, ..] -> result
[None, ..others] -> choice(others)
}
}
test choice_1() {
choice([Some(14), Some(42)]) == Some(14)
}
test choice_2() {
choice([]) == None
}
test choice_3() {
choice([None]) == None
}
test choice_4() {
choice([None, Some(42)]) == Some(42)
}

View File

@ -0,0 +1,23 @@
pub fn choice(self: List<Option<a>>) -> Option<a> {
when self is {
[] -> None
[Some(x), ..] -> Some(x)
[None, ..others] -> choice(others)
}
}
test choice_1() {
choice([Some(14), Some(42)]) == Some(14)
}
test choice_2() {
choice([]) == None
}
test choice_3() {
choice([None]) == None
}
test choice_4() {
choice([None, Some(42)]) == Some(42)
}

View File

@ -0,0 +1,23 @@
pub fn choice(self: List<Option<a>>) -> Option<a> {
when self is {
[] -> None
[None, ..others] -> choice(others)
[result, ..] -> result
}
}
test choice_1() {
choice([Some(14), Some(42)]) == Some(14)
}
test choice_2() {
choice([]) == None
}
test choice_3() {
choice([None]) == None
}
test choice_4() {
choice([None, Some(42)]) == Some(42)
}