automated commit TP3
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int n;
|
||||
n=17;
|
||||
m=n+3;
|
||||
println_int(m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// EXITCODE 2
|
||||
// In function main: Line 6 col 2: Undefined variable m
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
x="blablabla";
|
||||
return 0;
|
||||
}
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 5 col 2: type mismatch for x: integer and string
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int n;
|
||||
string s;
|
||||
n=17;
|
||||
s="seventeen";
|
||||
s = n*s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 8 col 6: invalid type for multiplicative operands: integer and string
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
string x;
|
||||
x=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 5 col 2: type mismatch for x: string and integer
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
x=34+f;
|
||||
return 0;
|
||||
}
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 5 col 7: Undefined variable f
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
println_int("foo");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 4 col 2: invalid type for println_int statement: string
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
println_int(true+true);
|
||||
return 0;
|
||||
}
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 4 col 14: invalid type for additive operands: boolean and boolean
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x,y;
|
||||
int z,x;
|
||||
x=42;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 2
|
||||
// EXPECTED
|
||||
// In function main: Line 5 col 2: Variable x already declared
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int toto(){
|
||||
println_int(42);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXITCODE 1
|
||||
// EXPECTED
|
||||
// No main function in file
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int n,u;
|
||||
n=17;
|
||||
u=n;
|
||||
println_int(n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 17
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
if (2 < 3)
|
||||
{
|
||||
println_int(1);
|
||||
}
|
||||
if (2 > 3)
|
||||
{
|
||||
println_int(2);
|
||||
}
|
||||
if (2 <= 2)
|
||||
{
|
||||
println_int(3);
|
||||
}
|
||||
if (2 >= 2)
|
||||
{
|
||||
println_int(4);
|
||||
}
|
||||
|
||||
if (2 == 3)
|
||||
{
|
||||
println_int(10);
|
||||
}
|
||||
if (2 != 3)
|
||||
{
|
||||
println_int(20);
|
||||
}
|
||||
if (2 == 2)
|
||||
{
|
||||
println_int(30);
|
||||
}
|
||||
if (2 != 2)
|
||||
{
|
||||
println_int(40);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 1
|
||||
// 3
|
||||
// 4
|
||||
// 20
|
||||
// 30
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main() {
|
||||
if ((1.0 + 2.0) * 3.0 == 9.0) {
|
||||
println_string("OK");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// OK
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
println_int(3/2+45*(2/1));
|
||||
println_int(23+19);
|
||||
println_bool( (false || 3 != 77 ) && (42<=1515) );
|
||||
println_string("coucou");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 91
|
||||
// 42
|
||||
// 1
|
||||
// coucou
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
println_int(42);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 42
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
int x;
|
||||
x="blabla";
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// In function main: Line 5 col 2: type mismatch for x: integer and string
|
||||
// EXITCODE 2
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
string x,y,z;
|
||||
x = "ENS";
|
||||
y = "De Lyon";
|
||||
z = x + " " + y;
|
||||
println_string(z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// ENS De Lyon
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main(){
|
||||
string n,m;
|
||||
n = "foo";
|
||||
m = "bar";
|
||||
println_string(n);
|
||||
println_string(m);
|
||||
println_string(n + m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// foo
|
||||
// bar
|
||||
// foobar
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main() {
|
||||
string s;
|
||||
println_string(s);
|
||||
s = s + "Coucou";
|
||||
println_string(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
//
|
||||
// Coucou
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main() {
|
||||
bool x;
|
||||
if (x) {
|
||||
println_int(1);
|
||||
}
|
||||
x = !x;
|
||||
if (x) {
|
||||
println_int(2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 2
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main() {
|
||||
float x;
|
||||
println_float(x);
|
||||
x = x + 1.0;
|
||||
println_float(x);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 0.00
|
||||
// 1.00
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "printlib.h"
|
||||
|
||||
int main() {
|
||||
int x;
|
||||
println_int(x);
|
||||
x = x + 1;
|
||||
println_int(x);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// EXPECTED
|
||||
// 0
|
||||
// 1
|
||||
@@ -0,0 +1 @@
|
||||
Add your own tests in this directory.
|
||||
Reference in New Issue
Block a user