From c7dcb2c256867392b0d9e31606f9c155e60532fa Mon Sep 17 00:00:00 2001 From: microproofs Date: Sat, 9 Mar 2024 13:23:27 -0500 Subject: [PATCH] Add tests for zero arg cyclic functions and renamed function aliases --- examples/acceptance_tests/099/aiken.lock | 15 +++++++++ examples/acceptance_tests/099/aiken.toml | 14 ++++++++ examples/acceptance_tests/099/lib/bar.ak | 33 ++++++++++++++++++ examples/acceptance_tests/099/lib/foo.ak | 43 ++++++++++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 examples/acceptance_tests/099/aiken.lock create mode 100644 examples/acceptance_tests/099/aiken.toml create mode 100644 examples/acceptance_tests/099/lib/bar.ak create mode 100644 examples/acceptance_tests/099/lib/foo.ak diff --git a/examples/acceptance_tests/099/aiken.lock b/examples/acceptance_tests/099/aiken.lock new file mode 100644 index 00000000..0a72eb3c --- /dev/null +++ b/examples/acceptance_tests/099/aiken.lock @@ -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] diff --git a/examples/acceptance_tests/099/aiken.toml b/examples/acceptance_tests/099/aiken.toml new file mode 100644 index 00000000..97bd72b9 --- /dev/null +++ b/examples/acceptance_tests/099/aiken.toml @@ -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" diff --git a/examples/acceptance_tests/099/lib/bar.ak b/examples/acceptance_tests/099/lib/bar.ak new file mode 100644 index 00000000..57fd9c28 --- /dev/null +++ b/examples/acceptance_tests/099/lib/bar.ak @@ -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 +} diff --git a/examples/acceptance_tests/099/lib/foo.ak b/examples/acceptance_tests/099/lib/foo.ak new file mode 100644 index 00000000..a435d49c --- /dev/null +++ b/examples/acceptance_tests/099/lib/foo.ak @@ -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 +}