Skip to content

Commit

Permalink
Add tricky cse test series
Browse files Browse the repository at this point in the history
  • Loading branch information
prozacchiwawa committed Oct 31, 2023
1 parent 2456e65 commit 882ba95
Show file tree
Hide file tree
Showing 6 changed files with 862 additions and 33 deletions.
148 changes: 127 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ optional = true
[dev-dependencies]
rand = "0.8.5"
rand_chacha = "0.3.1"
lfsr = "0.3.0"

[lib]
name = "clvm_tools_rs"
Expand Down
18 changes: 13 additions & 5 deletions src/compiler/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,11 @@ pub fn desugar_pre_forms(
do_desugar(&p1)
}

pub fn compile_pre_forms(
pub fn compile_from_compileform(
context: &mut BasicCompileContext,
opts: Rc<dyn CompilerOpts>,
pre_forms: &[Rc<SExp>],
p2: CompileForm,
) -> Result<SExp, CompileErr> {
// Resolve includes, convert program source to lexemes
let p2 = desugar_pre_forms(context, opts.clone(), pre_forms)?;

let p3 = context.post_desugar_optimization(opts.clone(), p2)?;

// generate code from AST, optionally with optimization
Expand All @@ -145,6 +142,17 @@ pub fn compile_pre_forms(
Ok(g2)
}

pub fn compile_pre_forms(
context: &mut BasicCompileContext,
opts: Rc<dyn CompilerOpts>,
pre_forms: &[Rc<SExp>],
) -> Result<SExp, CompileErr> {
// Resolve includes, convert program source to lexemes
let p2 = desugar_pre_forms(context, opts.clone(), pre_forms)?;

compile_from_compileform(context, opts, p2)
}

pub fn compile_file(
allocator: &mut Allocator,
runner: Rc<dyn TRunProgram>,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/compiler/clvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::tests::classic::run::RandomClvmNumber;

use crate::util::Number;

const TEST_TIMEOUT: usize = 1000000;
pub const TEST_TIMEOUT: usize = 1000000;

fn test_compiler_clvm(to_run: &String, args: &String) -> Result<Rc<SExp>, RunFailure> {
let mut allocator = Allocator::new();
Expand Down
Loading

0 comments on commit 882ba95

Please sign in to comment.