mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-22 09:01:35 +03:00
re-introduce some disabled tests, fix some
This commit is contained in:
parent
e03af95ff6
commit
d33e69bac8
compiler/parser/src/parser
disabled_tests/compiler
console
function
integers
i16
i32
i8
mutability
statements
tests/compiler
_group
add.leoassert_eq.leoboth_sign_high.leoboth_sign_inferred.leoboth_sign_low.leoeq.leoinput.leo
input
negate.leono_space_between_literal.leoone.leopoint.leopoint_input.leopositive_and_negative.leosub.leoternary.leox_sign_high.leox_sign_inferred.leox_sign_low.leoy_sign_high.leoy_sign_inferred.leoy_sign_low.leozero.leoboolean
char
inputs
ascii.inescaped.inescaped_unicode1.inescaped_unicode2.inescaped_unicode3.inescaped_unicode4.inescaped_unicode5.inescaped_unicode6.inhex1.inhex2.innonprinting.inunicode1.inunicode2.inunicode3.inunicode4.inunicode5.in
invalid_char.leoneq.leoout.leoconsole
assert.leoconditional_assert.leoerror.leo
inputs
log.leolog_conditional.leolog_fail.leolog_input.leolog_parameter.leolog_parameter_many.leolog_parameter_unkown_fail.leodefinition
field/output
function
@ -32,6 +32,7 @@ pub(crate) const TYPE_TOKENS: &[Token] = &[
|
||||
Token::Group,
|
||||
Token::Address,
|
||||
Token::Bool,
|
||||
Token::Char,
|
||||
];
|
||||
|
||||
impl ParserContext<'_> {
|
||||
|
@ -5,9 +5,6 @@ input_file: input/dummy.in
|
||||
*/
|
||||
|
||||
function main() -> i8 {
|
||||
if true {
|
||||
return 1i8; //ignored
|
||||
}
|
||||
return 2i8; //ignored
|
||||
return 3i8; //returns
|
||||
return 2i8;
|
||||
return 3i8;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
input_file: input/dummy.in
|
||||
*/
|
||||
|
||||
const hi = 1u32;
|
||||
|
@ -1,10 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: ../input/dummy.in
|
||||
*/
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
const a: i32 = 2147483647;
|
||||
return y == true;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: ../input/dummy.in
|
||||
*/
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
const a: i32 = -2147483648;
|
||||
return y == true;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
inputs:
|
||||
- i32.in: |
|
||||
[main]
|
||||
a: i32 = 2;
|
||||
b: i32 = 5;
|
||||
c: i32 = 10;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
*/
|
||||
|
||||
function main(a: i32, b: i32, c: i32) -> bool {
|
||||
return a * b == c;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
inputs:
|
||||
- i32_ne.in: |
|
||||
[main]
|
||||
a: i32 = 2;
|
||||
b: i32 = 5;
|
||||
c: bool = true;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
- i32_e.in: |
|
||||
[main]
|
||||
a: i32 = 5;
|
||||
b: i32 = 5;
|
||||
c: bool = false;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
*/
|
||||
|
||||
function main(a: i32, b: i32, c: bool) -> bool{
|
||||
return (a != b) == c;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
inputs:
|
||||
- i32.in: |
|
||||
[main]
|
||||
a: i32 = 5;
|
||||
b: i32 = -5;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
- i32.in: |
|
||||
[main]
|
||||
a: i32 = -5;
|
||||
b: i32 = 5;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
*/
|
||||
|
||||
function main(a: i32, b: i32) -> bool {
|
||||
return -a == b;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
inputs:
|
||||
- dummy.in: |
|
||||
[main]
|
||||
y: bool = true;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
*/
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
const a = 0i32;
|
||||
|
||||
return (-a == 0i32) == y;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main(a: i32, b: i32, c: i32) -> bool {
|
||||
return a ** b == c;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
inputs:
|
||||
- i32.in: |
|
||||
[main]
|
||||
a: i32 = 100;
|
||||
b: i32 = 50;
|
||||
c: i32 = 50;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
*/
|
||||
|
||||
function main(a: i32, b: i32, c: i32) -> bool {
|
||||
return a - b == c;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
inputs:
|
||||
- i32.in: |
|
||||
[main]
|
||||
s: bool = true;
|
||||
a: i32 = 10;
|
||||
b: i32 = 5;
|
||||
c: i32 = 10;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
- i32_rev.in: |
|
||||
[main]
|
||||
s: bool = false;
|
||||
a: i32 = 10;
|
||||
b: i32 = 5;
|
||||
c: i32 = 5;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
*/
|
||||
|
||||
function main(s: bool, a: i32, b: i32, c: i32) -> bool {
|
||||
let r = s ? a : b;
|
||||
|
||||
return r == c;
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
expectation: Pass
|
||||
input_file: ../input/dummy.in
|
||||
*/
|
||||
|
||||
function main() {
|
||||
const a = -128i8;
|
||||
const b = -a;
|
||||
function main(y: bool) -> bool {
|
||||
const a: = -128i8;
|
||||
const b: = -a;
|
||||
|
||||
return (b == -a) == y;
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
*/
|
||||
|
||||
function main(a: bool) -> bool {
|
||||
let x = 2u8;
|
||||
let y = x;
|
||||
let z = y / 2u8;
|
||||
return (z == 1) == a;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function main(k: bool) -> bool {
|
||||
let reverse: u32 = 0;
|
||||
for i in 9..0 {
|
||||
reverse += i;
|
||||
}
|
||||
|
||||
let forward: u32 = 0;
|
||||
for x in 0..10 {
|
||||
forward += x;
|
||||
}
|
||||
|
||||
let reverse_inclusive: u32 = 0;
|
||||
for a in 10..=0 {
|
||||
reverse_inclusive += a;
|
||||
}
|
||||
|
||||
let forward_inclusive: u32 = 0;
|
||||
for b in 0..=10 {
|
||||
forward_inclusive += b;
|
||||
}
|
||||
|
||||
return (reverse == forward) && (reverse_inclusive == forward_inclusive) && k;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: inputs/u32_3.in
|
||||
*/
|
||||
|
||||
function main(x: u32) -> bool {
|
||||
const COUNT: u32 = 2;
|
||||
let y = x;
|
||||
|
||||
for i in 0..COUNT {
|
||||
y -= 1;
|
||||
}
|
||||
|
||||
return y == 1;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main(a: group, b: group, c: group) {
|
||||
console.assert(a + b == c);
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main(a: group, b: group) {
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = (+, +)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = (_, _)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = (-, -)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main(a: group, b: group, c: bool) {
|
||||
console.assert((a == b) == c);
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main(a: group, b: group) {
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
[main]
|
||||
a: group = (0, -)group;
|
||||
b: group = (0, _)group;
|
@ -1,3 +0,0 @@
|
||||
function main(a: group, b: group) {
|
||||
console.assert(-a == b);
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const g = (0,1) group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = 1group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main(a: group) {
|
||||
const b = a;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
function main() {
|
||||
const pos_element = 1group;
|
||||
const neg_element = -1group;
|
||||
|
||||
const pair_x_pos = (1, _)group;
|
||||
const pair_x_neg = (-1, _)group;
|
||||
|
||||
const pair_y_pos = (_, 1)group;
|
||||
const pair_y_neg = (_, -1)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main(a: group, b: group, c: group) {
|
||||
console.assert(a - b == c);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
function main(s: bool, a: group, b: group, c: group) {
|
||||
const r = s ? a : b;
|
||||
|
||||
console.assert(r == c);
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = (0, +)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = (0, _)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = (0, -)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = (+, 1)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = (_, 1)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = (-, 1)group;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
const element = 0group;
|
||||
}
|
@ -2,10 +2,10 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- input/false_false.in
|
||||
- input/false_true.in
|
||||
- input/true_false.in
|
||||
- input/true_true.in
|
||||
- inputs/false_false.in
|
||||
- inputs/false_true.in
|
||||
- inputs/true_false.in
|
||||
- inputs/true_true.in
|
||||
*/
|
||||
|
||||
function main(a: bool, b: bool) -> bool {
|
||||
|
@ -2,10 +2,10 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- input/false_false.in
|
||||
- input/false_true.in
|
||||
- input/true_false.in
|
||||
- input/true_true.in
|
||||
- inputs/false_false.in
|
||||
- inputs/false_true.in
|
||||
- inputs/true_false.in
|
||||
- inputs/true_true.in
|
||||
*/
|
||||
|
||||
function main(a: bool, b: bool) -> bool {
|
||||
|
@ -2,10 +2,10 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- input/false_false.in
|
||||
- input/false_true.in
|
||||
- input/true_false.in
|
||||
- input/true_true.in
|
||||
- inputs/false_false.in
|
||||
- inputs/false_true.in
|
||||
- inputs/true_false.in
|
||||
- inputs/true_true.in
|
||||
*/
|
||||
|
||||
function main(a: bool, b: bool) -> bool {
|
||||
|
@ -2,10 +2,10 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- input/false_false.in
|
||||
- input/false_true.in
|
||||
- input/true_false.in
|
||||
- input/true_true.in
|
||||
- inputs/false_false.in
|
||||
- inputs/false_true.in
|
||||
- inputs/true_false.in
|
||||
- inputs/true_true.in
|
||||
*/
|
||||
|
||||
function main(a: bool, b: bool) -> bool {
|
||||
|
@ -2,10 +2,10 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- input/false_false.in
|
||||
- input/false_true.in
|
||||
- input/true_false.in
|
||||
- input/true_true.in
|
||||
- inputs/false_false.in
|
||||
- inputs/false_true.in
|
||||
- inputs/true_false.in
|
||||
- inputs/true_true.in
|
||||
*/
|
||||
|
||||
function main(a: bool, b: bool) -> bool {
|
||||
|
@ -1,13 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
inputs:
|
||||
- assert.in: |
|
||||
[main]
|
||||
a: bool = true;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
||||
input_file: inputs/true.in
|
||||
*/
|
||||
|
||||
function main(a: bool) -> bool {
|
@ -1,19 +1,17 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
inputs:
|
||||
- cond.in: |
|
||||
[main]
|
||||
a: bool = true;
|
||||
- cond_2.in: |
|
||||
[main]
|
||||
a: bool = false;
|
||||
input_file:
|
||||
- inputs/true.in
|
||||
- inputs/false.in
|
||||
*/
|
||||
|
||||
function main(a: bool) {
|
||||
function main(a: bool) -> bool {
|
||||
if a {
|
||||
console.assert(a == true);
|
||||
} else {
|
||||
console.assert(a == false);
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function main(y: bool) -> bool {
|
5
tests/compiler/console/inputs/false.in
Normal file
5
tests/compiler/console/inputs/false.in
Normal file
@ -0,0 +1,5 @@
|
||||
[main]
|
||||
a: bool = false;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
@ -1,6 +1,6 @@
|
||||
[main]
|
||||
a: u32 = 1;
|
||||
b: u32 = 1;
|
||||
a: u32 = 1u32;
|
||||
b: u32 = 1u32;
|
||||
|
||||
[registers]
|
||||
r0: bool = true;
|
@ -1,6 +1,6 @@
|
||||
[main]
|
||||
a: u32 = 1;
|
||||
b: u32 = 0;
|
||||
a: u32 = 1u32;
|
||||
b: u32 = 0u32;
|
||||
|
||||
[registers]
|
||||
r0: bool = true;
|
5
tests/compiler/console/inputs/true.in
Normal file
5
tests/compiler/console/inputs/true.in
Normal file
@ -0,0 +1,5 @@
|
||||
[main]
|
||||
a: bool = true;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function main(y: bool) -> bool {
|
@ -2,8 +2,8 @@
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- input/input_unequal.in
|
||||
- input/input_equal.in
|
||||
- inputs/input_unequal.in
|
||||
- inputs/input_equal.in
|
||||
*/
|
||||
|
||||
// Conditionally add two u32 integers and log the result to the console.
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function main(y: bool) -> bool {
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function main(y: bool) -> bool {
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function main(y: bool) -> bool {
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
// @test
|
||||
|
@ -1,2 +0,0 @@
|
||||
[registers]
|
||||
r: field = 1;
|
@ -1,2 +0,0 @@
|
||||
[registers]
|
||||
r: field = 0;
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/integers.in
|
||||
input_file: inputs/integers.in
|
||||
*/
|
||||
|
||||
function main(a: u32) -> u32 {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function main(a: u32, a: u32) -> u32 {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function one() -> u32 {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function iteration() -> u32 {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function one() -> bool {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file: input/dummy.in
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
function one() -> u32 {
|
||||
|
@ -8,9 +8,9 @@ function foo() -> field {
|
||||
return myGlobal;
|
||||
}
|
||||
|
||||
function main() {
|
||||
function main() -> field {
|
||||
const myGlobal = 42field;
|
||||
const err = foo();
|
||||
|
||||
// TODO: update after field comparison is enabled
|
||||
return err;
|
||||
}
|
16
tests/compiler/function/shadow_function_with_input_fail.leo
Normal file
16
tests/compiler/function/shadow_function_with_input_fail.leo
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
function hi() -> u8 {
|
||||
return 0u8;
|
||||
}
|
||||
|
||||
function tester(hi: u8) -> u8 {
|
||||
return 0u8;
|
||||
}
|
||||
|
||||
function main (y: bool) -> bool {
|
||||
return y;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user