TP03: Add more tests
This commit is contained in:
parent
ab992cf6f0
commit
646db2fd97
10
MiniC/TP03/tests/students/base/test_add_boolean.c
Normal file
10
MiniC/TP03/tests/students/base/test_add_boolean.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "printlib.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
println_bool(true + false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXITCODE 2
|
||||||
|
// EXPECTED
|
||||||
|
// In function main: Line 4 col 15: invalid type for additive operands: boolean and boolean
|
27
MiniC/TP03/tests/students/base/test_fibonacci.c
Normal file
27
MiniC/TP03/tests/students/base/test_fibonacci.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "printlib.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int num, result, i;
|
||||||
|
int prev1, prev2, tmp;
|
||||||
|
result = -1;
|
||||||
|
num = 15;
|
||||||
|
|
||||||
|
if (num < 2) {
|
||||||
|
result = num;
|
||||||
|
} else {
|
||||||
|
prev1 = 1;
|
||||||
|
prev2 = 0;
|
||||||
|
for i=2 to num {
|
||||||
|
tmp = prev1;
|
||||||
|
prev1 = prev1 + prev2;
|
||||||
|
prev2 = tmp;
|
||||||
|
}
|
||||||
|
result = prev1+prev2;
|
||||||
|
}
|
||||||
|
println_int(result);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SKIP TEST EXPECTED
|
||||||
|
// EXPECTED
|
||||||
|
// 610
|
18
MiniC/TP03/tests/students/base/test_imbriqued_for.c
Normal file
18
MiniC/TP03/tests/students/base/test_imbriqued_for.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "printlib.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int i, count;
|
||||||
|
|
||||||
|
for i=0 to 6 {
|
||||||
|
for i=0 to 6 {
|
||||||
|
count = count + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
println_int(count);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SKIP TEST EXPECTED
|
||||||
|
// EXPECTED
|
||||||
|
// 36
|
Loading…
Reference in New Issue
Block a user