Move program builder to uplc crate
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
[package]
|
||||
name = "program_builder"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
# 1st party
|
||||
uplc = { path = '../uplc', version = "0.0.5" }
|
||||
@@ -18,3 +18,7 @@ hex = "0.4.3"
|
||||
peg = "0.8.0"
|
||||
pretty = "0.11.3"
|
||||
thiserror = "1.0.31"
|
||||
|
||||
[features]
|
||||
unstable = []
|
||||
test = ["unstable"]
|
||||
|
||||
@@ -5,5 +5,5 @@ mod flat;
|
||||
pub mod parser;
|
||||
mod pretty;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
#[cfg(any(feature = "unstable", test))]
|
||||
pub mod program_builder;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#![cfg_attr(test, allow(non_snake_case))]
|
||||
|
||||
use crate::ast::{Constant, Name, Program, Term, Unique};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::HashMap;
|
||||
use uplc::ast::{Constant, Name, Program, Term, Unique};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{Builder, WithTerm};
|
||||
use uplc::parser;
|
||||
use super::*;
|
||||
use crate::parser;
|
||||
|
||||
#[test]
|
||||
fn build_named__with_const() {
|
||||
@@ -1,57 +0,0 @@
|
||||
/// e2e encoding/decoding tests
|
||||
use crate::{
|
||||
ast::{DeBruijn, Name, Program},
|
||||
parser,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn integer() {
|
||||
let bytes = include_bytes!("../test_data/basic/integer/integer.flat");
|
||||
let code = include_str!("../test_data/basic/integer/integer.uplc");
|
||||
|
||||
let parsed_program = parser::program(code).unwrap();
|
||||
|
||||
let debruijn_program: Program<DeBruijn> = parsed_program.clone().try_into().unwrap();
|
||||
|
||||
let decoded_program: Program<DeBruijn> = Program::from_flat(bytes).unwrap();
|
||||
|
||||
assert_eq!(debruijn_program, decoded_program);
|
||||
|
||||
let encoded_program = debruijn_program.to_flat().unwrap();
|
||||
|
||||
assert_eq!(encoded_program, bytes);
|
||||
|
||||
let name_program: Program<Name> = decoded_program.try_into().unwrap();
|
||||
|
||||
assert_eq!(parsed_program, name_program);
|
||||
|
||||
let pretty = name_program.to_pretty();
|
||||
|
||||
assert_eq!(pretty, code);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn jpg() {
|
||||
let bytes = include_bytes!("../test_data/jpg/jpg.flat");
|
||||
let code = include_str!("../test_data/jpg/jpg.uplc");
|
||||
|
||||
let parsed_program = parser::program(code).unwrap();
|
||||
|
||||
let debruijn_program: Program<DeBruijn> = parsed_program.clone().try_into().unwrap();
|
||||
|
||||
let decoded_program: Program<DeBruijn> = Program::from_flat(bytes).unwrap();
|
||||
|
||||
assert_eq!(debruijn_program, decoded_program);
|
||||
|
||||
let encoded_program = debruijn_program.to_flat().unwrap();
|
||||
|
||||
assert_eq!(encoded_program, bytes);
|
||||
|
||||
let name_program: Program<Name> = decoded_program.try_into().unwrap();
|
||||
|
||||
assert_eq!(parsed_program, name_program);
|
||||
|
||||
let pretty = name_program.to_pretty();
|
||||
|
||||
assert_eq!(pretty, code);
|
||||
}
|
||||
@@ -74,7 +74,6 @@ fn fibonacci() {
|
||||
round_trip_test(bytes, code);
|
||||
}
|
||||
|
||||
// TODO: This is failing, see Bug: https://github.com/txpipe/aiken/issues/10
|
||||
#[test]
|
||||
fn one_way_fibonacci() {
|
||||
let bytes = include_bytes!("../test_data/fibonacci/fibonacci.flat");
|
||||
|
||||
Reference in New Issue
Block a user