more identity reduce testing

This commit is contained in:
microproofs 2024-03-06 14:15:14 -05:00 committed by Kasey
parent dabaae8ca6
commit e9122de061
1 changed files with 25 additions and 0 deletions

View File

@ -2007,6 +2007,31 @@ mod tests {
compare_optimization(expected, program, |p| p.identity_reducer()); compare_optimization(expected, program, |p| p.identity_reducer());
} }
#[test]
fn identity_reduce_no_inline_2() {
let program: Program<Name> = Program {
version: (1, 0, 0),
term: Term::sha2_256()
.apply(Term::var("identity").apply(Term::var("x")))
.lambda("x")
.apply(Term::byte_string(vec![]).delay())
.lambda(NO_INLINE)
.lambda("identity")
.apply(Term::var("y").lambda("y").lambda(NO_INLINE)),
};
let expected = Program {
version: (1, 0, 0),
term: Term::sha2_256()
.apply(Term::var("x"))
.lambda("x")
.apply(Term::byte_string(vec![]).delay())
.lambda(NO_INLINE),
};
compare_optimization(expected, program, |p| p.identity_reducer());
}
#[test] #[test]
fn inline_reduce_delay_sha() { fn inline_reduce_delay_sha() {
let program: Program<Name> = Program { let program: Program<Name> = Program {