Skip to content

Commit

Permalink
add new test
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroProofs committed Jan 14, 2024
1 parent d265240 commit 06672fc
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions crates/aiken-project/src/tests/gen_uplc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5557,6 +5557,56 @@ fn expect_none() {
);
}

#[test]
fn head_list_on_map() {
let src = r#"
use aiken/builtin
test exp_none() {
let x = [(1, ""), (2, #"aa")]
builtin.head_list(x) == (1, "")
}
"#;

assert_uplc(
src,
Term::equals_data()
.apply(
Term::map_data().apply(
Term::mk_cons()
.apply(Term::head_list().apply(Term::var("x")))
.apply(Term::empty_map()),
),
)
.apply(
Term::map_data().apply(
Term::mk_cons()
.apply(Term::pair_values(
Constant::Data(Data::integer(1.into())),
Constant::Data(Data::bytestring(vec![])),
))
.apply(Term::empty_map()),
),
)
.lambda("x")
.apply(Term::map_values(vec![
Constant::ProtoPair(
Type::Data,
Type::Data,
Constant::Data(Data::integer(1.into())).into(),
Constant::Data(Data::bytestring(vec![])).into(),
),
Constant::ProtoPair(
Type::Data,
Type::Data,
Constant::Data(Data::integer(2.into())).into(),
Constant::Data(Data::bytestring(vec![170])).into(),
),
])),
false,
);
}

#[test]
fn tuple_2_match() {
let src = r#"
Expand Down

0 comments on commit 06672fc

Please sign in to comment.