fix tests

This commit is contained in:
collin 2020-07-16 20:47:47 -07:00
parent 929ea95fe2
commit 5fb77fd457
20 changed files with 43 additions and 43 deletions

View File

@ -1,7 +1,7 @@
circuit Circ {
circuit Foo {
x: u32
}
function main() -> Circ {
return Circ { x: 1u32 }
function main() -> Foo {
return Foo { x: 1u32 }
}

View File

@ -1,7 +1,7 @@
circuit Circ {
circuit Foo {
x: u32
}
function main() {
let c = Circ { y: 0u32 };
let c = Foo { y: 0u32 };
}

View File

@ -1,3 +1,3 @@
function main() {
let c = Circ { };
let c = Foo { };
}

View File

@ -1,9 +1,9 @@
circuit Circ {
circuit Foo {
x: u32,
}
function main() -> u32 {
let c = Circ { x: 1u32 };
let c = Foo { x: 1u32 };
return c.x
}

View File

@ -1,9 +1,9 @@
circuit Circ {
circuit Foo {
x: u32
}
function main() -> u32 {
let c = Circ { x: 1u32 };
let c = Foo { x: 1u32 };
return c.y
}

View File

@ -1,10 +1,10 @@
circuit Circ {
circuit Foo {
function echo(x: u32) -> u32 {
return x
}
}
function main() -> u32 {
let c = Circ { };
let c = Foo { };
return c.echo(1u32)
}

View File

@ -1,10 +1,10 @@
circuit Circ {
circuit Foo {
function echo(x: u32) -> u32 {
return x
}
}
function main() -> u32 {
let c = Circ { };
let c = Foo { };
return c.echoed(1u32)
}

View File

@ -1,10 +1,10 @@
circuit Circ {
circuit Foo {
static function echo(x: u32) -> u32 {
return x
}
}
function main() -> u32 {
let c = Circ { };
let c = Foo { };
return c.echo(1u32) // echo is a static function and must be accessed using `::`
}

View File

@ -1,9 +1,9 @@
circuit Circ {
circuit Foo {
static function echo(x: u32) -> u32 {
return x
}
}
function main() -> u32 {
return Circ::echo(1u32)
return Foo::echo(1u32)
}

View File

@ -1,9 +1,9 @@
circuit Circ {
circuit Foo {
function echo(x: u32) -> u32 {
return x
}
}
function main() -> u32 {
return Circ::echo(1u32) // echo is a non-static function and must be accessed using `.`
return Foo::echo(1u32) // echo is a non-static function and must be accessed using `.`
}

View File

@ -1,9 +1,9 @@
circuit Circ {
circuit Foo {
static function echo(x: u32) -> u32 {
return x
}
}
function main() -> u32 {
return Circ::echoed(1u32)
return Foo::echoed(1u32)
}

View File

@ -16,13 +16,13 @@ use leo_types::{Expression, Function, Identifier, Span, Statement, Type};
use snarkos_models::gadgets::utilities::uint::UInt32;
// Circ { x: 1u32 }
// Foo { x: 1u32 }
fn output_circuit(program: EdwardsTestCompiler) {
let output = get_output(program);
assert_eq!(
EdwardsConstrainedValue::Return(vec![ConstrainedValue::CircuitExpression(
Identifier {
name: "Circ".to_string(),
name: "Foo".to_string(),
span: Span {
text: "".to_string(),
line: 0,
@ -202,7 +202,7 @@ fn test_self_circuit() {
let output = get_output(program);
// circuit Circ {
// circuit Foo {
// static function new() -> Self {
// return Self { }
// }
@ -210,7 +210,7 @@ fn test_self_circuit() {
assert_eq!(
EdwardsConstrainedValue::Return(vec![ConstrainedValue::CircuitExpression(
Identifier {
name: "Circ".to_string(),
name: "Foo".to_string(),
span: Span {
text: "".to_string(),
line: 0,

View File

@ -1,9 +1,9 @@
circuit Circ {
circuit Foo {
static function new() -> Self {
return Self { }
}
}
function main() -> Circ {
return Circ::new()
function main() -> Foo {
return Foo::new()
}

View File

@ -7,6 +7,6 @@ circuit Foo {
}
function main() -> u32 {
let circuit = Foo { f: 1u32 };
return circuit.bar()
let foo = Foo { f: 1u32 };
return foo.bar()
}

View File

@ -7,6 +7,6 @@ circuit Foo {
}
function main() -> u32 {
let circuit = Foo { f: 1u32 };
return circuit.bar()
let foo = Foo { f: 1u32 };
return foo.bar()
}

View File

@ -5,6 +5,6 @@ circuit Foo {
}
function main() -> u32 {
let circuit = Foo { };
return circuit.bar()
let foo = Foo { };
return foo.bar()
}

View File

@ -1,8 +1,8 @@
function test() -> (bool, bool) {
function tuple() -> (bool, bool) {
return (true, false)
}
function main() -> (bool, bool) {
let (a, b) = test();
let (a, b) = tuple();
return (a, b)
}

View File

@ -1,7 +1,7 @@
function test() -> bool {
function one() -> bool {
return true
}
function main() -> bool {
return test() && test()
return one() && one()
}

View File

@ -1,9 +1,9 @@
// Circuits are immutable by default.
circuit Circ {
circuit Foo {
x: u32
}
function main() {
let a = Circ { x: 1 };
let a = Foo { x: 1 };
a.x = 0;
}

View File

@ -1,10 +1,10 @@
// Adding the `mut` keyword makes a circuit variable mutable.
circuit Circ {
circuit Foo {
x: u32
}
function main() -> u32 {
let mut a = Circ { x: 1 };
let mut a = Foo { x: 1 };
a.x = 0;
return a.x