Remove acceptance_test 095, now done directly from Rust.'
This commit is contained in:
parent
3df5bcd96d
commit
775a34bc47
|
@ -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"]
|
|
@ -1,8 +0,0 @@
|
|||
name = "aiken-lang/acceptance_test_095"
|
||||
version = "0.0.0"
|
||||
description = ""
|
||||
|
||||
[[dependencies]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "main"
|
||||
source = "github"
|
|
@ -1,122 +0,0 @@
|
|||
use aiken/builtin
|
||||
|
||||
const max_int: Int = 255
|
||||
|
||||
// Primitives
|
||||
|
||||
pub fn any_int() -> Fuzzer<Int> {
|
||||
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<a> {
|
||||
fn(s0) { Some((s0, a)) }
|
||||
}
|
||||
|
||||
pub fn and_then(fuzz_a: Fuzzer<a>, f: fn(a) -> Fuzzer<b>) -> Fuzzer<b> {
|
||||
fn(s0) {
|
||||
when fuzz_a(s0) is {
|
||||
Some((s1, a)) -> f(a)(s1)
|
||||
None -> None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map(fuzz_a: Fuzzer<a>, f: fn(a) -> b) -> Fuzzer<b> {
|
||||
fn(s0) {
|
||||
when fuzz_a(s0) is {
|
||||
Some((s1, a)) -> Some((s1, f(a)))
|
||||
None -> None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map2(fuzz_a: Fuzzer<a>, fuzz_b: Fuzzer<b>, f: fn(a, b) -> c) -> Fuzzer<c> {
|
||||
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<a>,
|
||||
fuzz_b: Fuzzer<b>,
|
||||
fuzz_c: Fuzzer<c>,
|
||||
fuzz_d: Fuzzer<d>,
|
||||
f: fn(a, b, c, d) -> result,
|
||||
) -> Fuzzer<result> {
|
||||
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<Bool> {
|
||||
any_int() |> map(fn(n) { n <= 127 })
|
||||
}
|
||||
|
||||
pub fn any_list(fuzz_a: Fuzzer<a>) -> Fuzzer<List<a>> {
|
||||
any_bool()
|
||||
|> and_then(
|
||||
fn(continue) {
|
||||
if continue {
|
||||
map2(fuzz_a, any_list(fuzz_a), fn(head, tail) { [head, ..tail] })
|
||||
} else {
|
||||
constant([])
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
|
@ -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<Dict<Season, Int>> {
|
||||
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?"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue