mirror of
https://github.com/AleoHQ/leo.git
synced 2024-09-20 19:47:22 +03:00
Add tests
This commit is contained in:
parent
70051888e8
commit
2354cc8b41
@ -16,4 +16,5 @@ program test.aleo {
|
||||
|
||||
transition main(a: u8, b:u8) -> u8 {
|
||||
return a + b;
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
26
tests/compiler/records/record_init_out_of_order.leo
Normal file
26
tests/compiler/records/record_init_out_of_order.leo
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
// TODO: This should be made into an integration test.
|
||||
|
||||
program test.aleo {
|
||||
record Token {
|
||||
// The token owner.
|
||||
owner: address,
|
||||
// The Aleo balance (in gates).
|
||||
gates: u64,
|
||||
// The token amount.
|
||||
amount: u64,
|
||||
}
|
||||
|
||||
transition main(owner: address, a: u64) -> Token {
|
||||
let amount: u64 = a * a;
|
||||
return Token {
|
||||
amount,
|
||||
gates: 0u64,
|
||||
owner,
|
||||
};
|
||||
}
|
||||
}
|
36
tests/compiler/structs/struct_init_out_of_order.leo
Normal file
36
tests/compiler/structs/struct_init_out_of_order.leo
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
// TODO: This should be made into an integration test.
|
||||
|
||||
program test.aleo {
|
||||
struct Foo {
|
||||
a: u8,
|
||||
b: u16,
|
||||
}
|
||||
|
||||
struct Bar {
|
||||
a: u8,
|
||||
b: u8,
|
||||
}
|
||||
|
||||
transition main(a: u8, b: u16) -> (Foo, Bar) {
|
||||
let c: u8 = a + a;
|
||||
let d: u16 = b * b;
|
||||
let e: Foo = Foo {
|
||||
b: d,
|
||||
a: c,
|
||||
};
|
||||
let f: Bar = Bar {
|
||||
b: c,
|
||||
a: a,
|
||||
};
|
||||
return (e, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user