Add tests for zero arg cyclic functions and renamed function aliases
This commit is contained in:
parent
22b86a5f82
commit
c7dcb2c256
|
@ -0,0 +1,15 @@
|
||||||
|
# This file was generated by Aiken
|
||||||
|
# You typically do not need to edit this file
|
||||||
|
|
||||||
|
[[requirements]]
|
||||||
|
name = "aiken-lang/stdlib"
|
||||||
|
version = "1.7.0"
|
||||||
|
source = "github"
|
||||||
|
|
||||||
|
[[packages]]
|
||||||
|
name = "aiken-lang/stdlib"
|
||||||
|
version = "1.7.0"
|
||||||
|
requirements = []
|
||||||
|
source = "github"
|
||||||
|
|
||||||
|
[etags]
|
|
@ -0,0 +1,14 @@
|
||||||
|
name = "aiken-lang/acceptance_test_096"
|
||||||
|
version = "0.0.0"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
description = "Aiken contracts for project 'aiken-lang/096'"
|
||||||
|
|
||||||
|
[repository]
|
||||||
|
user = "aiken-lang"
|
||||||
|
project = "096"
|
||||||
|
platform = "github"
|
||||||
|
|
||||||
|
[[dependencies]]
|
||||||
|
name = "aiken-lang/stdlib"
|
||||||
|
version = "1.7.0"
|
||||||
|
source = "github"
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue