Snap des modifications avant modifications des messages d'erreur.
This commit is contained in:
+1
-1
@@ -11,4 +11,4 @@ int main(){
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 6: invalid type for multiplicative operands: integer and string
|
||||
// In function main: Line 8 col 6: type mismatch for multiplicative operator: integer and string
|
||||
+1
-1
@@ -6,4 +6,4 @@ int main(){
|
||||
}
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 4 col 14: invalid type for additive operands: boolean and boolean
|
||||
// In function main: Line 4 col 14: invalid type for additive operands: boolean
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
float x,y,z;
|
||||
|
||||
x = 42.0;
|
||||
y = 0.0;
|
||||
z = x/y;
|
||||
println_float(z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// EXITCODE 1
|
||||
// Division by 0
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
float x,y,z;
|
||||
|
||||
x = 42.0;
|
||||
y = 0.0;
|
||||
z = x%y;
|
||||
println_float(z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// EXITCODE 1
|
||||
// Division by 0
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
|
||||
x = 0;
|
||||
for(;x<4;){
|
||||
println_int(x);
|
||||
x = x+1;
|
||||
}
|
||||
x = 69;
|
||||
for(x=42;false;){
|
||||
}
|
||||
println_int(x);
|
||||
for(x = 100;x>=4;x = x/2){
|
||||
println_int(x+4);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 0
|
||||
// EXPECTED
|
||||
// 0
|
||||
// 1
|
||||
// 2
|
||||
// 3
|
||||
// 42
|
||||
// 104
|
||||
// 54
|
||||
// 29
|
||||
// 16
|
||||
// 10
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y,z;
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
||||
if(x==1)
|
||||
println_string("pif");
|
||||
else{
|
||||
println_string("paf");
|
||||
}
|
||||
if(y==0){
|
||||
println_string("paf");
|
||||
}else
|
||||
println_string("pif");
|
||||
if(x!=y){
|
||||
println_string("pif");
|
||||
}else{
|
||||
println_string("paf");
|
||||
}
|
||||
if(0==0)
|
||||
println_string("paf");
|
||||
else
|
||||
println_string("pif");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// paf
|
||||
// paf
|
||||
// paf
|
||||
// paf
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y,z;
|
||||
|
||||
x = 42;
|
||||
y = 0;
|
||||
z = x/y;
|
||||
println_int(z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 1
|
||||
// EXPECTED
|
||||
// Division by 0
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y,z;
|
||||
|
||||
x = 42;
|
||||
y = 0;
|
||||
z = x%y;
|
||||
println_int(z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 1
|
||||
// EXPECTED
|
||||
// Division by 0
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y,z,a,b,c;
|
||||
string s,d;
|
||||
float v,u,k,n;
|
||||
bool t,w,p;
|
||||
|
||||
println_int(x);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 0
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y,z;
|
||||
float a,b,c;
|
||||
|
||||
x = 42;
|
||||
y = 69;
|
||||
a = 42.0;
|
||||
b = 69.0;
|
||||
z = y-x;
|
||||
println_int(z);
|
||||
c = b-a;
|
||||
println_float(c);
|
||||
y = 690;
|
||||
z = y/x;
|
||||
println_int(z);
|
||||
c = a/12.0;
|
||||
println_float(c);
|
||||
z = y % x;
|
||||
println_int(z);
|
||||
c = b % a;
|
||||
println_float(c);
|
||||
z = -x;
|
||||
println_int(z);
|
||||
c = -b;
|
||||
println_float(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 27
|
||||
// 27.00
|
||||
// 16
|
||||
// 3.50
|
||||
// 18
|
||||
// 27.00
|
||||
// -42
|
||||
// -69.00
|
||||
@@ -0,0 +1,17 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
|
||||
if (true) {
|
||||
x = 42;
|
||||
} else {
|
||||
x = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 9 col 8: type mismatch for x: integer and boolean
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
|
||||
for(x = 0;x<10;x = x+1){
|
||||
println_int(false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 7 col 8: invalid type for println_int statement: boolean
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
|
||||
for(x = 0;x+10;x = x+1){
|
||||
println_int(x);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 6 col 4: invalid type for for condition: integer
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
|
||||
for(x = 0 + false;x<10;x = x+1){
|
||||
println_int(x);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 6 col 12: type mismatch for additive operator: integer and boolean
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
|
||||
for(x = 0;x<10;x = false){
|
||||
println_int(x);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 6 col 19: type mismatch for x: integer and boolean
|
||||
@@ -0,0 +1,17 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
|
||||
if (true) {
|
||||
x = true;
|
||||
}else {
|
||||
x = 42;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 7 col 8: type mismatch for x: integer and boolean
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
bool a;
|
||||
|
||||
if (a) {
|
||||
|
||||
}
|
||||
if (true) {
|
||||
|
||||
}
|
||||
if (x) {
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 13 col 4: invalid type for if condition: integer
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
bool a,b;
|
||||
|
||||
x = x + y;
|
||||
x = a - b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 8: invalid type for additive operands: boolean
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
bool a,b;
|
||||
|
||||
a = a && b;
|
||||
a = x && y;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 8: invalid type for boolean operator: integer
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
bool a,b;
|
||||
|
||||
a = x < y;
|
||||
x = a > b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 8: invalid type for comparaison operator: boolean
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
float z,t;
|
||||
bool a,b;
|
||||
|
||||
x = -y;
|
||||
z = -t;
|
||||
a = -b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 10 col 8: invalid type for minus operator: boolean
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
bool a,b;
|
||||
|
||||
x = x * y;
|
||||
x = a * b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 8: invalid type for multiplicative operands: boolean
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int y;
|
||||
bool a,b;
|
||||
|
||||
a = !b;
|
||||
a = !y;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 8: invalid type for not operator: integer
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
bool a,b;
|
||||
|
||||
a = a || b;
|
||||
a = x || y;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 8: invalid type for boolean operator: integer
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
bool x;
|
||||
string a;
|
||||
|
||||
println_bool(x);
|
||||
println_bool(a);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 4: invalid type for println_bool statement: string
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
float x;
|
||||
string a;
|
||||
|
||||
println_float(x);
|
||||
println_float(a);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 4: invalid type for println_float statement: string
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
string a;
|
||||
|
||||
println_int(x);
|
||||
println_int(a);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 4: invalid type for println_int statement: string
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
string x;
|
||||
bool a;
|
||||
|
||||
println_string(x);
|
||||
println_string(a);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 4: invalid type for println_string statement: boolean
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
float z,t;
|
||||
bool a,b;
|
||||
|
||||
x = x + y;
|
||||
z = z - t;
|
||||
a = x + t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 10 col 8: type mismatch for additive operator: integer and float
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
bool a,b;
|
||||
|
||||
a = a && b;
|
||||
a = x && b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 8: type mismatch for boolean operator: integer and boolean
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
float z,t;
|
||||
bool a,b;
|
||||
|
||||
a = x < y;
|
||||
a = x <= y;
|
||||
b = x > y;
|
||||
a = x >= y;
|
||||
a = z > t;
|
||||
b = z >= t;
|
||||
a = z < t;
|
||||
a = z <= t;
|
||||
b = x <= t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 16 col 8: type mismatch for comparaison operator: integer and float
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
float z,t;
|
||||
string s,v;
|
||||
bool a,b;
|
||||
bool c;
|
||||
|
||||
c = (x==y);
|
||||
c = (z!=t);
|
||||
c = (s==v);
|
||||
c = (a!=b);
|
||||
c = (t==y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 14 col 9: type mismatch for equality operator: float and integer
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
float z,t;
|
||||
bool a,b;
|
||||
|
||||
x = x * y;
|
||||
z = z * t;
|
||||
a = x * t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 10 col 8: type mismatch for multiplicative operator: integer and float
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
bool a,b;
|
||||
|
||||
a = a || b;
|
||||
a = x || b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 8: type mismatch for boolean operator: integer and boolean
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
bool a;
|
||||
|
||||
while (a) {
|
||||
|
||||
}
|
||||
while (false) {
|
||||
|
||||
}
|
||||
while (x) {
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 13 col 4: invalid type for while condition: integer
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y,z;
|
||||
|
||||
x = 42;
|
||||
y = 0;
|
||||
while(y<x){
|
||||
y = y+1;
|
||||
}
|
||||
println_int(y);
|
||||
y = 0;
|
||||
while(y<x)
|
||||
y = y+5;
|
||||
println_int(y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 42
|
||||
// 45
|
||||
|
||||
Reference in New Issue
Block a user