Add a member_field_and_function test

This commit is contained in:
howardwu 2020-06-20 01:40:56 -07:00
parent 8b8d205bf0
commit d80734fbb5
4 changed files with 22 additions and 1 deletions

View File

@ -16,7 +16,7 @@ graph LR
Pass2 -- statements --> Pass4(Synthesizer)
Pass4 -- constraints --> Pass5(Circuit)
Pass4 -- constraints --> Pass5(Program)
```
</details>

View File

@ -3,6 +3,7 @@
use crate::{constraints::ConstrainedValue, GroupType};
use snarkos_models::curves::{Field, PrimeField};
use std::collections::HashMap;
pub struct ConstrainedProgram<F: Field + PrimeField, G: GroupType<F>> {

View File

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

View File

@ -98,6 +98,14 @@ fn test_member_field_fail() {
fail_undefined_member(program);
}
#[test]
fn test_member_field_and_function() {
let bytes = include_bytes!("member_field_and_function.leo");
let program = parse_program(bytes).unwrap();
output_one(program);
}
#[test]
fn test_member_function() {
let bytes = include_bytes!("member_function.leo");