cleaned up test suit

This commit is contained in:
Marvin Kaiser
2020-01-14 11:47:04 +01:00
parent be43cc9a77
commit d2d50f6d4f
13 changed files with 218 additions and 205 deletions

165
src/test/test.k Normal file
View File

@@ -0,0 +1,165 @@
function add(x, y) {
return (x + y);
}
function sub (x, y) {
return (x - y);
}
function mul(x, y) {
return (x * y);
}
function modulo(x, y) {
return (x % y);
}
function neg(x) {
return -x;
}
function id(x) {
return x;
}
function arg1(a, b, c, d, e, f, g, h, i ,j) {
return a;
}
function get1() {
return arg1(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function arg2(a, b, c, d, e, f, g, h, i ,j) {
return b;
}
function get2() {
return arg2(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function arg3(a, b, c, d, e, f, g, h, i ,j) {
return c;
}
function get3() {
return arg3(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function arg4(a, b, c, d, e, f, g, h, i ,j) {
return d;
}
function get4() {
return arg4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function arg5(a, b, c, d, e, f, g, h, i ,j) {
return e;
}
function get5() {
return arg5(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function arg6(a, b, c, d, e, f, g, h, i ,j) {
return f;
}
function get6() {
return arg6(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function arg7(a, b, c, d, e, f, g, h, i ,j) {
return g;
}
function get7() {
return arg7(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function arg8(a, b, c, d, e, f, g, h, i ,j) {
return h;
}
function get8() {
return arg8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function arg9(a, b, c, d, e, f, g, h, i ,j) {
return i;
}
function get9() {
return arg9(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function arg10(a, b, c, d, e, f, g, h, i ,j) {
return j;
}
function get10() {
return arg10(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
function fac(x) {
if (x) {
return (x * fac((x - 1)));
}
return 1;
}
function eq(x, y) {
return (x == y);
}
function neq(x, y) {
return (x != y);
}
function lt(x, y) {
return (x < y);
}
function lte(x, y) {
return (x <= y);
}
function gt(x, y) {
return (x > y);
}
function gte(x, y) {
return (x >= y);
}
function selfMinus(x) {
x = (x - 1);
return x;
}
function myWhile(end) {
let cond = 0;
while ((cond < end)) {
cond = (cond + 1);
}
return cond;
}
function myDoWhile(end) {
let cond = 0;
do {
cond = (cond + 1);
} while((cond < end));
return cond;
}
function myFor(end) {
let x = 0;
for (let i = 0; (i < end); i = (i + 1)) {
x = (x + 1);
}
return x;
}
add(1, 1);