re-introduce some disabled tests, fix some

This commit is contained in:
gluax 2022-05-05 15:38:55 -07:00
parent e03af95ff6
commit d33e69bac8
304 changed files with 1148 additions and 408 deletions

View File

@ -32,6 +32,7 @@ pub(crate) const TYPE_TOKENS: &[Token] = &[
Token::Group, Token::Group,
Token::Address, Token::Address,
Token::Bool, Token::Bool,
Token::Char,
]; ];
impl ParserContext<'_> { impl ParserContext<'_> {

View File

@ -5,9 +5,6 @@ input_file: input/dummy.in
*/ */
function main() -> i8 { function main() -> i8 {
if true { return 2i8;
return 1i8; //ignored return 3i8;
}
return 2i8; //ignored
return 3i8; //returns
} }

View File

@ -1,7 +1,6 @@
/* /*
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
input_file: input/dummy.in
*/ */
const hi = 1u32; const hi = 1u32;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +0,0 @@
function main(a: i32, b: i32, c: i32) -> bool {
return a ** b == c;
}

View File

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

View File

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

View File

@ -1,9 +1,12 @@
/* /*
namespace: Compile namespace: Compile
expectation: Fail expectation: Pass
input_file: ../input/dummy.in
*/ */
function main() { function main(y: bool) -> bool {
const a = -128i8; const a: = -128i8;
const b = -a; const b: = -a;
return (b == -a) == y;
} }

View File

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

View File

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

View File

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

View File

@ -1,3 +0,0 @@
function main(a: group, b: group, c: group) {
console.assert(a + b == c);
}

View File

@ -1,3 +0,0 @@
function main(a: group, b: group) {
console.assert(a == b);
}

View File

@ -1,3 +0,0 @@
function main() {
const element = (+, +)group;
}

View File

@ -1,3 +0,0 @@
function main() {
const element = (_, _)group;
}

View File

@ -1,3 +0,0 @@
function main() {
const element = (-, -)group;
}

View File

@ -1,3 +0,0 @@
function main(a: group, b: group, c: bool) {
console.assert((a == b) == c);
}

View File

@ -1,3 +0,0 @@
function main(a: group, b: group) {
console.assert(a == b);
}

View File

@ -1,3 +0,0 @@
[main]
a: group = (0, -)group;
b: group = (0, _)group;

View File

@ -1,3 +0,0 @@
function main(a: group, b: group) {
console.assert(-a == b);
}

View File

@ -1,3 +0,0 @@
function main() {
const g = (0,1) group;
}

View File

@ -1,3 +0,0 @@
function main() {
const element = 1group;
}

View File

@ -1,3 +0,0 @@
function main() {
const point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group;
}

View File

@ -1,3 +0,0 @@
function main(a: group) {
const b = a;
}

View File

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

View File

@ -1,3 +0,0 @@
function main(a: group, b: group, c: group) {
console.assert(a - b == c);
}

View File

@ -1,5 +0,0 @@
function main(s: bool, a: group, b: group, c: group) {
const r = s ? a : b;
console.assert(r == c);
}

View File

@ -1,3 +0,0 @@
function main() {
const element = (0, +)group;
}

View File

@ -1,3 +0,0 @@
function main() {
const element = (0, _)group;
}

View File

@ -1,3 +0,0 @@
function main() {
const element = (0, -)group;
}

View File

@ -1,3 +0,0 @@
function main() {
const element = (+, 1)group;
}

View File

@ -1,3 +0,0 @@
function main() {
const element = (_, 1)group;
}

View File

@ -1,3 +0,0 @@
function main() {
const element = (-, 1)group;
}

View File

@ -1,3 +0,0 @@
function main() {
const element = 0group;
}

View File

@ -2,10 +2,10 @@
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input_file:
- input/false_false.in - inputs/false_false.in
- input/false_true.in - inputs/false_true.in
- input/true_false.in - inputs/true_false.in
- input/true_true.in - inputs/true_true.in
*/ */
function main(a: bool, b: bool) -> bool { function main(a: bool, b: bool) -> bool {

View File

@ -2,10 +2,10 @@
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input_file:
- input/false_false.in - inputs/false_false.in
- input/false_true.in - inputs/false_true.in
- input/true_false.in - inputs/true_false.in
- input/true_true.in - inputs/true_true.in
*/ */
function main(a: bool, b: bool) -> bool { function main(a: bool, b: bool) -> bool {

View File

@ -2,10 +2,10 @@
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input_file:
- input/false_false.in - inputs/false_false.in
- input/false_true.in - inputs/false_true.in
- input/true_false.in - inputs/true_false.in
- input/true_true.in - inputs/true_true.in
*/ */
function main(a: bool, b: bool) -> bool { function main(a: bool, b: bool) -> bool {

View File

@ -2,10 +2,10 @@
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input_file:
- input/false_false.in - inputs/false_false.in
- input/false_true.in - inputs/false_true.in
- input/true_false.in - inputs/true_false.in
- input/true_true.in - inputs/true_true.in
*/ */
function main(a: bool, b: bool) -> bool { function main(a: bool, b: bool) -> bool {

View File

@ -2,10 +2,10 @@
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input_file:
- input/false_false.in - inputs/false_false.in
- input/false_true.in - inputs/false_true.in
- input/true_false.in - inputs/true_false.in
- input/true_true.in - inputs/true_true.in
*/ */
function main(a: bool, b: bool) -> bool { function main(a: bool, b: bool) -> bool {

View File

@ -1,13 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
inputs: input_file: inputs/true.in
- assert.in: |
[main]
a: bool = true;
[registers]
r0: bool = false;
*/ */
function main(a: bool) -> bool { function main(a: bool) -> bool {

View File

@ -1,19 +1,17 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
inputs: input_file:
- cond.in: | - inputs/true.in
[main] - inputs/false.in
a: bool = true;
- cond_2.in: |
[main]
a: bool = false;
*/ */
function main(a: bool) { function main(a: bool) -> bool {
if a { if a {
console.assert(a == true); console.assert(a == true);
} else { } else {
console.assert(a == false); console.assert(a == false);
} }
return a;
} }

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function main(y: bool) -> bool { function main(y: bool) -> bool {

View File

@ -0,0 +1,5 @@
[main]
a: bool = false;
[registers]
r0: bool = false;

View File

@ -1,6 +1,6 @@
[main] [main]
a: u32 = 1; a: u32 = 1u32;
b: u32 = 1; b: u32 = 1u32;
[registers] [registers]
r0: bool = true; r0: bool = true;

View File

@ -1,6 +1,6 @@
[main] [main]
a: u32 = 1; a: u32 = 1u32;
b: u32 = 0; b: u32 = 0u32;
[registers] [registers]
r0: bool = true; r0: bool = true;

View File

@ -0,0 +1,5 @@
[main]
a: bool = true;
[registers]
r0: bool = false;

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function main(y: bool) -> bool { function main(y: bool) -> bool {

View File

@ -2,8 +2,8 @@
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input_file:
- input/input_unequal.in - inputs/input_unequal.in
- input/input_equal.in - inputs/input_equal.in
*/ */
// Conditionally add two u32 integers and log the result to the console. // Conditionally add two u32 integers and log the result to the console.

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function main(y: bool) -> bool { function main(y: bool) -> bool {

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function main(y: bool) -> bool { function main(y: bool) -> bool {

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function main(y: bool) -> bool { function main(y: bool) -> bool {

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
// @test // @test

View File

@ -1,2 +0,0 @@
[registers]
r: field = 1;

View File

@ -1,2 +0,0 @@
[registers]
r: field = 0;

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/integers.in input_file: inputs/integers.in
*/ */
function main(a: u32) -> u32 { function main(a: u32) -> u32 {

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function main(y: bool) -> bool { function main(y: bool) -> bool {

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function main(a: u32, a: u32) -> u32 { function main(a: u32, a: u32) -> u32 {

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function one() -> u32 { function one() -> u32 {

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function iteration() -> u32 { function iteration() -> u32 {

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function one() -> bool { function one() -> bool {

View File

@ -1,7 +1,7 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Pass
input_file: input/dummy.in input_file: inputs/dummy.in
*/ */
function one() -> u32 { function one() -> u32 {

View File

@ -8,9 +8,9 @@ function foo() -> field {
return myGlobal; return myGlobal;
} }
function main() { function main() -> field {
const myGlobal = 42field; const myGlobal = 42field;
const err = foo(); const err = foo();
// TODO: update after field comparison is enabled return err;
} }

View 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