mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 18:52:58 +03:00
Merge branch 'master' into feature/485-defines
This commit is contained in:
commit
3e20a9a177
29
Cargo.lock
generated
29
Cargo.lock
generated
@ -955,17 +955,6 @@ dependencies = [
|
||||
"wasi 0.9.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"wasi 0.10.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.23.0"
|
||||
@ -1290,7 +1279,6 @@ dependencies = [
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"typed-arena",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1338,7 +1326,6 @@ dependencies = [
|
||||
"snarkvm-utilities",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2148,7 +2135,7 @@ version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
dependencies = [
|
||||
"getrandom 0.1.15",
|
||||
"getrandom",
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core 0.5.1",
|
||||
@ -2171,7 +2158,7 @@ version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
dependencies = [
|
||||
"getrandom 0.1.15",
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2235,7 +2222,7 @@ version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
|
||||
dependencies = [
|
||||
"getrandom 0.1.15",
|
||||
"getrandom",
|
||||
"redox_syscall",
|
||||
"rust-argon2",
|
||||
]
|
||||
@ -3231,16 +3218,6 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
|
||||
dependencies = [
|
||||
"getrandom 0.2.2",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.11"
|
||||
|
@ -37,10 +37,6 @@ path = "../ast"
|
||||
version = "1.2.2"
|
||||
path = "../grammar"
|
||||
|
||||
[dependencies.uuid]
|
||||
version = "0.8"
|
||||
features = [ "v4", "serde" ]
|
||||
|
||||
[dependencies.num-bigint]
|
||||
version = "0.3"
|
||||
|
||||
|
46
asg/src/context.rs
Normal file
46
asg/src/context.rs
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{cell::Cell, unimplemented};
|
||||
|
||||
use typed_arena::Arena;
|
||||
|
||||
use crate::ArenaNode;
|
||||
|
||||
pub struct AsgContextInner<'a> {
|
||||
pub arena: &'a Arena<ArenaNode<'a>>,
|
||||
pub next_id: Cell<u32>,
|
||||
}
|
||||
|
||||
impl<'a> AsgContextInner<'a> {
|
||||
pub fn new(arena: &'a Arena<ArenaNode<'a>>) -> &'a Self {
|
||||
match arena.alloc(ArenaNode::Inner(AsgContextInner {
|
||||
arena,
|
||||
next_id: Cell::new(0),
|
||||
})) {
|
||||
ArenaNode::Inner(x) => x,
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_id(&self) -> u32 {
|
||||
let next_id = self.next_id.get();
|
||||
self.next_id.replace(next_id + 1);
|
||||
next_id
|
||||
}
|
||||
}
|
||||
|
||||
pub type AsgContext<'a> = &'a AsgContextInner<'a>;
|
@ -39,7 +39,7 @@ pub const STATE_LEAF_PSEUDO_CIRCUIT: &str = "$InputStateLeaf";
|
||||
impl<'a> Input<'a> {
|
||||
fn make_header(scope: &'a Scope<'a>, name: &str) -> &'a Circuit<'a> {
|
||||
scope.alloc_circuit(Circuit {
|
||||
id: uuid::Uuid::new_v4(),
|
||||
id: scope.context.get_id(),
|
||||
name: RefCell::new(Identifier::new(name.to_string())),
|
||||
members: RefCell::new(IndexMap::new()),
|
||||
core_mapping: RefCell::new(None),
|
||||
@ -68,7 +68,7 @@ impl<'a> Input<'a> {
|
||||
);
|
||||
|
||||
let container_circuit = input_scope.alloc_circuit(Circuit {
|
||||
id: uuid::Uuid::new_v4(),
|
||||
id: scope.context.get_id(),
|
||||
name: RefCell::new(Identifier::new(CONTAINER_PSEUDO_CIRCUIT.to_string())),
|
||||
members: RefCell::new(container_members),
|
||||
core_mapping: RefCell::new(None),
|
||||
@ -83,7 +83,7 @@ impl<'a> Input<'a> {
|
||||
state_leaf,
|
||||
container_circuit,
|
||||
container: input_scope.alloc_variable(RefCell::new(crate::InnerVariable {
|
||||
id: uuid::Uuid::new_v4(),
|
||||
id: scope.context.get_id(),
|
||||
name: Identifier::new("input".to_string()),
|
||||
type_: Type::Circuit(container_circuit),
|
||||
mutable: false,
|
||||
|
@ -71,9 +71,10 @@ pub use variable::*;
|
||||
pub mod pass;
|
||||
pub use pass::*;
|
||||
|
||||
pub use leo_ast::{Ast, Identifier, Span};
|
||||
pub mod context;
|
||||
pub use context::*;
|
||||
|
||||
pub type AsgContext<'a> = &'a Arena<ArenaNode<'a>>;
|
||||
pub use leo_ast::{Ast, Identifier, Span};
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
@ -132,6 +133,10 @@ pub fn load_asg<'a, T: ImportResolver<'a>>(
|
||||
InternalProgram::new(context, leo_ast::Ast::new("load_ast", &ast)?.as_repr(), resolver)
|
||||
}
|
||||
|
||||
pub fn new_context<'a>() -> Arena<ArenaNode<'a>> {
|
||||
pub fn new_alloc_context<'a>() -> Arena<ArenaNode<'a>> {
|
||||
Arena::new()
|
||||
}
|
||||
|
||||
pub fn new_context<'a>(arena: &'a Arena<ArenaNode<'a>>) -> AsgContext<'a> {
|
||||
AsgContextInner::new(arena)
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
AsgContextInner,
|
||||
AsgConvertError,
|
||||
Circuit,
|
||||
Expression,
|
||||
@ -50,4 +51,5 @@ pub enum ArenaNode<'a> {
|
||||
Circuit(Circuit<'a>),
|
||||
Function(Function<'a>),
|
||||
GlobalConst(GlobalConst<'a>),
|
||||
Inner(AsgContextInner<'a>),
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ use crate::{AsgConvertError, Function, Identifier, Node, Scope, Span, Type};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::cell::RefCell;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum CircuitMember<'a> {
|
||||
@ -28,7 +27,7 @@ pub enum CircuitMember<'a> {
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Circuit<'a> {
|
||||
pub id: Uuid,
|
||||
pub id: u32,
|
||||
pub name: RefCell<Identifier>,
|
||||
pub core_mapping: RefCell<Option<String>>,
|
||||
pub scope: &'a Scope<'a>,
|
||||
@ -58,7 +57,7 @@ impl<'a> Circuit<'a> {
|
||||
let new_scope = scope.make_subscope();
|
||||
|
||||
let circuit = scope.alloc_circuit(Circuit {
|
||||
id: Uuid::new_v4(),
|
||||
id: scope.context.get_id(),
|
||||
name: RefCell::new(value.circuit_name.clone()),
|
||||
members: RefCell::new(IndexMap::new()),
|
||||
core_mapping: RefCell::new(None),
|
||||
|
@ -32,7 +32,6 @@ use indexmap::IndexMap;
|
||||
use leo_ast::FunctionInput;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub enum FunctionQualifier {
|
||||
@ -43,7 +42,7 @@ pub enum FunctionQualifier {
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Function<'a> {
|
||||
pub id: Uuid,
|
||||
pub id: u32,
|
||||
pub name: RefCell<Identifier>,
|
||||
pub output: Type<'a>,
|
||||
pub has_input: bool,
|
||||
@ -99,7 +98,7 @@ impl<'a> Function<'a> {
|
||||
..
|
||||
}) => {
|
||||
let variable = scope.alloc_variable(RefCell::new(crate::InnerVariable {
|
||||
id: Uuid::new_v4(),
|
||||
id: scope.context.get_id(),
|
||||
name: identifier.clone(),
|
||||
type_: scope.resolve_ast_type(&type_)?,
|
||||
mutable: *mutable,
|
||||
@ -117,7 +116,7 @@ impl<'a> Function<'a> {
|
||||
return Err(AsgConvertError::invalid_self_in_global(&value.span));
|
||||
}
|
||||
let function = scope.alloc_function(Function {
|
||||
id: Uuid::new_v4(),
|
||||
id: scope.context.get_id(),
|
||||
name: RefCell::new(value.identifier.clone()),
|
||||
output,
|
||||
has_input,
|
||||
@ -137,7 +136,7 @@ impl<'a> Function<'a> {
|
||||
if self.qualifier != FunctionQualifier::Static {
|
||||
let circuit = self.circuit.get();
|
||||
let self_variable = self.scope.alloc_variable(RefCell::new(crate::InnerVariable {
|
||||
id: Uuid::new_v4(),
|
||||
id: self.scope.context.get_id(),
|
||||
name: Identifier::new("self".to_string()),
|
||||
type_: Type::Circuit(circuit.as_ref().unwrap()),
|
||||
mutable: self.qualifier == FunctionQualifier::MutSelfRef,
|
||||
|
@ -32,7 +32,6 @@ use leo_ast::{Identifier, PackageAccess, PackageOrPackages, Span};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Stores the Leo program abstract semantic graph (ASG).
|
||||
#[derive(Clone)]
|
||||
@ -40,7 +39,7 @@ pub struct InternalProgram<'a> {
|
||||
pub context: AsgContext<'a>,
|
||||
|
||||
/// The unique id of the program.
|
||||
pub id: Uuid,
|
||||
pub id: u32,
|
||||
|
||||
/// The program file name.
|
||||
pub name: String,
|
||||
@ -144,7 +143,7 @@ impl<'a> InternalProgram<'a> {
|
||||
/// 4. resolve all asg nodes
|
||||
///
|
||||
pub fn new<T: ImportResolver<'a>>(
|
||||
arena: AsgContext<'a>,
|
||||
context: AsgContext<'a>,
|
||||
program: &leo_ast::Program,
|
||||
import_resolver: &mut T,
|
||||
) -> Result<Program<'a>, AsgConvertError> {
|
||||
@ -168,7 +167,7 @@ impl<'a> InternalProgram<'a> {
|
||||
let pretty_package = package.join(".");
|
||||
|
||||
let resolved_package = match wrapped_resolver.resolve_package(
|
||||
arena,
|
||||
context,
|
||||
&package.iter().map(|x| &**x).collect::<Vec<_>>()[..],
|
||||
span,
|
||||
)? {
|
||||
@ -223,9 +222,9 @@ impl<'a> InternalProgram<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
let import_scope = match arena.alloc(ArenaNode::Scope(Scope {
|
||||
arena,
|
||||
id: uuid::Uuid::new_v4(),
|
||||
let import_scope = match context.arena.alloc(ArenaNode::Scope(Scope {
|
||||
context,
|
||||
id: context.get_id(),
|
||||
parent_scope: Cell::new(None),
|
||||
circuit_self: Cell::new(None),
|
||||
variables: RefCell::new(IndexMap::new()),
|
||||
@ -240,9 +239,9 @@ impl<'a> InternalProgram<'a> {
|
||||
};
|
||||
|
||||
let scope = import_scope.alloc_scope(Scope {
|
||||
arena,
|
||||
context,
|
||||
input: Cell::new(Some(Input::new(import_scope))), // we use import_scope to avoid recursive scope ref here
|
||||
id: uuid::Uuid::new_v4(),
|
||||
id: context.get_id(),
|
||||
parent_scope: Cell::new(Some(import_scope)),
|
||||
circuit_self: Cell::new(None),
|
||||
variables: RefCell::new(IndexMap::new()),
|
||||
@ -321,8 +320,8 @@ impl<'a> InternalProgram<'a> {
|
||||
}
|
||||
|
||||
Ok(InternalProgram {
|
||||
context: arena,
|
||||
id: Uuid::new_v4(),
|
||||
context,
|
||||
id: context.get_id(),
|
||||
name: program.name.clone(),
|
||||
test_functions,
|
||||
functions,
|
||||
|
@ -14,20 +14,18 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{ArenaNode, AsgConvertError, Circuit, Expression, Function, GlobalConst, Input, Statement, Type, Variable};
|
||||
use crate::{ArenaNode, AsgContext, AsgConvertError, Circuit, Expression, Function, GlobalConst Input, Statement, Type, Variable};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use typed_arena::Arena;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// An abstract data type that track the current bindings for variables, functions, and circuits.
|
||||
#[derive(Clone)]
|
||||
pub struct Scope<'a> {
|
||||
pub arena: &'a Arena<ArenaNode<'a>>,
|
||||
pub context: AsgContext<'a>,
|
||||
|
||||
/// The unique id of the scope.
|
||||
pub id: Uuid,
|
||||
pub id: u32,
|
||||
|
||||
/// The parent scope that this scope inherits.
|
||||
pub parent_scope: Cell<Option<&'a Scope<'a>>>,
|
||||
@ -57,42 +55,42 @@ pub struct Scope<'a> {
|
||||
#[allow(clippy::mut_from_ref)]
|
||||
impl<'a> Scope<'a> {
|
||||
pub fn alloc_expression(&'a self, expr: Expression<'a>) -> &'a mut Expression<'a> {
|
||||
match self.arena.alloc(ArenaNode::Expression(expr)) {
|
||||
match self.context.arena.alloc(ArenaNode::Expression(expr)) {
|
||||
ArenaNode::Expression(e) => e,
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn alloc_statement(&'a self, statement: Statement<'a>) -> &'a mut Statement<'a> {
|
||||
match self.arena.alloc(ArenaNode::Statement(statement)) {
|
||||
match self.context.arena.alloc(ArenaNode::Statement(statement)) {
|
||||
ArenaNode::Statement(e) => e,
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn alloc_variable(&'a self, variable: Variable<'a>) -> &'a mut Variable<'a> {
|
||||
match self.arena.alloc(ArenaNode::Variable(variable)) {
|
||||
match self.context.arena.alloc(ArenaNode::Variable(variable)) {
|
||||
ArenaNode::Variable(e) => e,
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn alloc_scope(&'a self, scope: Scope<'a>) -> &'a mut Scope<'a> {
|
||||
match self.arena.alloc(ArenaNode::Scope(scope)) {
|
||||
match self.context.arena.alloc(ArenaNode::Scope(scope)) {
|
||||
ArenaNode::Scope(e) => e,
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn alloc_circuit(&'a self, circuit: Circuit<'a>) -> &'a mut Circuit<'a> {
|
||||
match self.arena.alloc(ArenaNode::Circuit(circuit)) {
|
||||
match self.context.arena.alloc(ArenaNode::Circuit(circuit)) {
|
||||
ArenaNode::Circuit(e) => e,
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn alloc_function(&'a self, function: Function<'a>) -> &'a mut Function<'a> {
|
||||
match self.arena.alloc(ArenaNode::Function(function)) {
|
||||
match self.context.arena.alloc(ArenaNode::Function(function)) {
|
||||
ArenaNode::Function(e) => e,
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
@ -210,8 +208,8 @@ impl<'a> Scope<'a> {
|
||||
///
|
||||
pub fn make_subscope(self: &'a Scope<'a>) -> &'a Scope<'a> {
|
||||
self.alloc_scope(Scope::<'a> {
|
||||
arena: self.arena,
|
||||
id: Uuid::new_v4(),
|
||||
context: self.context,
|
||||
id: self.context.get_id(),
|
||||
parent_scope: Cell::new(Some(self)),
|
||||
circuit_self: Cell::new(None),
|
||||
variables: RefCell::new(IndexMap::new()),
|
||||
|
@ -96,7 +96,7 @@ impl<'a> FromAst<'a, leo_ast::DefinitionStatement> for &'a Statement<'a> {
|
||||
)));
|
||||
}
|
||||
variables.push(&*scope.alloc_variable(RefCell::new(InnerVariable {
|
||||
id: uuid::Uuid::new_v4(),
|
||||
id: scope.context.get_id(),
|
||||
name: variable.identifier.clone(),
|
||||
type_:
|
||||
type_.ok_or_else(|| AsgConvertError::unresolved_type(&variable.identifier.name, &statement.span))?,
|
||||
|
@ -58,7 +58,7 @@ impl<'a> FromAst<'a, leo_ast::IterationStatement> for &'a Statement<'a> {
|
||||
let start = <&Expression<'a>>::from_ast(scope, &statement.start, expected_index_type.clone())?;
|
||||
let stop = <&Expression<'a>>::from_ast(scope, &statement.stop, expected_index_type)?;
|
||||
let variable = scope.alloc_variable(RefCell::new(InnerVariable {
|
||||
id: uuid::Uuid::new_v4(),
|
||||
id: scope.context.get_id(),
|
||||
name: statement.variable.clone(),
|
||||
type_: start
|
||||
.get_type()
|
||||
|
@ -19,8 +19,6 @@ use std::cell::RefCell;
|
||||
use crate::{Expression, Statement, Type};
|
||||
use leo_ast::Identifier;
|
||||
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Specifies how a program variable was declared.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub enum VariableDeclaration {
|
||||
@ -33,7 +31,7 @@ pub enum VariableDeclaration {
|
||||
/// Stores information on a program variable.
|
||||
#[derive(Clone)]
|
||||
pub struct InnerVariable<'a> {
|
||||
pub id: Uuid,
|
||||
pub id: u32,
|
||||
pub name: Identifier,
|
||||
pub type_: Type<'a>,
|
||||
pub mutable: bool,
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_implicit_invalid() {
|
||||
let program_string = include_str!("implicit_invalid.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
// Expressions
|
||||
@ -23,49 +21,49 @@ use crate::load_asg;
|
||||
#[test]
|
||||
fn test_initializer_fail() {
|
||||
let program_string = include_str!("initializer_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_nested_3x2_fail() {
|
||||
let program_string = include_str!("input_nested_3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_tuple_3x2_fail() {
|
||||
let program_string = include_str!("input_tuple_3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi_fail_initializer() {
|
||||
let program_string = include_str!("multi_fail_initializer.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi_inline_fail() {
|
||||
let program_string = include_str!("multi_fail_inline.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi_initializer_fail() {
|
||||
let program_string = include_str!("multi_initializer_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nested_3x2_value_fail() {
|
||||
let program_string = include_str!("nested_3x2_value_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tuple_3x2_value_fail() {
|
||||
let program_string = include_str!("tuple_3x2_value_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
// Array type tests
|
||||
@ -73,65 +71,65 @@ fn test_tuple_3x2_value_fail() {
|
||||
#[test]
|
||||
fn test_type_fail() {
|
||||
let program_string = include_str!("type_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_nested_value_nested_3x2_fail() {
|
||||
let program_string = include_str!("type_nested_value_nested_3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_nested_value_nested_4x3x2_fail() {
|
||||
let program_string = include_str!("type_nested_value_nested_4x3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_nested_value_tuple_3x2_fail() {
|
||||
let program_string = include_str!("type_nested_value_tuple_3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_nested_value_tuple_4x3x2_fail() {
|
||||
let program_string = include_str!("type_nested_value_tuple_4x3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_nested_3x2_fail() {
|
||||
let program_string = include_str!("type_tuple_value_nested_3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_nested_3x2_swap_fail() {
|
||||
let program_string = include_str!("type_tuple_value_nested_3x2_swap_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_nested_4x3x2_fail() {
|
||||
let program_string = include_str!("type_tuple_value_nested_4x3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_tuple_3x2_fail() {
|
||||
let program_string = include_str!("type_tuple_value_tuple_3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_tuple_3x2_swap_fail() {
|
||||
let program_string = include_str!("type_tuple_value_tuple_3x2_swap_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_tuple_4x3x2_fail() {
|
||||
let program_string = include_str!("type_tuple_value_tuple_4x3x2_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -14,24 +14,22 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_not_u32() {
|
||||
let program_string = include_str!("not_u32.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_true_or_u32() {
|
||||
let program_string = include_str!("true_or_u32.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_true_and_u32() {
|
||||
let program_string = include_str!("true_and_u32.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
// Expressions
|
||||
@ -23,13 +21,13 @@ use crate::load_asg;
|
||||
#[test]
|
||||
fn test_inline_fail() {
|
||||
let program_string = include_str!("inline_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_inline_undefined() {
|
||||
let program_string = include_str!("inline_undefined.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
// Members
|
||||
@ -37,19 +35,19 @@ fn test_inline_undefined() {
|
||||
#[test]
|
||||
fn test_member_variable_fail() {
|
||||
let program_string = include_str!("member_variable_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_member_function_fail() {
|
||||
let program_string = include_str!("member_function_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_member_function_invalid() {
|
||||
let program_string = include_str!("member_function_invalid.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -66,19 +64,19 @@ fn test_mut_member_function_fail() {
|
||||
|
||||
console.assert(a.echo(1u32) == 1u32);
|
||||
}"#;
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_member_static_function_invalid() {
|
||||
let program_string = include_str!("member_static_function_invalid.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_member_static_function_undefined() {
|
||||
let program_string = include_str!("member_static_function_undefined.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
// Mutability
|
||||
@ -86,37 +84,37 @@ fn test_member_static_function_undefined() {
|
||||
#[test]
|
||||
fn test_mutate_function_fail() {
|
||||
let program_string = include_str!("mut_function_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutate_self_variable_fail() {
|
||||
let program_string = include_str!("mut_self_variable_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutate_self_function_fail() {
|
||||
let program_string = include_str!("mut_self_function_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutate_self_static_function_fail() {
|
||||
let program_string = include_str!("mut_self_static_function_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutate_static_function_fail() {
|
||||
let program_string = include_str!("mut_static_function_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutate_variable_fail() {
|
||||
let program_string = include_str!("mut_variable_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
// Self
|
||||
@ -124,17 +122,17 @@ fn test_mutate_variable_fail() {
|
||||
#[test]
|
||||
fn test_self_fail() {
|
||||
let program_string = include_str!("self_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_self_member_invalid() {
|
||||
let program_string = include_str!("self_member_invalid.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_self_member_undefined() {
|
||||
let program_string = include_str!("self_member_undefined.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -14,30 +14,28 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_log_fail() {
|
||||
let program_string = include_str!("log_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_log_parameter_fail_unknown() {
|
||||
let program_string = include_str!("log_parameter_fail_unknown.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_log_parameter_fail_empty() {
|
||||
let program_string = include_str!("log_parameter_fail_empty.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_log_parameter_fail_none() {
|
||||
let program_string = include_str!("log_parameter_fail_empty.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -14,30 +14,28 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_core_circuit_invalid() {
|
||||
let program_string = include_str!("core_package_invalid.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_core_circuit_star_fail() {
|
||||
let program_string = include_str!("core_circuit_star_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_core_package_invalid() {
|
||||
let program_string = include_str!("core_package_invalid.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_core_unstable_package_invalid() {
|
||||
let program_string = include_str!("core_unstable_package_invalid.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -14,44 +14,42 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_multiple_returns_fail() {
|
||||
let program_string = include_str!("multiple_returns_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_returns_input_ambiguous() {
|
||||
let program_string = include_str!("multiple_returns_input_ambiguous.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_returns_fail_conditional() {
|
||||
let program_string = include_str!("multiple_returns_fail_conditional.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scope_fail() {
|
||||
let program_string = include_str!("scope_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_undefined() {
|
||||
let program_string = include_str!("undefined.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_array_input() {
|
||||
let program_string = include_str!("array_input.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
// Test return multidimensional arrays
|
||||
@ -59,11 +57,11 @@ fn test_array_input() {
|
||||
#[test]
|
||||
fn test_return_array_nested_fail() {
|
||||
let program_string = include_str!("return_array_nested_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_return_array_tuple_fail() {
|
||||
let program_string = include_str!("return_array_tuple_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -19,17 +19,17 @@ use crate::load_asg;
|
||||
#[test]
|
||||
fn test_both_sign_high() {
|
||||
let program_string = include_str!("both_sign_high.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_both_sign_low() {
|
||||
let program_string = include_str!("both_sign_low.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_both_sign_inferred() {
|
||||
let program_string = include_str!("both_sign_inferred.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -16,27 +16,25 @@
|
||||
|
||||
macro_rules! test_int {
|
||||
($name: ident) => {
|
||||
use leo_asg::new_context;
|
||||
|
||||
pub struct $name {}
|
||||
|
||||
// we are not doing constant folding here, so asg doesnt catch this
|
||||
// impl $name {
|
||||
// fn test_negate_min_fail() {
|
||||
// let program_string = include_str!("negate_min.leo");
|
||||
// crate::load_asg(&new_context(), program_string).err().unwrap();
|
||||
// crate::load_asg(program_string).err().unwrap();
|
||||
// }
|
||||
// }
|
||||
|
||||
impl super::IntegerTester for $name {
|
||||
fn test_min_fail() {
|
||||
let program_string = include_str!("min_fail.leo");
|
||||
crate::load_asg(&new_context(), program_string).err().unwrap();
|
||||
crate::load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
fn test_max_fail() {
|
||||
let program_string = include_str!("max_fail.leo");
|
||||
crate::load_asg(&new_context(), program_string).err().unwrap();
|
||||
crate::load_asg(program_string).err().unwrap();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -16,19 +16,17 @@
|
||||
|
||||
macro_rules! test_uint {
|
||||
($name: ident) => {
|
||||
use leo_asg::new_context;
|
||||
|
||||
pub struct $name {}
|
||||
|
||||
impl super::IntegerTester for $name {
|
||||
fn test_min_fail() {
|
||||
let program_string = include_str!("min_fail.leo");
|
||||
crate::load_asg(&new_context(), program_string).err().unwrap();
|
||||
crate::load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
fn test_max_fail() {
|
||||
let program_string = include_str!("max_fail.leo");
|
||||
crate::load_asg(&new_context(), program_string).err().unwrap();
|
||||
crate::load_asg(program_string).err().unwrap();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -14,48 +14,46 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_let() {
|
||||
let program_string = include_str!("let.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_const_fail() {
|
||||
let program_string = include_str!("const.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_array() {
|
||||
let program_string = include_str!("array.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_circuit() {
|
||||
let program_string = include_str!("circuit.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_circuit_function_mut() {
|
||||
let program_string = include_str!("circuit_function_mut.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_circuit_static_function_mut() {
|
||||
let program_string = include_str!("circuit_static_function_mut.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_function_input() {
|
||||
let program_string = include_str!("function_input.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -14,18 +14,16 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_num_returns_fail() {
|
||||
let program_string = include_str!("num_returns_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_const_declaration_fail() {
|
||||
let program_string = include_str!("const_declaration_fail.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ mod pass;
|
||||
const TESTING_FILEPATH: &str = "input.leo";
|
||||
const TESTING_PROGRAM_NAME: &str = "test_program";
|
||||
|
||||
fn load_asg<'a>(context: AsgContext<'a>, program_string: &str) -> Result<Program<'a>, AsgConvertError> {
|
||||
load_asg_imports(context, program_string, &mut NullImportResolver)
|
||||
fn load_asg(program_string: &str) -> Result<Program<'static>, AsgConvertError> {
|
||||
load_asg_imports(make_test_context(), program_string, &mut NullImportResolver)
|
||||
}
|
||||
|
||||
fn load_asg_imports<'a, T: ImportResolver<'a>>(
|
||||
@ -44,3 +44,9 @@ fn mocked_resolver<'a>(_context: AsgContext<'a>) -> MockedImportResolver<'a> {
|
||||
let packages = indexmap::IndexMap::new();
|
||||
MockedImportResolver { packages }
|
||||
}
|
||||
|
||||
//convenience function for tests, leaks memory
|
||||
pub(crate) fn make_test_context() -> AsgContext<'static> {
|
||||
let allocator = Box::leak(Box::new(new_alloc_context()));
|
||||
new_context(allocator)
|
||||
}
|
||||
|
@ -14,37 +14,35 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_valid() {
|
||||
let program_string = include_str!("valid.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_implicit_valid() {
|
||||
let program_string = include_str!("implicit_valid.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_console_assert_pass() {
|
||||
let program_string = include_str!("console_assert_pass.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ternary() {
|
||||
let program_string = include_str!("ternary.leo");
|
||||
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_equal() {
|
||||
let program_string = include_str!("equal.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
// Registers
|
||||
@ -23,7 +21,7 @@ use crate::load_asg;
|
||||
#[test]
|
||||
fn test_registers() {
|
||||
let program_string = include_str!("registers.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Expressions
|
||||
@ -31,173 +29,173 @@ fn test_registers() {
|
||||
#[test]
|
||||
fn test_inline() {
|
||||
let program_string = include_str!("inline.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_initializer() {
|
||||
let program_string = include_str!("initializer.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_initializer_input() {
|
||||
let program_string = include_str!("initializer_input.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_nested_3x2() {
|
||||
let program_string = include_str!("input_nested_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_tuple_3x2() {
|
||||
let program_string = include_str!("input_tuple_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi_initializer() {
|
||||
let program_string = include_str!("multi_initializer.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nested_3x2_value() {
|
||||
let program_string = include_str!("nested_3x2_value.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tuple_3x2_value() {
|
||||
let program_string = include_str!("tuple_3x2_value.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_spread() {
|
||||
let program_string = include_str!("spread.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_slice() {
|
||||
let program_string = include_str!("slice.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_index_u8() {
|
||||
let program_string = include_str!("index_u8.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_slice_i8() {
|
||||
let program_string = include_str!("slice_i8.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_slice_lower() {
|
||||
let program_string = include_str!("slice_lower.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_nested_value_nested_3x2() {
|
||||
let program_string = include_str!("type_nested_value_nested_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_nested_value_nested_4x3x2() {
|
||||
let program_string = include_str!("type_nested_value_nested_4x3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_nested_value_tuple_3x2() {
|
||||
let program_string = include_str!("type_nested_value_tuple_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_nested_value_tuple_4x3x2() {
|
||||
let program_string = include_str!("type_nested_value_tuple_4x3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_nested_3x2() {
|
||||
let program_string = include_str!("type_tuple_value_nested_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_nested_4x3x2() {
|
||||
let program_string = include_str!("type_tuple_value_nested_4x3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_tuple_3x2() {
|
||||
let program_string = include_str!("type_tuple_value_tuple_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_tuple_value_tuple_4x3x2() {
|
||||
let program_string = include_str!("type_tuple_value_tuple_4x3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_type_nested_value_nested_3x2() {
|
||||
let program_string = include_str!("type_input_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_type_nested_value_nested_4x3x2() {
|
||||
let program_string = include_str!("type_input_4x3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_type_nested_value_tuple_3x2() {
|
||||
let program_string = include_str!("type_input_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_type_nested_value_tuple_4x3x2() {
|
||||
let program_string = include_str!("type_input_4x3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_type_tuple_value_nested_3x2() {
|
||||
let program_string = include_str!("type_input_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_type_tuple_value_nested_4x3x2() {
|
||||
let program_string = include_str!("type_input_4x3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_type_tuple_value_tuple_3x2() {
|
||||
let program_string = include_str!("type_input_3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_type_tuple_value_tuple_4x3x2() {
|
||||
let program_string = include_str!("type_input_4x3x2.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,20 +14,18 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_input_pass() {
|
||||
let program_string = include_str!("assert_eq_input.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_registers() {
|
||||
let program_string = include_str!("output_register.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Boolean not !
|
||||
@ -35,19 +33,19 @@ fn test_registers() {
|
||||
#[test]
|
||||
fn test_not_true() {
|
||||
let program_string = include_str!("not_true.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_not_false() {
|
||||
let program_string = include_str!("not_false.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_not_mutable() {
|
||||
let program_string = include_str!("not_mutable.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Boolean or ||
|
||||
@ -55,19 +53,19 @@ fn test_not_mutable() {
|
||||
#[test]
|
||||
fn test_true_or_true() {
|
||||
let program_string = include_str!("true_or_true.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_true_or_false() {
|
||||
let program_string = include_str!("true_or_false.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_false_or_false() {
|
||||
let program_string = include_str!("false_or_false.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Boolean and &&
|
||||
@ -75,19 +73,19 @@ fn test_false_or_false() {
|
||||
#[test]
|
||||
fn test_true_and_true() {
|
||||
let program_string = include_str!("true_and_true.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_true_and_false() {
|
||||
let program_string = include_str!("true_and_false.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_false_and_false() {
|
||||
let program_string = include_str!("false_and_false.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// All
|
||||
@ -95,5 +93,5 @@ fn test_false_and_false() {
|
||||
#[test]
|
||||
fn test_all() {
|
||||
let program_string = include_str!("all.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
// Expressions
|
||||
@ -23,7 +21,7 @@ use crate::load_asg;
|
||||
#[test]
|
||||
fn test_inline() {
|
||||
let program_string = include_str!("inline.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Members
|
||||
@ -31,19 +29,19 @@ fn test_inline() {
|
||||
#[test]
|
||||
fn test_member_variable() {
|
||||
let program_string = include_str!("member_variable.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_member_variable_and_function() {
|
||||
let program_string = include_str!("member_variable_and_function.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_member_function() {
|
||||
let program_string = include_str!("member_function.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -60,25 +58,25 @@ fn test_mut_member_function() {
|
||||
|
||||
console.assert(a.echo(1u32) == 1u32);
|
||||
}"#;
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_member_function_nested() {
|
||||
let program_string = include_str!("member_function_nested.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_member_static_function() {
|
||||
let program_string = include_str!("member_static_function.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_member_static_function_nested() {
|
||||
let program_string = include_str!("member_static_function_nested.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Mutability
|
||||
@ -86,19 +84,19 @@ fn test_member_static_function_nested() {
|
||||
#[test]
|
||||
fn test_mutate_self_variable() {
|
||||
let program_string = include_str!("mut_self_variable.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutate_self_variable_conditional() {
|
||||
let program_string = include_str!("mut_self_variable_conditional.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutate_variable() {
|
||||
let program_string = include_str!("mut_variable.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Self
|
||||
@ -106,7 +104,7 @@ fn test_mutate_variable() {
|
||||
#[test]
|
||||
fn test_self_member_pass() {
|
||||
let program_string = include_str!("self_member.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// All
|
||||
@ -114,13 +112,13 @@ fn test_self_member_pass() {
|
||||
#[test]
|
||||
fn test_pedersen_mock() {
|
||||
let program_string = include_str!("pedersen_mock.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_define_circuit_inside_circuit_function() {
|
||||
let program_string = include_str!("define_circuit_inside_circuit_function.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -133,5 +131,5 @@ fn test_circuit_explicit_define() {
|
||||
let x: One = One {x: 5};
|
||||
}
|
||||
"#;
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,32 +14,30 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_log() {
|
||||
let program_string = include_str!("log.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_log_parameter() {
|
||||
let program_string = include_str!("log_parameter.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_log_parameter_many() {
|
||||
let program_string = include_str!("log_parameter_many.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_log_input() {
|
||||
let program_string = include_str!("log_input.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Debug
|
||||
@ -47,7 +45,7 @@ fn test_log_input() {
|
||||
#[test]
|
||||
fn test_debug() {
|
||||
let program_string = include_str!("debug.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Error
|
||||
@ -55,7 +53,7 @@ fn test_debug() {
|
||||
#[test]
|
||||
fn test_error() {
|
||||
let program_string = include_str!("error.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Assertion
|
||||
@ -63,11 +61,11 @@ fn test_error() {
|
||||
#[test]
|
||||
fn test_assert() {
|
||||
let program_string = include_str!("assert.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_conditional_assert() {
|
||||
let program_string = include_str!("conditional_assert.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,24 +14,22 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_unstable_blake2s() {
|
||||
let program_string = include_str!("unstable_blake2s.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_blake2s_input() {
|
||||
let program_string = include_str!("blake2s_input.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_blake2s_random() {
|
||||
let program_string = include_str!("blake2s_random.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,19 +14,17 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_out_of_order() {
|
||||
let program_string = include_str!("out_of_order.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// #[ignore]
|
||||
// fn test_out_of_order_with_import() {
|
||||
// let program_string = include_str!("out_of_order_with_import.leo");
|
||||
// load_asg(&new_context(), program_string).unwrap();
|
||||
// load_asg(program_string).unwrap();
|
||||
// }
|
||||
|
@ -14,20 +14,18 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_negate() {
|
||||
let program_string = include_str!("negate.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_add() {
|
||||
let program_string = include_str!("add.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -37,41 +35,41 @@ fn test_add_explicit() {
|
||||
let c: field = 0field + 1field;
|
||||
}
|
||||
"#;
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sub() {
|
||||
let program_string = include_str!("sub.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_div() {
|
||||
let program_string = include_str!("div.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mul() {
|
||||
let program_string = include_str!("mul.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_eq() {
|
||||
let program_string = include_str!("eq.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_console_assert_pass() {
|
||||
let program_string = include_str!("console_assert.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ternary() {
|
||||
let program_string = include_str!("ternary.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,9 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
use crate::{load_asg, make_test_context};
|
||||
use leo_ast::Ast;
|
||||
use leo_grammar::Grammar;
|
||||
|
||||
@ -25,8 +23,7 @@ use std::path::Path;
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
let program_string = include_str!("./circuits/pedersen_mock.leo");
|
||||
let context = new_context();
|
||||
let asg = load_asg(&context, program_string).unwrap();
|
||||
let asg = load_asg(program_string).unwrap();
|
||||
let reformed_ast = leo_asg::reform_ast(&asg);
|
||||
println!("{}", reformed_ast);
|
||||
// panic!();
|
||||
@ -51,8 +48,7 @@ fn test_function_rename() {
|
||||
console.assert(total == 20);
|
||||
}
|
||||
"#;
|
||||
let context = new_context();
|
||||
let asg = load_asg(&context, program_string).unwrap();
|
||||
let asg = load_asg(program_string).unwrap();
|
||||
let reformed_ast = leo_asg::reform_ast(&asg);
|
||||
println!("{}", reformed_ast);
|
||||
// panic!();
|
||||
@ -60,7 +56,7 @@ fn test_function_rename() {
|
||||
|
||||
#[test]
|
||||
fn test_imports() {
|
||||
let context = new_context();
|
||||
let context = make_test_context();
|
||||
let mut imports = crate::mocked_resolver(&context);
|
||||
let test_import = r#"
|
||||
circuit Point {
|
||||
@ -74,7 +70,7 @@ fn test_imports() {
|
||||
"#;
|
||||
imports
|
||||
.packages
|
||||
.insert("test-import".to_string(), load_asg(&context, test_import).unwrap());
|
||||
.insert("test-import".to_string(), load_asg(test_import).unwrap());
|
||||
let program_string = r#"
|
||||
import test-import.foo;
|
||||
|
||||
|
@ -14,20 +14,18 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_empty() {
|
||||
let program_string = include_str!("empty.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_iteration() {
|
||||
let program_string = include_str!("iteration.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -47,7 +45,7 @@ fn test_const_args() {
|
||||
console.assert(a == 20u32);
|
||||
}
|
||||
"#;
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -68,7 +66,7 @@ fn test_const_args_used() {
|
||||
console.assert(a == 6u8);
|
||||
}
|
||||
"#;
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -87,61 +85,61 @@ fn test_const_args_fail() {
|
||||
console.assert(a == 1u8);
|
||||
}
|
||||
"#;
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_iteration_repeated() {
|
||||
let program_string = include_str!("iteration_repeated.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_newlines() {
|
||||
let program_string = include_str!("newlines.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_returns() {
|
||||
let program_string = include_str!("multiple_returns.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_returns_main() {
|
||||
let program_string = include_str!("multiple_returns_main.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_repeated_function_call() {
|
||||
let program_string = include_str!("repeated.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_return() {
|
||||
let program_string = include_str!("return.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_undefined() {
|
||||
let program_string = include_str!("undefined.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_value_unchanged() {
|
||||
let program_string = include_str!("value_unchanged.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_array_input() {
|
||||
let program_string = include_str!("array_input.leo");
|
||||
load_asg(&new_context(), program_string).err().unwrap();
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
// Test return multidimensional arrays
|
||||
@ -149,13 +147,13 @@ fn test_array_input() {
|
||||
#[test]
|
||||
fn test_return_array_nested_pass() {
|
||||
let program_string = include_str!("return_array_nested_pass.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_return_array_tuple_pass() {
|
||||
let program_string = include_str!("return_array_tuple_pass.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Test return tuples
|
||||
@ -163,11 +161,11 @@ fn test_return_array_tuple_pass() {
|
||||
#[test]
|
||||
fn test_return_tuple() {
|
||||
let program_string = include_str!("return_tuple.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_return_tuple_conditional() {
|
||||
let program_string = include_str!("return_tuple_conditional.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,14 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_one() {
|
||||
let program_string = include_str!("one.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -31,79 +29,79 @@ fn test_implicit() {
|
||||
let element: group = 0;
|
||||
}
|
||||
"#;
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_zero() {
|
||||
let program_string = include_str!("zero.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_point() {
|
||||
let program_string = include_str!("point.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_x_sign_high() {
|
||||
let program_string = include_str!("x_sign_high.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_x_sign_low() {
|
||||
let program_string = include_str!("x_sign_low.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_x_sign_inferred() {
|
||||
let program_string = include_str!("x_sign_inferred.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_y_sign_high() {
|
||||
let program_string = include_str!("y_sign_high.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_y_sign_low() {
|
||||
let program_string = include_str!("y_sign_low.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_y_sign_inferred() {
|
||||
let program_string = include_str!("y_sign_inferred.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_point_input() {
|
||||
let program_string = include_str!("point_input.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input() {
|
||||
let program_string = include_str!("input.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_negate() {
|
||||
let program_string = include_str!("negate.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_add() {
|
||||
let program_string = include_str!("add.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -113,29 +111,29 @@ fn test_add_explicit() {
|
||||
let c: group = 0group + 1group;
|
||||
}
|
||||
"#;
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sub() {
|
||||
let program_string = include_str!("sub.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_console_assert_pass() {
|
||||
let program_string = include_str!("assert_eq.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_eq() {
|
||||
let program_string = include_str!("eq.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ternary() {
|
||||
let program_string = include_str!("ternary.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,17 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::{load_asg, load_asg_imports, mocked_resolver};
|
||||
use crate::{load_asg, load_asg_imports, make_test_context, mocked_resolver};
|
||||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
let context = new_context();
|
||||
let context = make_test_context();
|
||||
let mut imports = mocked_resolver(&context);
|
||||
imports.packages.insert(
|
||||
"test-import".to_string(),
|
||||
load_asg(&context, include_str!("src/test-import.leo")).unwrap(),
|
||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
||||
);
|
||||
let program_string = include_str!("basic.leo");
|
||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
||||
@ -32,11 +30,11 @@ fn test_basic() {
|
||||
|
||||
#[test]
|
||||
fn test_multiple() {
|
||||
let context = new_context();
|
||||
let context = make_test_context();
|
||||
let mut imports = mocked_resolver(&context);
|
||||
imports.packages.insert(
|
||||
"test-import".to_string(),
|
||||
load_asg(&context, include_str!("src/test-import.leo")).unwrap(),
|
||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
||||
);
|
||||
let program_string = include_str!("multiple.leo");
|
||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
||||
@ -44,11 +42,11 @@ fn test_multiple() {
|
||||
|
||||
#[test]
|
||||
fn test_star() {
|
||||
let context = new_context();
|
||||
let context = make_test_context();
|
||||
let mut imports = mocked_resolver(&context);
|
||||
imports.packages.insert(
|
||||
"test-import".to_string(),
|
||||
load_asg(&context, include_str!("src/test-import.leo")).unwrap(),
|
||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
||||
);
|
||||
|
||||
let program_string = include_str!("star.leo");
|
||||
@ -57,11 +55,11 @@ fn test_star() {
|
||||
|
||||
#[test]
|
||||
fn test_alias() {
|
||||
let context = new_context();
|
||||
let context = make_test_context();
|
||||
let mut imports = mocked_resolver(&context);
|
||||
imports.packages.insert(
|
||||
"test-import".to_string(),
|
||||
load_asg(&context, include_str!("src/test-import.leo")).unwrap(),
|
||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
||||
);
|
||||
|
||||
let program_string = include_str!("alias.leo");
|
||||
@ -71,20 +69,18 @@ fn test_alias() {
|
||||
// naming tests
|
||||
#[test]
|
||||
fn test_name() {
|
||||
let context = new_context();
|
||||
let context = make_test_context();
|
||||
let mut imports = mocked_resolver(&context);
|
||||
imports.packages.insert(
|
||||
"hello-world".to_string(),
|
||||
load_asg(&context, include_str!("src/hello-world.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"a0-f".to_string(),
|
||||
load_asg(&context, include_str!("src/a0-f.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"a-9".to_string(),
|
||||
load_asg(&context, include_str!("src/a-9.leo")).unwrap(),
|
||||
load_asg(include_str!("src/hello-world.leo")).unwrap(),
|
||||
);
|
||||
imports
|
||||
.packages
|
||||
.insert("a0-f".to_string(), load_asg(include_str!("src/a0-f.leo")).unwrap());
|
||||
imports
|
||||
.packages
|
||||
.insert("a-9".to_string(), load_asg(include_str!("src/a-9.leo")).unwrap());
|
||||
|
||||
let program_string = include_str!("names.leo");
|
||||
load_asg_imports(&context, program_string, &mut imports).unwrap();
|
||||
@ -93,31 +89,31 @@ fn test_name() {
|
||||
// more complex tests
|
||||
#[test]
|
||||
fn test_many_import() {
|
||||
let context = new_context();
|
||||
let context = make_test_context();
|
||||
let mut imports = mocked_resolver(&context);
|
||||
imports.packages.insert(
|
||||
"test-import".to_string(),
|
||||
load_asg(&context, include_str!("src/test-import.leo")).unwrap(),
|
||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"bar".to_string(),
|
||||
load_asg(&context, include_str!("imports/bar/src/lib.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/bar/src/lib.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"bar.baz".to_string(),
|
||||
load_asg(&context, include_str!("imports/bar/src/baz.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"bar.baz".to_string(),
|
||||
load_asg(&context, include_str!("imports/bar/src/baz.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"bar.bat.bat".to_string(),
|
||||
load_asg(&context, include_str!("imports/bar/src/bat/bat.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/bar/src/bat/bat.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"car".to_string(),
|
||||
load_asg(&context, include_str!("imports/car/src/lib.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/car/src/lib.leo")).unwrap(),
|
||||
);
|
||||
|
||||
let program_string = include_str!("many_import.leo");
|
||||
@ -126,31 +122,31 @@ fn test_many_import() {
|
||||
|
||||
#[test]
|
||||
fn test_many_import_star() {
|
||||
let context = new_context();
|
||||
let context = make_test_context();
|
||||
let mut imports = mocked_resolver(&context);
|
||||
imports.packages.insert(
|
||||
"test-import".to_string(),
|
||||
load_asg(&context, include_str!("src/test-import.leo")).unwrap(),
|
||||
load_asg(include_str!("src/test-import.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"bar".to_string(),
|
||||
load_asg(&context, include_str!("imports/bar/src/lib.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/bar/src/lib.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"bar.baz".to_string(),
|
||||
load_asg(&context, include_str!("imports/bar/src/baz.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"bar.baz".to_string(),
|
||||
load_asg(&context, include_str!("imports/bar/src/baz.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"bar.bat.bat".to_string(),
|
||||
load_asg(&context, include_str!("imports/bar/src/bat/bat.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/bar/src/bat/bat.leo")).unwrap(),
|
||||
);
|
||||
imports.packages.insert(
|
||||
"car".to_string(),
|
||||
load_asg(&context, include_str!("imports/car/src/lib.leo")).unwrap(),
|
||||
load_asg(include_str!("imports/car/src/lib.leo")).unwrap(),
|
||||
);
|
||||
|
||||
let program_string = include_str!("many_import_star.leo");
|
||||
|
@ -14,18 +14,16 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_input_pass() {
|
||||
let program_string = include_str!("main.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_input_multiple() {
|
||||
let program_string = include_str!("main_multiple.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_access() {
|
||||
let program_string = include_str!("access.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,18 +14,16 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_access_state() {
|
||||
let program_string = include_str!("access_state.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_access_all() {
|
||||
let program_string = include_str!("access_all.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -16,96 +16,94 @@
|
||||
|
||||
macro_rules! test_int {
|
||||
($name: ident) => {
|
||||
use leo_asg::new_context;
|
||||
|
||||
pub struct $name {}
|
||||
|
||||
impl $name {
|
||||
fn test_negate() {
|
||||
let program_string = include_str!("negate.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_negate_zero() {
|
||||
let program_string = include_str!("negate_zero.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
impl super::IntegerTester for $name {
|
||||
fn test_min() {
|
||||
let program_string = include_str!("min.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_max() {
|
||||
let program_string = include_str!("max.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_add() {
|
||||
let program_string = include_str!("add.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_sub() {
|
||||
let program_string = include_str!("sub.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_mul() {
|
||||
let program_string = include_str!("mul.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_div() {
|
||||
let program_string = include_str!("div.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_pow() {
|
||||
let program_string = include_str!("pow.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_eq() {
|
||||
let program_string = include_str!("eq.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_ne() {
|
||||
let program_string = include_str!("ne.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_ge() {
|
||||
let program_string = include_str!("ge.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_gt() {
|
||||
let program_string = include_str!("gt.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_le() {
|
||||
let program_string = include_str!("le.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_lt() {
|
||||
let program_string = include_str!("lt.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_console_assert() {
|
||||
let program_string = include_str!("console_assert.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_ternary() {
|
||||
let program_string = include_str!("ternary.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -16,84 +16,82 @@
|
||||
|
||||
macro_rules! test_uint {
|
||||
($name: ident) => {
|
||||
use leo_asg::new_context;
|
||||
|
||||
pub struct $name {}
|
||||
|
||||
impl super::IntegerTester for $name {
|
||||
fn test_min() {
|
||||
let program_string = include_str!("min.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_max() {
|
||||
let program_string = include_str!("max.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_add() {
|
||||
let program_string = include_str!("add.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_sub() {
|
||||
let program_string = include_str!("sub.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_mul() {
|
||||
let program_string = include_str!("mul.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_div() {
|
||||
let program_string = include_str!("div.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_pow() {
|
||||
let program_string = include_str!("pow.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_eq() {
|
||||
let program_string = include_str!("eq.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_ne() {
|
||||
let program_string = include_str!("ne.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_ge() {
|
||||
let program_string = include_str!("ge.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_gt() {
|
||||
let program_string = include_str!("gt.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_le() {
|
||||
let program_string = include_str!("le.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_lt() {
|
||||
let program_string = include_str!("lt.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_console_assert() {
|
||||
let program_string = include_str!("console_assert.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
fn test_ternary() {
|
||||
let program_string = include_str!("ternary.leo");
|
||||
crate::load_asg(&new_context(), program_string).unwrap();
|
||||
crate::load_asg(program_string).unwrap();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -14,60 +14,58 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_let_mut() {
|
||||
let program_string = include_str!("let_mut.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_let_mut_nested() {
|
||||
let program_string = include_str!("let_mut_nested.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_array_mut() {
|
||||
let program_string = include_str!("array_mut.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_array_tuple_mut() {
|
||||
let program_string = include_str!("array_tuple_mut.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_array_splice_mut() {
|
||||
let program_string = include_str!("array_splice_mut.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_circuit_mut() {
|
||||
let program_string = include_str!("circuit_mut.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_circuit_variable_mut() {
|
||||
let program_string = include_str!("circuit_variable_mut.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_function_input_mut() {
|
||||
let program_string = include_str!("function_input_mut.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_swap() {
|
||||
let program_string = include_str!("swap.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,42 +14,40 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_assert() {
|
||||
let program_string = include_str!("assert.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mutate() {
|
||||
let program_string = include_str!("mutate.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_for_loop() {
|
||||
let program_string = include_str!("for_loop.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_chain() {
|
||||
let program_string = include_str!("chain.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nested() {
|
||||
let program_string = include_str!("nested.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_returns() {
|
||||
let program_string = include_str!("multiple_returns.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
pub mod conditional;
|
||||
@ -25,7 +23,7 @@ pub mod conditional;
|
||||
#[test]
|
||||
fn test_ternary_basic() {
|
||||
let program_string = include_str!("ternary_basic.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
// Iteration for i {start}..{stop} { statements }
|
||||
@ -33,11 +31,11 @@ fn test_ternary_basic() {
|
||||
#[test]
|
||||
fn test_iteration_basic() {
|
||||
let program_string = include_str!("iteration_basic.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_block() {
|
||||
let program_string = include_str!("block.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -14,72 +14,70 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_asg::new_context;
|
||||
|
||||
use crate::load_asg;
|
||||
|
||||
#[test]
|
||||
fn test_tuple_basic() {
|
||||
let program_string = include_str!("basic.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tuple_access() {
|
||||
let program_string = include_str!("access.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tuple_typed() {
|
||||
let program_string = include_str!("typed.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple() {
|
||||
let program_string = include_str!("multiple.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_typed() {
|
||||
let program_string = include_str!("multiple_typed.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_function() {
|
||||
let program_string = include_str!("function.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_function_typed() {
|
||||
let program_string = include_str!("function_typed.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_function_multiple() {
|
||||
let program_string = include_str!("function_multiple.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nested() {
|
||||
let program_string = include_str!("nested.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nested_access() {
|
||||
let program_string = include_str!("nested_access.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nested_typed() {
|
||||
let program_string = include_str!("nested_typed.leo");
|
||||
load_asg(&new_context(), program_string).unwrap();
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
@ -108,10 +108,6 @@ version = "1.0"
|
||||
[dependencies.tracing]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.uuid]
|
||||
version = "0.8"
|
||||
features = [ "v4", "serde" ]
|
||||
|
||||
[dev-dependencies.num-bigint]
|
||||
version = "0.3"
|
||||
|
||||
|
@ -47,7 +47,10 @@ use std::{
|
||||
pub use leo_asg::{new_context, AsgContext as Context, AsgContext};
|
||||
|
||||
thread_local! {
|
||||
static THREAD_GLOBAL_CONTEXT: AsgContext<'static> = Box::leak(Box::new(new_context()));
|
||||
static THREAD_GLOBAL_CONTEXT: AsgContext<'static> = {
|
||||
let leaked = Box::leak(Box::new(leo_asg::new_alloc_context()));
|
||||
leo_asg::new_context(leaked)
|
||||
}
|
||||
}
|
||||
|
||||
/// Conventience function to return a leaked thread-local global context. Should only be used for transient programs (like cli).
|
||||
|
@ -27,10 +27,11 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
// Evaluate the identifier name in the current function scope
|
||||
let variable = variable_ref.variable.borrow();
|
||||
|
||||
let result_value = if let Some(value) = self.get(&variable.id) {
|
||||
let result_value = if let Some(value) = self.get(variable.id) {
|
||||
value.clone()
|
||||
} else {
|
||||
return Err(ExpressionError::undefined_identifier(variable.name.clone())); // todo: probably can be a panic here instead
|
||||
return Err(ExpressionError::undefined_identifier(variable.name.clone()));
|
||||
// todo: probably can be a panic here instead
|
||||
};
|
||||
|
||||
Ok(result_value)
|
||||
|
@ -83,7 +83,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
if function.qualifier == FunctionQualifier::MutSelfRef {
|
||||
if let (Some(self_var), Some(target)) = (self_var, target) {
|
||||
let new_self = self
|
||||
.get(&self_var.borrow().id)
|
||||
.get(self_var.borrow().id)
|
||||
.expect("no self variable found in mut self context")
|
||||
.clone();
|
||||
if let Some(assignable_target) = self.resolve_mut_ref(cs, target)? {
|
||||
|
@ -104,7 +104,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
let variable = target.unwrap();
|
||||
let variable = variable.borrow();
|
||||
|
||||
let mut result = vec![match self.get_mut(&variable.id) {
|
||||
let mut result = vec![match self.get_mut(variable.id) {
|
||||
Some(value) => value,
|
||||
None => return Err(StatementError::undefined_variable(variable.name.to_string(), span)),
|
||||
}];
|
||||
|
@ -22,11 +22,10 @@ use leo_asg::Program;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub struct ConstrainedProgram<'a, F: PrimeField, G: GroupType<F>> {
|
||||
pub asg: Program<'a>,
|
||||
identifiers: IndexMap<Uuid, ConstrainedValue<'a, F, G>>,
|
||||
identifiers: IndexMap<u32, ConstrainedValue<'a, F, G>>,
|
||||
}
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
@ -37,15 +36,15 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn store(&mut self, name: Uuid, value: ConstrainedValue<'a, F, G>) {
|
||||
self.identifiers.insert(name, value);
|
||||
pub(crate) fn store(&mut self, id: u32, value: ConstrainedValue<'a, F, G>) {
|
||||
self.identifiers.insert(id, value);
|
||||
}
|
||||
|
||||
pub(crate) fn get(&self, name: &Uuid) -> Option<&ConstrainedValue<'a, F, G>> {
|
||||
self.identifiers.get(name)
|
||||
pub(crate) fn get(&self, id: u32) -> Option<&ConstrainedValue<'a, F, G>> {
|
||||
self.identifiers.get(&id)
|
||||
}
|
||||
|
||||
pub(crate) fn get_mut(&mut self, name: &Uuid) -> Option<&mut ConstrainedValue<'a, F, G>> {
|
||||
self.identifiers.get_mut(name)
|
||||
pub(crate) fn get_mut(&mut self, id: u32) -> Option<&mut ConstrainedValue<'a, F, G>> {
|
||||
self.identifiers.get_mut(&id)
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
|
||||
let variable = assignee.target_variable.get().borrow();
|
||||
|
||||
let mut result = vec![match self.get_mut(&variable.id) {
|
||||
let mut result = vec![match self.get_mut(variable.id) {
|
||||
Some(value) => value,
|
||||
None => return Err(StatementError::undefined_variable(variable.name.to_string(), span)),
|
||||
}];
|
||||
|
@ -36,7 +36,7 @@ pub mod statements;
|
||||
pub mod syntax;
|
||||
pub mod tuples;
|
||||
|
||||
use leo_asg::{new_context, AsgContext};
|
||||
use leo_asg::{new_alloc_context, new_context, AsgContext};
|
||||
use leo_ast::{InputValue, MainInput};
|
||||
use leo_compiler::{
|
||||
compiler::Compiler,
|
||||
@ -60,7 +60,8 @@ pub type EdwardsConstrainedValue = ConstrainedValue<'static, Fq, EdwardsGroupTyp
|
||||
|
||||
//convenience function for tests, leaks memory
|
||||
pub(crate) fn make_test_context() -> AsgContext<'static> {
|
||||
Box::leak(Box::new(new_context()))
|
||||
let allocator = Box::leak(Box::new(new_alloc_context()));
|
||||
new_context(allocator)
|
||||
}
|
||||
|
||||
fn new_compiler() -> EdwardsTestCompiler {
|
||||
|
Loading…
Reference in New Issue
Block a user