Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-schott committed Dec 5, 2023
1 parent db20544 commit 7aa476f
Show file tree
Hide file tree
Showing 4 changed files with 2,628 additions and 0 deletions.
11 changes: 11 additions & 0 deletions utils/disassembler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ mod tests {
use super::*;
use leo_span::symbol::create_session_if_not_set_then;
use snarkvm::{prelude::Testnet3, synthesizer::program::Program};
use std::fs;

type CurrentNetwork = Testnet3;

Expand All @@ -84,4 +85,14 @@ mod tests {
}
});
}
#[test]
fn array_test() {
create_session_if_not_set_then(|_| {
let program_from_file =
fs::read_to_string("../tmp/.aleo/registry/testnet3/zk_bitwise_stack_v0_0_2.aleo").unwrap();
dbg!(program_from_file.clone());
let program = disassemble_from_str(program_from_file).unwrap();
dbg!(program);
});
}
}
18 changes: 18 additions & 0 deletions utils/retriever/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,22 @@ mod tests {
// Reset $HOME
env::set_var("HOME", original_home);
}

#[test]
fn temp_dir_parent_test() {
// Set $HOME to tmp directory so that tests do not modify users real home directory
let original_home = env::var("HOME").unwrap();
env::set_var("HOME", "../tmp");

// Test pulling nested dependencies from network
const BUILD_DIRECTORY: &str = "../tmp/parent";
create_session_if_not_set_then(|_| {
let build_dir = PathBuf::from(BUILD_DIRECTORY);
let mut retriever = Retriever::new(&build_dir).expect("Failed to build retriever");
let _stubs = retriever.retrieve().expect("failed to retrieve");
});

// Reset $HOME
env::set_var("HOME", original_home);
}
}
10 changes: 10 additions & 0 deletions utils/tmp/.aleo/registry/testnet3/child.aleo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
program child.aleo;

struct Test:
a as u32;
b as u32;


function foo:
input r0 as Test.private;
output r0.a as u32.private;
Loading

0 comments on commit 7aa476f

Please sign in to comment.