add some tests
This commit is contained in:
parent
8bb03f9dc8
commit
87356531ff
6 changed files with 40 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
||||||
int add (int a, int b) {
|
int add (int a, int b) {
|
||||||
|
# Alors que "add" est le nom d'une instruction
|
||||||
|
# MIPS, ça ne pose aucun problème
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
tests/28_rec.test
Normal file
11
tests/28_rec.test
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
void recursive (int n) {
|
||||||
|
if (n > 0) {
|
||||||
|
puti(n);
|
||||||
|
puts("\n");
|
||||||
|
recursive (n - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main () {
|
||||||
|
recursive(5);
|
||||||
|
}
|
6
tests/29_if-int.test
Normal file
6
tests/29_if-int.test
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
void main () {
|
||||||
|
if (1) { # Error on line 2 col 8: Expected bool but given int.
|
||||||
|
# Requiert le type bool, pas de convertion implicite
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
7
tests/30_else-empty.test
Normal file
7
tests/30_else-empty.test
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
void main () {
|
||||||
|
if (false) {
|
||||||
|
puts("ANTOINE DANIEL\n");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
8
tests/31_return.test
Normal file
8
tests/31_return.test
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
void main () {
|
||||||
|
puti(1312);
|
||||||
|
puts("\n");
|
||||||
|
return;
|
||||||
|
|
||||||
|
# Ce message ne s'affichera pas
|
||||||
|
puts(":)\n");
|
||||||
|
}
|
6
tests/32_while-int.test
Normal file
6
tests/32_while-int.test
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
void main () {
|
||||||
|
while (1) { # Error on line 2 col 11: Expected bool but given int.
|
||||||
|
# Requiert le type bool, pas de convertion implicite
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
Reference in a new issue