mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-11 13:56:58 +03:00
Add tests
This commit is contained in:
parent
b6851a9cd8
commit
af2447aa02
15
tests/tests/compiler/array/array_conditional_write_pass.leo
Normal file
15
tests/tests/compiler/array/array_conditional_write_pass.leo
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
transition foo(a: [bool; 8]) -> [bool; 8] {
|
||||
if a[0u32] {
|
||||
a[1u32] = false;
|
||||
} else {
|
||||
a[1u32] = true;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
13
tests/tests/compiler/array/array_write_in_loop_pass.leo
Normal file
13
tests/tests/compiler/array/array_write_in_loop_pass.leo
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
transition foo(a: [bool; 8]) -> [bool; 8] {
|
||||
for i: u8 in 0u8..8u8 {
|
||||
a[i] = false;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
program test.aleo {
|
24
tests/tests/execution/mat_mul.leo
Normal file
24
tests/tests/execution/mat_mul.leo
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
namespace: Execute
|
||||
expectation: Pass
|
||||
cases:
|
||||
matrix_multiply:
|
||||
- input:
|
||||
- "[1u64, 2u64, 3u64, 4u64, 5u64, 6u64, 7u64, 8u64, 9u64]"
|
||||
- "[1u64, 2u64, 3u64, 4u64, 5u64, 6u64, 7u64, 8u64, 9u64]"
|
||||
*/
|
||||
|
||||
|
||||
program test.aleo {
|
||||
transition matrix_multiply(a: [[u64; 3]; 3], b: [[u64; 3]; 3]) -> [[u64; 3]; 3] {
|
||||
let mut result: [[u64; 3]; 3] = [[0u64; 3]; 3];
|
||||
for i: u8 in 0u8..3u8 {
|
||||
for j: u8 in 0u8..3u8 {
|
||||
for k: u8 in 0u8..3u8 {
|
||||
result[i][j] += a[i][k] * b[k][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user