feat: replace end2end test and add more test

This commit is contained in:
2026-04-22 21:52:31 +02:00
parent 92eefb5cf1
commit c2fc11bbeb
17 changed files with 251 additions and 139 deletions
+4
View File
@@ -1,3 +1,7 @@
[expected_return_code]
42
[code]
fn main() -> i32 {
let a = 0;
let b = 0;
-7
View File
@@ -1,7 +0,0 @@
fn eq(a: i32, b: i32) -> bool { return a == b; }
fn neq(a: i32, b: i32) -> bool { return a != b; }
fn lt(a: i32, b: i32) -> bool { return a < b; }
fn lte(a: i32, b: i32) -> bool { return a <= b; }
fn gt(a: i32, b: i32) -> bool { return a > b; }
fn gte(a: i32, b: i32) -> bool { return a >= b; }
fn not_bool(a: bool) -> bool { return !a; }
+13
View File
@@ -1,3 +1,16 @@
[expected_return_code]
0
[code]
fn eq(a: i32, b: i32) -> bool { return a == b; }
fn neq(a: i32, b: i32) -> bool { return a != b; }
fn lt(a: i32, b: i32) -> bool { return a < b; }
fn lte(a: i32, b: i32) -> bool { return a <= b; }
fn gt(a: i32, b: i32) -> bool { return a > b; }
fn gte(a: i32, b: i32) -> bool { return a >= b; }
fn not_bool(a: bool) -> bool { return !a; }
[harness]
#include <stdbool.h>
extern bool eq(int a, int b);
+21
View File
@@ -0,0 +1,21 @@
[expected_return_code]
15
[code]
fn main() -> i32 {
let val = 0;
if true {
val = 10;
} else {
val = 20;
}
if false {
val = val + 100;
} else {
val = val + 5;
}
return val;
}
+17
View File
@@ -0,0 +1,17 @@
[expected_return_code]
7
[code]
fn main() -> i32 {
let n = 4;
if n == 1 {
return 10;
} else if n == 2 {
return 20;
} else if n == 3 {
return 30;
} else {
return 7;
}
}
+18
View File
@@ -0,0 +1,18 @@
[expected_return_code]
42
[code]
fn main() -> i32 {
let x = 5;
let y = 10;
if x > 0 {
if y < 5 {
return 1;
} else {
return 42;
}
} else {
return 2;
}
}
+17
View File
@@ -0,0 +1,17 @@
[expected_return_code]
100
[code]
fn main() -> i32 {
let a = 10;
if a == 10 {
a = 100;
}
if a == 5 {
a = 0; // Should be skipped
}
return a;
}
@@ -1,3 +1,7 @@
[expected_return_code]
55
[code]
fn main() -> i32 {
let n = 10;
let a = 0;
-9
View File
@@ -1,9 +0,0 @@
extern int min(int a, int b);
int main() {
if (min(12, 15)) {
return 0;
} else {
return -1;
}
}
-7
View File
@@ -1,7 +0,0 @@
fn min(a: i32, b: i32) -> i32 {
if a < b {
return a;
} else {
return b;
}
}
+22
View File
@@ -0,0 +1,22 @@
[expected_return_code]
0
[code]
fn min(a: i32, b: i32) -> i32 {
if a < b {
return a;
} else {
return b;
}
}
[harness]
extern int min(int a, int b);
int main() {
if (min(12, 15)) {
return 0;
} else {
return -1;
}
}
@@ -1,3 +1,7 @@
[expected_return_code]
30
[code]
fn main() -> i32 {
let a = 10;
let b: i32 = 20;
@@ -1,3 +1,7 @@
[expected_return_code]
42
[code]
fn main() -> i32 {
return 10 * 4 + 2;
}
@@ -1,3 +1,7 @@
[expected_return_code]
187
[code]
fn main() -> i8 {
return -69;
}
@@ -1,3 +1,7 @@
[expected_return_code]
16
[code]
fn main() -> i32 {
let i = 0;
let sum = 0;