Add new acceptance test scenario (012)
```
Error:
× Main thread panicked.
├─▶ at crates/lang/src/uplc.rs:3413:34
╰─▶ internal error: entered unreachable code: Var {
scope: [
0,
1,
3,
24,
25,
29,
32,
],
constructor: ValueConstructor {
public: false,
variant: LocalVariable {
location: 46..62,
},
tipo: Fn {
args: [
Var {
tipo: RefCell {
value: Link {
tipo: App {
public: true,
module: "",
name: "Int",
args: [],
},
},
},
},
],
ret: App {
public: true,
module: "",
name: "Bool",
args: [],
},
},
},
name: "f",
variant_name: "",
}
```
This commit is contained in:
parent
f53caff538
commit
9c902cdf89
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "acceptance_test_012"
|
||||||
|
version = "0.0.0"
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
use aiken/builtin
|
||||||
|
|
||||||
|
pub fn filter(xs: List<a>, f: fn(a) -> Bool) -> List<a> {
|
||||||
|
when xs is {
|
||||||
|
[] -> []
|
||||||
|
[x, ..rest] ->
|
||||||
|
if f(x) {
|
||||||
|
[x, ..filter(rest, f)]
|
||||||
|
} else {
|
||||||
|
filter(rest, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test filter_1() {
|
||||||
|
filter([1,
|
||||||
|
2, 3, 4, 5, 6], fn(x) { builtin.mod_integer(x, 2) == 0 }) == [2, 4, 6]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue