add some tests

This commit is contained in:
Mylloon 2022-12-14 00:31:05 +01:00
parent 8bb03f9dc8
commit 87356531ff
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
6 changed files with 40 additions and 0 deletions

View file

@ -1,4 +1,6 @@
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;
}

11
tests/28_rec.test Normal file
View 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
View 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
View file

@ -0,0 +1,7 @@
void main () {
if (false) {
puts("ANTOINE DANIEL\n");
} else {
}
}

8
tests/31_return.test Normal file
View 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
View 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;
}
}