mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-13 08:47:17 +03:00
Add tests
This commit is contained in:
parent
023d94d20f
commit
c80c782248
@ -195,6 +195,7 @@ symbols! {
|
||||
set,
|
||||
to_x_coordinate,
|
||||
to_y_coordinate,
|
||||
verify,
|
||||
|
||||
// types
|
||||
address,
|
||||
|
24
tests/tests/compiler/signature/signature.leo
Normal file
24
tests/tests/compiler/signature/signature.leo
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
|
||||
struct foo {
|
||||
a: u8,
|
||||
b: scalar
|
||||
}
|
||||
|
||||
transition verify_field(s: signature, a: address, v: field) {
|
||||
let first: bool = signature::verify(s, a, v);
|
||||
let second: bool = s.verify(a, v);
|
||||
assert_eq(first, second);
|
||||
}
|
||||
|
||||
transition verify_foo(s: signature, a: address, v: foo) {
|
||||
let first: bool = signature::verify(s, a, v);
|
||||
let second: bool = s.verify(a, v);
|
||||
assert_eq(first, second);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
|
||||
struct foo {
|
||||
a: u8,
|
||||
b: scalar
|
||||
}
|
||||
|
||||
transition verify_field(s: signature, a: address, v: field) {
|
||||
let first: bool = signature::verify(a, s, v);
|
||||
let second: bool = s.verify(1u8, v);
|
||||
assert_eq(first, second);
|
||||
}
|
||||
|
||||
transition verify_foo(s: signature, a: address, v: foo) {
|
||||
let first: bool = signature::verify(a, v, s);
|
||||
let second: bool = s.verify(v, a);
|
||||
assert_eq(first, second);
|
||||
}
|
||||
}
|
22
tests/tests/parser/type_/signature.leo
Normal file
22
tests/tests/parser/type_/signature.leo
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
transition baz(s: signature, a: address, v: value) {
|
||||
let a: bool = signature::verify(s, a, v);
|
||||
let b: bool = s.verify(a, v);
|
||||
assert_eq(a, b);
|
||||
}
|
||||
|
||||
transition bar(x: u8) -> u8 {
|
||||
let signature: u8 = 1u8 + x;
|
||||
return signature;
|
||||
}
|
||||
|
||||
transition bax(s: signature, a: address, v: value) {
|
||||
let a: bool = signature::sign(s, a, v);
|
||||
assert_eq(a, b);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
transition baz(s: signature, a: address, v: value) {
|
||||
let a: bool = signature.verify(s, a, v);
|
||||
assert(a, b);
|
||||
}
|
||||
|
||||
transition bar(s: signature, a: address, v: value) {
|
||||
let b: bool = s.verify(a, a, v);
|
||||
assert_eq(a, b);
|
||||
}
|
||||
|
||||
transition foo(signature: field) -> u8 {
|
||||
return 0u8;
|
||||
}
|
||||
|
||||
transition signature(foo: field) -> u8 {
|
||||
return 0u8;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user