Rest of the tests to push up

This commit is contained in:
microproofs 2024-09-03 13:09:50 -04:00 committed by Kasey
parent c370a4aa6a
commit 8933688c68
1 changed files with 324 additions and 305 deletions

View File

@ -2824,9 +2824,7 @@ fn acceptance_test_28_unique_empty_list() {
} }
"#; "#;
assert_uplc( let uplc = Term::equals_data()
src,
Term::equals_data()
.apply( .apply(
Term::list_data().apply( Term::list_data().apply(
Term::var("unique") Term::var("unique")
@ -2897,9 +2895,10 @@ fn acceptance_test_28_unique_empty_list() {
.apply(Term::empty_list()), .apply(Term::empty_list()),
), ),
) )
.apply(Term::data(Data::list(vec![]))), .apply(Term::data(Data::list(vec![])));
false,
); assert_uplc(src, uplc.clone(), false, true);
assert_uplc(src, uplc, false, false);
} }
#[test] #[test]
@ -2932,8 +2931,7 @@ fn acceptance_test_28_unique_list() {
} }
"#; "#;
assert_uplc( let uplc =
src,
Term::equals_data() Term::equals_data()
.apply( .apply(
Term::list_data().apply( Term::list_data().apply(
@ -3021,9 +3019,10 @@ fn acceptance_test_28_unique_list() {
Data::integer(1.into()), Data::integer(1.into()),
Data::integer(2.into()), Data::integer(2.into()),
Data::integer(3.into()), Data::integer(3.into()),
]))), ])));
false,
); assert_uplc(src, uplc.clone(), false, true);
assert_uplc(src, uplc, false, false);
} }
#[test] #[test]
@ -3243,9 +3242,7 @@ fn acceptance_test_29_union_pair() {
.lambda("left") .lambda("left")
.lambda("do_union"); .lambda("do_union");
assert_uplc( let uplc = Term::equals_data()
src,
Term::equals_data()
.apply( .apply(
Term::map_data().apply(do_union.as_var("do_union", |do_union| { Term::map_data().apply(do_union.as_var("do_union", |do_union| {
Term::Var(do_union.clone()) Term::Var(do_union.clone())
@ -3258,9 +3255,10 @@ fn acceptance_test_29_union_pair() {
.lambda("insert") .lambda("insert")
.apply(insert) .apply(insert)
.lambda("do_insert") .lambda("do_insert")
.apply(do_insert_recurse), .apply(do_insert_recurse);
false,
); assert_uplc(src, uplc.clone(), false, true);
assert_uplc(src, uplc, false, false);
} }
#[test] #[test]
@ -3337,9 +3335,7 @@ fn acceptance_test_29_union_tuple() {
"#; "#;
assert_uplc( let uplc = Term::equals_data()
src,
Term::equals_data()
.apply( .apply(
Term::list_data().apply( Term::list_data().apply(
Term::var("union") Term::var("union")
@ -3369,7 +3365,8 @@ fn acceptance_test_29_union_tuple() {
) )
.lambda("v") .lambda("v")
.apply( .apply(
Term::un_i_data().apply(Term::head_list().apply( Term::un_i_data()
.apply(Term::head_list().apply(
Term::tail_list().apply(Term::var("tuple")), Term::tail_list().apply(Term::var("tuple")),
)), )),
) )
@ -3403,10 +3400,7 @@ fn acceptance_test_29_union_tuple() {
.apply( .apply(
Term::list_data().apply( Term::list_data().apply(
Term::mk_cons() Term::mk_cons()
.apply( .apply(Term::b_data().apply(Term::var("k")))
Term::b_data()
.apply(Term::var("k")),
)
.apply( .apply(
Term::mk_cons() Term::mk_cons()
.apply( .apply(
@ -3433,16 +3427,11 @@ fn acceptance_test_29_union_tuple() {
.apply( .apply(
Term::mk_cons() Term::mk_cons()
.apply( .apply(
Term::i_data() Term::i_data().apply(
.apply( Term::var("v"),
Term::var(
"v",
),
), ),
) )
.apply( .apply(Term::empty_list()),
Term::empty_list(),
),
), ),
), ),
) )
@ -3458,16 +3447,11 @@ fn acceptance_test_29_union_tuple() {
.apply( .apply(
Term::mk_cons() Term::mk_cons()
.apply( .apply(
Term::i_data() Term::i_data().apply(
.apply( Term::var("v2"),
Term::var(
"v2",
),
), ),
) )
.apply( .apply(Term::empty_list()),
Term::empty_list(),
),
), ),
), ),
) )
@ -3484,9 +3468,11 @@ fn acceptance_test_29_union_tuple() {
), ),
)) ))
.lambda("k2") .lambda("k2")
.apply(Term::un_b_data().apply( .apply(
Term::un_b_data().apply(
Term::head_list().apply(Term::var("tuple")), Term::head_list().apply(Term::var("tuple")),
)) ),
)
.lambda("rest") .lambda("rest")
.apply(Term::tail_list().apply(Term::var("elems"))) .apply(Term::tail_list().apply(Term::var("elems")))
.lambda("tuple") .lambda("tuple")
@ -3523,9 +3509,10 @@ fn acceptance_test_29_union_tuple() {
Data::bytestring("bar".as_bytes().to_vec()), Data::bytestring("bar".as_bytes().to_vec()),
Data::integer(14.into()), Data::integer(14.into()),
]), ]),
]))), ])));
false,
); assert_uplc(src, uplc.clone(), false, true);
assert_uplc(src, uplc, false, false);
} }
#[test] #[test]
@ -3544,9 +3531,7 @@ fn acceptance_test_30_abs() {
} }
"#; "#;
assert_uplc( let uplc = Term::equals_integer()
src,
Term::equals_integer()
.apply( .apply(
Term::var("abs") Term::var("abs")
.lambda("abs") .lambda("abs")
@ -3564,9 +3549,10 @@ fn acceptance_test_30_abs() {
) )
.apply(Term::integer((-14).into())), .apply(Term::integer((-14).into())),
) )
.apply(Term::integer(14.into())), .apply(Term::integer(14.into()));
false,
); assert_uplc(src, uplc.clone(), false, true);
assert_uplc(src, uplc, false, false);
} }
#[test] #[test]
@ -3593,6 +3579,7 @@ fn expect_empty_list_on_filled_list() {
Constant::Data(Data::integer(2.into())), Constant::Data(Data::integer(2.into())),
])), ])),
true, true,
true,
); );
} }
@ -3617,6 +3604,7 @@ fn expect_empty_list_on_new_list() {
.lambda("x") .lambda("x")
.apply(Term::list_values(vec![])), .apply(Term::list_values(vec![])),
false, false,
true,
); );
} }
@ -3640,6 +3628,7 @@ fn when_bool_is_true() {
.lambda("subject") .lambda("subject")
.apply(Term::bool(true)), .apply(Term::bool(true)),
false, false,
true,
); );
} }
@ -3663,6 +3652,7 @@ fn when_bool_is_true_switched_cases() {
.lambda("subject") .lambda("subject")
.apply(Term::bool(true)), .apply(Term::bool(true)),
false, false,
true,
); );
} }
@ -3686,6 +3676,7 @@ fn when_bool_is_false() {
.lambda("subject") .lambda("subject")
.apply(Term::bool(false)), .apply(Term::bool(false)),
true, true,
true,
); );
} }
@ -3751,7 +3742,7 @@ fn always_true_validator() {
.lambda(context) .lambda(context)
}; };
assert_uplc(src, validator, false); assert_uplc(src, validator, false, true);
} }
#[test] #[test]
@ -3848,7 +3839,7 @@ fn when_tuple_deconstruction() {
) )
}); });
assert_uplc(src, test, false); assert_uplc(src, test, false, true);
} }
#[test] #[test]
@ -3923,6 +3914,7 @@ fn when_tuple_empty_lists() {
Constant::Data(Data::integer(3.into())), Constant::Data(Data::integer(3.into())),
])), ])),
false, false,
true,
); );
} }
@ -4163,7 +4155,7 @@ fn generic_validator_type_test() {
.lambda(context) .lambda(context)
}; };
assert_uplc(src, validator, false); assert_uplc(src, validator, false, true);
} }
#[test] #[test]
@ -4225,6 +4217,7 @@ fn pass_constr_as_function() {
), ),
), ),
false, false,
true,
); );
} }
@ -4327,6 +4320,7 @@ fn record_update_output_2_vals() {
))) )))
.constr_fields_exposer(), .constr_fields_exposer(),
false, false,
true,
); );
} }
@ -4428,6 +4422,7 @@ fn record_update_output_1_val() {
))) )))
.constr_fields_exposer(), .constr_fields_exposer(),
false, false,
true,
); );
} }
@ -4525,6 +4520,7 @@ fn record_update_output_first_last_val() {
))) )))
.constr_fields_exposer(), .constr_fields_exposer(),
false, false,
true,
); );
} }
@ -4590,6 +4586,7 @@ fn list_fields_unwrap() {
) )
.constr_fields_exposer(), .constr_fields_exposer(),
false, false,
true,
); );
} }
@ -4758,6 +4755,7 @@ fn foldl_type_mismatch() {
.constr_fields_exposer() .constr_fields_exposer()
.constr_index_exposer(), .constr_index_exposer(),
false, false,
true,
); );
} }
@ -4791,6 +4789,7 @@ fn expect_head_discard_tail() {
.lambda("expect[h,..]=a") .lambda("expect[h,..]=a")
.apply(Term::string("expect [h, ..] = a")), .apply(Term::string("expect [h, ..] = a")),
false, false,
true,
); );
} }
@ -4833,6 +4832,7 @@ fn expect_head_no_tail() {
.delay(), .delay(),
), ),
true, true,
true,
); );
} }
@ -4909,6 +4909,7 @@ fn expect_head3_no_tail() {
.delay(), .delay(),
), ),
false, false,
true,
); );
} }
@ -5031,6 +5032,7 @@ fn expect_head3_cast_data_no_tail() {
.lambda("expect[h,i,j]:List<Int>=a") .lambda("expect[h,i,j]:List<Int>=a")
.apply(otherwise_msg), .apply(otherwise_msg),
false, false,
true,
); );
} }
@ -5103,6 +5105,7 @@ fn expect_head_cast_data_no_tail() {
.delay(), .delay(),
), ),
true, true,
true,
); );
} }
@ -5229,6 +5232,7 @@ fn expect_head_cast_data_with_tail() {
.delay(), .delay(),
), ),
false, false,
true,
); );
} }
@ -5328,6 +5332,7 @@ fn test_init_3() {
])], ])],
))), ))),
false, false,
true,
); );
} }
@ -5454,6 +5459,7 @@ fn list_clause_with_assign() {
)]))) )])))
.constr_index_exposer(), .constr_index_exposer(),
false, false,
true,
); );
} }
@ -5552,6 +5558,7 @@ fn opaque_value_in_test() {
.lambda("dat:Dat") .lambda("dat:Dat")
.apply(Term::Error.delayed_trace(Term::string("dat: Dat")).delay()), .apply(Term::Error.delayed_trace(Term::string("dat: Dat")).delay()),
false, false,
true,
); );
} }
@ -5581,6 +5588,7 @@ fn expect_none() {
)) ))
.constr_index_exposer(), .constr_index_exposer(),
false, false,
true,
); );
} }
@ -5631,6 +5639,7 @@ fn head_list_on_map() {
), ),
])), ])),
false, false,
true,
); );
} }
@ -5815,6 +5824,7 @@ fn tuple_2_match() {
.constr_index_exposer() .constr_index_exposer()
.constr_fields_exposer(), .constr_fields_exposer(),
false, false,
true,
); );
} }
@ -5866,6 +5876,7 @@ fn bls12_381_elements_to_data_conversion() {
src, src,
Term::equals_data().apply(constant.clone()).apply(constant), Term::equals_data().apply(constant.clone()).apply(constant),
false, false,
true,
) )
} }
@ -5931,6 +5942,7 @@ fn bls12_381_elements_from_data_conversion() {
)) ))
.apply(g1), .apply(g1),
false, false,
true,
) )
} }
@ -5953,6 +5965,7 @@ fn qualified_prelude_functions() {
.clone() .clone()
.delayed_if_then_else(constant_true, constant_false), .delayed_if_then_else(constant_true, constant_false),
false, false,
true,
) )
} }
@ -5978,6 +5991,7 @@ fn mk_cons_direct_invoke_1() {
) )
.apply(Term::data(Data::list(vec![Data::integer(1.into())]))), .apply(Term::data(Data::list(vec![Data::integer(1.into())]))),
false, false,
true,
) )
} }
@ -6006,6 +6020,7 @@ fn mk_cons_direct_invoke_2() {
) )
.apply(Term::data(Data::list(vec![some, none]))), .apply(Term::data(Data::list(vec![some, none]))),
false, false,
true,
) )
} }
@ -6044,6 +6059,7 @@ fn mk_cons_direct_invoke_3() {
Data::integer(1.into()), Data::integer(1.into()),
)]))), )]))),
false, false,
true,
) )
} }
@ -6063,6 +6079,7 @@ fn mk_nil_pair_data() {
.apply(Term::map_data().apply(Term::mk_nil_pair_data().apply(Term::unit()))) .apply(Term::map_data().apply(Term::mk_nil_pair_data().apply(Term::unit())))
.apply(Term::map_data().apply(Term::mk_nil_pair_data().apply(Term::unit()))), .apply(Term::map_data().apply(Term::mk_nil_pair_data().apply(Term::unit()))),
false, false,
true,
) )
} }
@ -6082,6 +6099,7 @@ fn mk_nil_list_data() {
.apply(Term::list_data().apply(Term::mk_nil_data().apply(Term::unit()))) .apply(Term::list_data().apply(Term::mk_nil_data().apply(Term::unit())))
.apply(Term::list_data().apply(Term::mk_nil_data().apply(Term::unit()))), .apply(Term::list_data().apply(Term::mk_nil_data().apply(Term::unit()))),
false, false,
true,
) )
} }
@ -6113,6 +6131,7 @@ fn mk_pair_data() {
Constant::Data(Data::integer(1.into())).into(), Constant::Data(Data::integer(1.into())).into(),
)), )),
false, false,
true,
) )
} }
@ -6152,7 +6171,7 @@ fn pattern_bytearray() {
.lambda("???") .lambda("???")
.apply(Term::Error.delay()); .apply(Term::Error.delay());
assert_uplc(src, program, false) assert_uplc(src, program, false, true)
} }
#[test] #[test]
@ -6200,5 +6219,5 @@ fn cast_never() {
.force() .force()
}); });
assert_uplc(src, program, false) assert_uplc(src, program, false, true)
} }