Add tests

This commit is contained in:
Pranav Gaddamadugu 2023-08-03 00:50:48 -04:00
parent 023d94d20f
commit c80c782248
5 changed files with 95 additions and 0 deletions

View File

@ -195,6 +195,7 @@ symbols! {
set,
to_x_coordinate,
to_y_coordinate,
verify,
// types
address,

View 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);
}
}

View File

@ -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);
}
}

View 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);
}
}

View File

@ -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;
}
}