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
compiler/parser/src/parser
disabled_tests/compiler
tests/compiler

View File

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

View File

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

View File

@ -1,7 +1,6 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
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
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;
}

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
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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

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

View File

@ -1,7 +1,7 @@
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
input_file: inputs/dummy.in
*/
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]
a: u32 = 1;
b: u32 = 1;
a: u32 = 1u32;
b: u32 = 1u32;
[registers]
r0: bool = true;

View File

@ -1,6 +1,6 @@
[main]
a: u32 = 1;
b: u32 = 0;
a: u32 = 1u32;
b: u32 = 0u32;
[registers]
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
expectation: Pass
input_file: input/dummy.in
input_file: inputs/dummy.in
*/
function main(y: bool) -> bool {

View File

@ -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.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 {

View File

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

View File

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

View File

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

View File

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

View File

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

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