Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-schott committed Dec 19, 2023
1 parent 1111971 commit 4a7e429
Show file tree
Hide file tree
Showing 57 changed files with 81 additions and 34 deletions.
16 changes: 9 additions & 7 deletions leo/cli/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ mod tests {
pub fn build_nested_test() {
use leo_span::symbol::create_session_if_not_set_then;

let build_dir: PathBuf = PathBuf::from("utils").join("tmp").join("nested");
let home_dir: PathBuf = PathBuf::from("utils").join("tmp").join(".aleo");
let build_dir: PathBuf = PathBuf::from("utils").join("tests").join("build_nested_test").join("nested");
let home_dir: PathBuf = PathBuf::from("utils").join("tests").join("build_nested_test").join(".aleo");

let cli = CLI {
debug: false,
Expand All @@ -167,8 +167,10 @@ mod tests {
pub fn mixed_local_network_build_test() {
use leo_span::symbol::create_session_if_not_set_then;

let build_dir: PathBuf = PathBuf::from("utils").join("tmp").join("local_test");
let home_dir: PathBuf = PathBuf::from("utils").join("tmp").join(".aleo");
let build_dir: PathBuf =
PathBuf::from("utils").join("tests").join("mixed_local_network_build_test").join("local_test");
let home_dir: PathBuf =
PathBuf::from("utils").join("tests").join("mixed_local_network_build_test").join(".aleo");

let cli = CLI {
debug: false,
Expand All @@ -189,8 +191,8 @@ mod tests {
use crate::cli::commands::Run;
use leo_span::symbol::create_session_if_not_set_then;

let build_dir: PathBuf = PathBuf::from("utils").join("tmp").join("grandparent");
let home_dir: PathBuf = PathBuf::from("utils").join("tmp").join(".aleo");
let build_dir: PathBuf =
PathBuf::from("utils").join("tests").join("double_nested_program_run_test").join("grandparent");

let cli = CLI {
debug: false,
Expand All @@ -206,7 +208,7 @@ mod tests {
},
},
path: Some(build_dir),
home: Some(home_dir),
home: None,
};

create_session_if_not_set_then(|_| {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import nested_example_layer_2.aleo;
import nested_example_layer_1.aleo;

program nested_example_layer_0.aleo;

function main:
input r0 as u32.public;
input r1 as u32.private;
call nested_example_layer_1.aleo/external_function r0 r1 into r2;
output r2 as u32.private;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import nested_example_layer_2.aleo;

program nested_example_layer_1.aleo;

function external_function:
input r0 as u32.public;
input r1 as u32.private;
call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2;
output r2 as u32.private;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
program nested_example_layer_2.aleo;

function external_nested_function:
input r0 as u32.public;
input r1 as u32.private;
add r0 r1 into r2;
output r2 as u32.private;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# simple.aleo
# nested.aleo

## Build Guide

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// The program input for nested/src/main.leo
[main]
public a: u32 = 1u32;
b: u32 = 2u32;
20 changes: 20 additions & 0 deletions utils/tests/mixed_local_network_build_test/nested/leo.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[package]]
name = "nested_example_layer_2"
network = "testnet3"
location = "network"
checksum = "b987b8490b214ad9120a47b218a1c1387c7c2763aaf2aa9c81002a4c7020b3e4"
dependencies = []

[[package]]
name = "nested_example_layer_1"
network = "testnet3"
location = "network"
checksum = "17701f7369fe6bad74cdfb956bd9d85c6753ffedbf43be9fe5a4bfdc1751617b"
dependencies = ["nested_example_layer_2.aleo"]

[[package]]
name = "nested_example_layer_0"
network = "testnet3"
location = "network"
checksum = "23414151de5687d5daa447533109ee810b7e763c4d0659e2f53562123e639b2c"
dependencies = ["nested_example_layer_2.aleo", "nested_example_layer_1.aleo"]
13 changes: 13 additions & 0 deletions utils/tests/mixed_local_network_build_test/nested/program.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"program": "nested.aleo",
"version": "0.0.0",
"description": "",
"license": "MIT",
"dependencies": [
{
"name": "nested_example_layer_0.aleo",
"location": "network",
"network": "testnet3"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// The 'nested' program.
import nested_example_layer_0.aleo;
program nested.aleo {
transition example(public a: u32, b: u32) -> u32 {
let c: u32 = nested_example_layer_0.aleo/main(a, b);
return c;
}
}
2 changes: 0 additions & 2 deletions utils/tmp/.env

This file was deleted.

2 changes: 0 additions & 2 deletions utils/tmp/grandparent/.env

This file was deleted.

2 changes: 0 additions & 2 deletions utils/tmp/local_test/.env

This file was deleted.

2 changes: 0 additions & 2 deletions utils/tmp/simple/.env

This file was deleted.

4 changes: 0 additions & 4 deletions utils/tmp/simple/inputs/simple.in

This file was deleted.

1 change: 0 additions & 1 deletion utils/tmp/simple/leo.lock

This file was deleted.

6 changes: 0 additions & 6 deletions utils/tmp/simple/program.json

This file was deleted.

7 changes: 0 additions & 7 deletions utils/tmp/simple/src/main.leo

This file was deleted.

0 comments on commit 4a7e429

Please sign in to comment.