Conformance tests should be using NamedDebruijn comparisons not name. Also no inline remover needs to run separately from other uplc transformations

This commit is contained in:
microproofs 2025-01-10 13:03:28 +07:00
parent f7f68fbafc
commit a3a3185e5e
No known key found for this signature in database
GPG Key ID: 14F93C84DE6AFD17
2 changed files with 20 additions and 11 deletions

View File

@ -2168,19 +2168,27 @@ impl Program<Name> {
inline_lambda: bool,
with: &mut impl FnMut(Option<usize>, &mut Term<Name>, Vec<Args>, &Scope, &mut Context),
) -> Self {
self.traverse_uplc_with(inline_lambda, &mut |id, term, arg_stack, scope, context| {
with(id, term, arg_stack, scope, context);
term.flip_constants(id, vec![], scope, context);
let (mut program, context) =
self.traverse_uplc_with(inline_lambda, &mut |id, term, arg_stack, scope, context| {
with(id, term, arg_stack, scope, context);
term.flip_constants(id, vec![], scope, context);
term.remove_inlined_ids(id, vec![], scope, context);
});
term.remove_inlined_ids(id, vec![], scope, context);
})
.0
if context.write_bits_convert {
program.term = program.term.data_list_to_integer_list();
}
program
}
pub fn clean_up(self, case: bool) -> Self {
let (mut program, context) =
self.traverse_uplc_with(true, &mut |id, term, arg_stack, scope, context| {
let (mut program, context) = self
.traverse_uplc_with(true, &mut |id, term, _arg_stack, scope, context| {
term.remove_no_inlines(id, vec![], scope, context);
})
.0
.traverse_uplc_with(true, &mut |id, term, arg_stack, scope, context| {
term.write_bits_convert_arg(id, arg_stack, scope, context);
if case {

View File

@ -49,7 +49,7 @@ peg::parser! {
fn actual_evaluation_result(
file: &Path,
language: &Language,
) -> Result<(Program<Name>, ExBudget), String> {
) -> Result<(Program<NamedDeBruijn>, ExBudget), String> {
let code = fs::read_to_string(file).expect("Failed to read .uplc file");
let program = parser::program(&code).map_err(|_| PARSE_ERROR.to_string())?;
@ -68,7 +68,7 @@ fn actual_evaluation_result(
let program = Program { version, term };
Ok((program.try_into().unwrap(), cost))
Ok((program, cost))
}
fn plutus_conformance_tests(language: Language) {
@ -89,7 +89,8 @@ fn plutus_conformance_tests(language: Language) {
let expected_budget_file = path.with_extension("uplc.budget.expected");
let eval = actual_evaluation_result(path, &language);
let expected = expected_to_program(&expected_file);
let expected = expected_to_program(&expected_file)
.map(|program| Program::<NamedDeBruijn>::try_from(program).unwrap());
match eval {
Ok((actual, cost)) => {