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:
parent
f7f68fbafc
commit
a3a3185e5e
|
@ -2168,19 +2168,27 @@ impl Program<Name> {
|
||||||
inline_lambda: bool,
|
inline_lambda: bool,
|
||||||
with: &mut impl FnMut(Option<usize>, &mut Term<Name>, Vec<Args>, &Scope, &mut Context),
|
with: &mut impl FnMut(Option<usize>, &mut Term<Name>, Vec<Args>, &Scope, &mut Context),
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let (mut program, context) =
|
||||||
self.traverse_uplc_with(inline_lambda, &mut |id, term, arg_stack, scope, context| {
|
self.traverse_uplc_with(inline_lambda, &mut |id, term, arg_stack, scope, context| {
|
||||||
with(id, term, arg_stack, scope, context);
|
with(id, term, arg_stack, scope, context);
|
||||||
term.flip_constants(id, vec![], 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 {
|
pub fn clean_up(self, case: bool) -> Self {
|
||||||
let (mut program, context) =
|
let (mut program, context) = self
|
||||||
self.traverse_uplc_with(true, &mut |id, term, arg_stack, scope, context| {
|
.traverse_uplc_with(true, &mut |id, term, _arg_stack, scope, context| {
|
||||||
term.remove_no_inlines(id, vec![], 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);
|
term.write_bits_convert_arg(id, arg_stack, scope, context);
|
||||||
|
|
||||||
if case {
|
if case {
|
||||||
|
|
|
@ -49,7 +49,7 @@ peg::parser! {
|
||||||
fn actual_evaluation_result(
|
fn actual_evaluation_result(
|
||||||
file: &Path,
|
file: &Path,
|
||||||
language: &Language,
|
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 code = fs::read_to_string(file).expect("Failed to read .uplc file");
|
||||||
|
|
||||||
let program = parser::program(&code).map_err(|_| PARSE_ERROR.to_string())?;
|
let program = parser::program(&code).map_err(|_| PARSE_ERROR.to_string())?;
|
||||||
|
@ -68,7 +68,7 @@ fn actual_evaluation_result(
|
||||||
|
|
||||||
let program = Program { version, term };
|
let program = Program { version, term };
|
||||||
|
|
||||||
Ok((program.try_into().unwrap(), cost))
|
Ok((program, cost))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn plutus_conformance_tests(language: Language) {
|
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 expected_budget_file = path.with_extension("uplc.budget.expected");
|
||||||
|
|
||||||
let eval = actual_evaluation_result(path, &language);
|
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 {
|
match eval {
|
||||||
Ok((actual, cost)) => {
|
Ok((actual, cost)) => {
|
||||||
|
|
Loading…
Reference in New Issue