mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-22 17:51:39 +03:00
Add a member_field_and_function test
This commit is contained in:
parent
8b8d205bf0
commit
d80734fbb5
@ -16,7 +16,7 @@ graph LR
|
||||
|
||||
Pass2 -- statements --> Pass4(Synthesizer)
|
||||
|
||||
Pass4 -- constraints --> Pass5(Circuit)
|
||||
Pass4 -- constraints --> Pass5(Program)
|
||||
```
|
||||
|
||||
</details>
|
||||
|
@ -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>> {
|
||||
|
12
compiler/tests/circuits/member_field_and_function.leo
Normal file
12
compiler/tests/circuits/member_field_and_function.leo
Normal 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()
|
||||
}
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user