mirror of
https://github.com/AleoHQ/leo.git
synced 2024-08-17 02:40:29 +03:00
added scalar tests
This commit is contained in:
parent
f6aa7a578a
commit
92cac97a84
3
.gitignore
vendored
3
.gitignore
vendored
@ -18,3 +18,6 @@ sccache*/
|
||||
*~
|
||||
\#*\#
|
||||
.\#*
|
||||
|
||||
# code coverage scripts
|
||||
*.bat
|
10
tests/compiler/scalar/add.leo
Normal file
10
tests/compiler/scalar/add.leo
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/scalars.in
|
||||
*/
|
||||
|
||||
function main(a: scalar, b: scalar, c: scalar) -> bool {
|
||||
return a + b == c;
|
||||
}
|
16
tests/compiler/scalar/cmp.leo
Normal file
16
tests/compiler/scalar/cmp.leo
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/scalars.in
|
||||
*/
|
||||
|
||||
function main(a: scalar, b: scalar) -> bool {
|
||||
let c: bool = a == b;
|
||||
let d: bool = a != b;
|
||||
let e: bool = a > b;
|
||||
let f: bool = a < b;
|
||||
let g: bool = a >= b;
|
||||
let h: bool = a <= b;
|
||||
return h;
|
||||
}
|
10
tests/compiler/scalar/div.leo
Normal file
10
tests/compiler/scalar/div.leo
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/scalars.in
|
||||
*/
|
||||
|
||||
function main(a: scalar, b: scalar, c: scalar) -> bool {
|
||||
return a / b != c;
|
||||
}
|
15
tests/compiler/scalar/group_mul.leo
Normal file
15
tests/compiler/scalar/group_mul.leo
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/scalar_group.in
|
||||
*/
|
||||
|
||||
function main(a: scalar, b: group, c: scalar) -> bool {
|
||||
let d: group = 1group * a;
|
||||
let e: group = a * 1group;
|
||||
let f: group = b * a;
|
||||
let g: group = a * b;
|
||||
|
||||
return a * g == d;
|
||||
}
|
7
tests/compiler/scalar/inputs/scalar_group.in
Normal file
7
tests/compiler/scalar/inputs/scalar_group.in
Normal file
@ -0,0 +1,7 @@
|
||||
[main]
|
||||
a: scalar = 1scalar;
|
||||
b: group = 1group;
|
||||
c: scalar = 2scalar;
|
||||
|
||||
[registers]
|
||||
r: bool = false;
|
7
tests/compiler/scalar/inputs/scalars.in
Normal file
7
tests/compiler/scalar/inputs/scalars.in
Normal file
@ -0,0 +1,7 @@
|
||||
[main]
|
||||
a: scalar = 1scalar;
|
||||
b: scalar = 1scalar;
|
||||
c: scalar = 2scalar;
|
||||
|
||||
[registers]
|
||||
r: bool = false;
|
10
tests/compiler/scalar/mul.leo
Normal file
10
tests/compiler/scalar/mul.leo
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/scalars.in
|
||||
*/
|
||||
|
||||
function main(a: scalar, b: scalar, c: scalar) -> bool {
|
||||
return a * b == c;
|
||||
}
|
10
tests/compiler/scalar/negate.leo
Normal file
10
tests/compiler/scalar/negate.leo
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/scalars.in
|
||||
*/
|
||||
|
||||
function main(a: scalar, b: scalar) -> bool {
|
||||
return -a == -b;
|
||||
}
|
8
tests/compiler/scalar/no_space_between_literal.leo
Normal file
8
tests/compiler/scalar/no_space_between_literal.leo
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
function main() {
|
||||
const f = 1 scalar;
|
||||
}
|
11
tests/compiler/scalar/scalar.leo
Normal file
11
tests/compiler/scalar/scalar.leo
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/scalars.in
|
||||
*/
|
||||
|
||||
function main(a: scalar) -> bool {
|
||||
const s: scalar = 1scalar;
|
||||
return s + a == 0scalar;
|
||||
}
|
10
tests/compiler/scalar/ternary.leo
Normal file
10
tests/compiler/scalar/ternary.leo
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/scalars.in
|
||||
*/
|
||||
|
||||
function main(a: scalar, b: scalar, c: scalar) -> bool {
|
||||
return b == 1scalar ? a == 1scalar : c == 2scalar;
|
||||
}
|
Loading…
Reference in New Issue
Block a user