feat: add end to end tests to replace acceptance tests with strict uplc comparison.
Add acceptance tests 1,2, 6 as end to end tests
This commit is contained in:
@@ -404,7 +404,7 @@ impl PartialEq for NamedDeBruijn {
|
||||
/// It allows for injecting fake textual names while also using Debruijn for decoding
|
||||
/// without having to loop through twice.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FakeNamedDeBruijn(pub NamedDeBruijn);
|
||||
pub struct FakeNamedDeBruijn(pub(crate) NamedDeBruijn);
|
||||
|
||||
impl From<DeBruijn> for FakeNamedDeBruijn {
|
||||
fn from(d: DeBruijn) -> Self {
|
||||
|
||||
@@ -53,6 +53,10 @@ impl<T> Term<T> {
|
||||
Term::Constant(Constant::ProtoList(Type::Data, vec![]).into())
|
||||
}
|
||||
|
||||
pub fn list_values(vals: Vec<Constant>) -> Self {
|
||||
Term::Constant(Constant::ProtoList(Type::Data, vals).into())
|
||||
}
|
||||
|
||||
pub fn empty_map() -> Self {
|
||||
Term::Constant(
|
||||
Constant::ProtoList(Type::Pair(Type::Data.into(), Type::Data.into()), vec![]).into(),
|
||||
@@ -103,6 +107,14 @@ impl<T> Term<T> {
|
||||
Term::Builtin(DefaultFunction::EqualsInteger)
|
||||
}
|
||||
|
||||
pub fn less_than_integer() -> Self {
|
||||
Term::Builtin(DefaultFunction::LessThanInteger)
|
||||
}
|
||||
|
||||
pub fn less_than_equals_integer() -> Self {
|
||||
Term::Builtin(DefaultFunction::LessThanEqualsInteger)
|
||||
}
|
||||
|
||||
pub fn equals_string() -> Self {
|
||||
Term::Builtin(DefaultFunction::EqualsString)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ const TERM_TAG_WIDTH: u32 = 4;
|
||||
pub trait Binder<'b>: Encode + Decode<'b> {
|
||||
fn binder_encode(&self, e: &mut Encoder) -> Result<(), en::Error>;
|
||||
fn binder_decode(d: &mut Decoder) -> Result<Self, de::Error>;
|
||||
fn text(&self) -> &str;
|
||||
fn text(&self) -> String;
|
||||
}
|
||||
|
||||
impl<'b, T> Flat<'b> for Program<T> where T: Binder<'b> + Debug {}
|
||||
@@ -255,7 +255,7 @@ where
|
||||
let var_option = T::binder_decode(d);
|
||||
match var_option {
|
||||
Ok(var) => {
|
||||
state_log.push(var.text().to_string());
|
||||
state_log.push(var.text());
|
||||
let term_option = Term::decode_debug(d, state_log);
|
||||
match term_option {
|
||||
Ok(term) => {
|
||||
@@ -650,8 +650,8 @@ impl<'b> Binder<'b> for Name {
|
||||
Name::decode(d)
|
||||
}
|
||||
|
||||
fn text(&self) -> &str {
|
||||
&self.text
|
||||
fn text(&self) -> String {
|
||||
self.text.clone()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,8 +687,8 @@ impl<'b> Binder<'b> for NamedDeBruijn {
|
||||
})
|
||||
}
|
||||
|
||||
fn text(&self) -> &str {
|
||||
&self.text
|
||||
fn text(&self) -> String {
|
||||
format!("{}_{}", &self.text, self.index)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,8 +715,8 @@ impl<'b> Binder<'b> for DeBruijn {
|
||||
Ok(DeBruijn::new(0))
|
||||
}
|
||||
|
||||
fn text(&self) -> &str {
|
||||
"i"
|
||||
fn text(&self) -> String {
|
||||
format!("i_{}", self)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -749,8 +749,8 @@ impl<'b> Binder<'b> for FakeNamedDeBruijn {
|
||||
Ok(index.into())
|
||||
}
|
||||
|
||||
fn text(&self) -> &str {
|
||||
&self.0.text
|
||||
fn text(&self) -> String {
|
||||
format!("{}_{}", self.0.text, self.0.index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user