Add tests for zero arg cyclic functions and renamed function aliases
This commit is contained in:
33
examples/acceptance_tests/099/lib/bar.ak
Normal file
33
examples/acceptance_tests/099/lib/bar.ak
Normal file
@@ -0,0 +1,33 @@
|
||||
use aiken/list.{count as my_count} as native_list
|
||||
|
||||
test thing_1() {
|
||||
let x =
|
||||
[1, 2, 3, 4, 5, 5]
|
||||
|
||||
my_count(x, fn(item) { item > 0 }) == 6
|
||||
}
|
||||
|
||||
test thing_2() {
|
||||
let x =
|
||||
[1, 2, 3, 4, 5, 5]
|
||||
|
||||
native_list.count(x, fn(item) { item > 0 }) == 6
|
||||
}
|
||||
|
||||
test thing_3() {
|
||||
let x =
|
||||
[1, 2, 3, 4, 5, 5]
|
||||
|
||||
let my_countx = my_count
|
||||
|
||||
my_countx(x, fn(item) { item > 0 }) == 6
|
||||
}
|
||||
|
||||
test thing_4() {
|
||||
let x =
|
||||
[1, 2, 3, 4, 5, 5]
|
||||
|
||||
let my_countx = native_list.count
|
||||
|
||||
my_countx(x, fn(item) { item > 0 }) == 6
|
||||
}
|
||||
43
examples/acceptance_tests/099/lib/foo.ak
Normal file
43
examples/acceptance_tests/099/lib/foo.ak
Normal file
@@ -0,0 +1,43 @@
|
||||
fn countdown_1() {
|
||||
fn(x) {
|
||||
if x > 4 {
|
||||
countdown_3()
|
||||
} else {
|
||||
x - countdown_2()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn countdown_2() {
|
||||
countdown_1()(5)
|
||||
}
|
||||
|
||||
fn countdown_3() {
|
||||
3
|
||||
}
|
||||
|
||||
fn countdown_4() {
|
||||
fn(x) {
|
||||
if x > 4 {
|
||||
countdown_6()
|
||||
} else {
|
||||
x - countdown_5(x + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn countdown_5(x: Int) {
|
||||
countdown_4()(x)
|
||||
}
|
||||
|
||||
fn countdown_6() {
|
||||
3
|
||||
}
|
||||
|
||||
test cycle_zero_arg_1() {
|
||||
countdown_1()(3) == 0
|
||||
}
|
||||
|
||||
test cycle_zero_arg_2() {
|
||||
countdown_4()(3) == 2
|
||||
}
|
||||
Reference in New Issue
Block a user