diff --git a/examples/acceptance_tests/095/aiken.lock b/examples/acceptance_tests/095/aiken.lock deleted file mode 100644 index 17a9c623..00000000 --- a/examples/acceptance_tests/095/aiken.lock +++ /dev/null @@ -1,16 +0,0 @@ -# This file was generated by Aiken -# You typically do not need to edit this file - -[[requirements]] -name = "aiken-lang/stdlib" -version = "main" -source = "github" - -[[packages]] -name = "aiken-lang/stdlib" -version = "main" -requirements = [] -source = "github" - -[etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1709304545, nanos_since_epoch = 842241000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/095/aiken.toml b/examples/acceptance_tests/095/aiken.toml deleted file mode 100644 index 0020ed78..00000000 --- a/examples/acceptance_tests/095/aiken.toml +++ /dev/null @@ -1,8 +0,0 @@ -name = "aiken-lang/acceptance_test_095" -version = "0.0.0" -description = "" - -[[dependencies]] -name = "aiken-lang/stdlib" -version = "main" -source = "github" diff --git a/examples/acceptance_tests/095/lib/aiken/fuzz.ak b/examples/acceptance_tests/095/lib/aiken/fuzz.ak deleted file mode 100644 index 2c9589a9..00000000 --- a/examples/acceptance_tests/095/lib/aiken/fuzz.ak +++ /dev/null @@ -1,122 +0,0 @@ -use aiken/builtin - -const max_int: Int = 255 - -// Primitives - -pub fn any_int() -> Fuzzer { - fn(prng: PRNG) -> Option<(PRNG, Int)> { - when prng is { - Seeded { seed, choices } -> { - let digest = - seed - |> builtin.integer_to_bytearray(True, 32, _) - |> builtin.blake2b_256() - - let choice = - digest - |> builtin.index_bytearray(0) - - let new_seed = - digest - |> builtin.slice_bytearray(1, 4, _) - |> builtin.bytearray_to_integer(True, _) - - Some((Seeded { seed: new_seed, choices: [choice, ..choices] }, choice)) - } - - Replayed { choices } -> - when choices is { - [] -> None - [head, ..tail] -> - if head >= 0 && head <= max_int { - Some((Replayed { choices: tail }, head)) - } else { - None - } - } - } - } -} - -pub fn constant(a: a) -> Fuzzer { - fn(s0) { Some((s0, a)) } -} - -pub fn and_then(fuzz_a: Fuzzer, f: fn(a) -> Fuzzer) -> Fuzzer { - fn(s0) { - when fuzz_a(s0) is { - Some((s1, a)) -> f(a)(s1) - None -> None - } - } -} - -pub fn map(fuzz_a: Fuzzer, f: fn(a) -> b) -> Fuzzer { - fn(s0) { - when fuzz_a(s0) is { - Some((s1, a)) -> Some((s1, f(a))) - None -> None - } - } -} - -pub fn map2(fuzz_a: Fuzzer, fuzz_b: Fuzzer, f: fn(a, b) -> c) -> Fuzzer { - fn(s0) { - when fuzz_a(s0) is { - Some((s1, a)) -> - when fuzz_b(s1) is { - Some((s2, b)) -> Some((s2, f(a, b))) - None -> None - } - None -> None - } - } -} - -pub fn map4( - fuzz_a: Fuzzer, - fuzz_b: Fuzzer, - fuzz_c: Fuzzer, - fuzz_d: Fuzzer, - f: fn(a, b, c, d) -> result, -) -> Fuzzer { - fn(s0) { - when fuzz_a(s0) is { - Some((s1, a)) -> - when fuzz_b(s1) is { - Some((s2, b)) -> - when fuzz_c(s2) is { - Some((s3, c)) -> - when fuzz_d(s3) is { - Some((s4, d)) -> Some((s4, f(a, b, c, d))) - None -> None - } - None -> None - } - None -> None - } - - None -> None - } - } -} - -// Builders - -pub fn any_bool() -> Fuzzer { - any_int() |> map(fn(n) { n <= 127 }) -} - -pub fn any_list(fuzz_a: Fuzzer) -> Fuzzer> { - any_bool() - |> and_then( - fn(continue) { - if continue { - map2(fuzz_a, any_list(fuzz_a), fn(head, tail) { [head, ..tail] }) - } else { - constant([]) - } - }, - ) -} diff --git a/examples/acceptance_tests/095/lib/foo.ak b/examples/acceptance_tests/095/lib/foo.ak deleted file mode 100644 index 680d633d..00000000 --- a/examples/acceptance_tests/095/lib/foo.ak +++ /dev/null @@ -1,47 +0,0 @@ -use aiken/dict.{Dict} -use aiken/fuzz -use aiken/int - -pub type Season { - Winter - Spring - Summer - Fall -} - -fn compare_season(a: Season, b: Season) -> Ordering { - let season_to_int = - fn(season) { - when season is { - Winter -> 0 - Spring -> 1 - Summer -> 2 - Fall -> 3 - } - } - - int.compare(season_to_int(a), season_to_int(b)) -} - -fn any_year() -> Fuzzer> { - fuzz.map4( - fuzz.any_int(), - fuzz.any_int(), - fuzz.any_int(), - fuzz.any_int(), - fn(a, b, c, d) { - dict.new() - |> dict.insert(Winter, a, compare_season) - |> dict.insert(Spring, b, compare_season) - |> dict.insert(Summer, c, compare_season) - |> dict.insert(Fall, d, compare_season) - }, - ) -} - -test prop_always_cold_in_winter(year via any_year()) { - when dict.get(year, Winter) is { - Some(temperature) -> temperature <= 10 - _ -> fail @"failed to get?" - } -}