implement function call tests for floats and floats mixed with integers

This commit is contained in:
2020-03-04 20:46:49 +01:00
parent 384d98418d
commit 18cfbdcbb5
3 changed files with 126 additions and 1 deletions

View File

@@ -69,4 +69,27 @@ int runFunctionCallTests () {
argumentTest_f("fget8(...args)", 8.0, fget8());
argumentTest_f("fget9(...args)", 9.0, fget9());
argumentTest_f("fget10(...args)", 10.0, fget10());
printf("\nFunction Call Tests With Floats And Integers \n");
argumentTest_f("fargMix1(...args)", 1.0, fargMix1(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
argumentTest_f("fargMix2(...args)", 2, fargMix2(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
argumentTest_f("fargMix3(...args)", 3.0, fargMix3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
argumentTest_f("fargMix4(...args)", 4, fargMix4(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
argumentTest_f("fargMix5(...args)", 5.0, fargMix5(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
argumentTest_f("fargMix6(...args)", 6, fargMix6(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
argumentTest_f("fargMix7(...args)", 7.0, fargMix7(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
argumentTest_f("fargMix8(...args)", 8, fargMix8(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
argumentTest_f("fargMix9(...args)", 9.0, fargMix9(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
argumentTest_f("fargMix10(...args)", 10, fargMix10(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
// Checks that parameters are correctly passed from klang to functions
argumentTest_f("fgetMix1(...args)", 1.0, fgetMix1());
argumentTest("fgetMix2(...args)", 2, fgetMix2());
argumentTest_f("fgetMix3(...args)", 3.0, fgetMix3());
argumentTest("fgetMix4(...args)", 4, fgetMix4());
argumentTest_f("fgetMix5(...args)", 5.0, fgetMix5());
argumentTest("fgetMix6(...args)", 6, fgetMix6());
argumentTest_f("fgetMix7(...args)", 7.0, fgetMix7());
argumentTest("fgetMix8(...args)", 8, fgetMix8());
argumentTest_f("fgetMix9(...args)", 9.0, fgetMix9());
argumentTest("fgetMix10(...args)", 10, fgetMix10());
}

View File

@@ -31,6 +31,17 @@ double farg8(double a, double b, double c, double d, double e, double f, double
double farg9(double a, double b, double c, double d, double e, double f, double g, double h, double i, double j);
double farg10(double a, double b, double c, double d, double e, double f, double g, double h, double i, double j);
double fargMix1(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
int fargMix2(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
double fargMix3(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
int fargMix4(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
double fargMix5(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
int fargMix6(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
double fargMix7(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
int fargMix8(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
double fargMix9(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
int fargMix10(double a, int b, double c, int d, double e, int f, double g, int h, double i, int j);
double fget1();
double fget2();
double fget3();
@@ -40,4 +51,15 @@ double fget6();
double fget7();
double fget8();
double fget9();
double fget10();
double fget10();
double fgetMix1();
int fgetMix2();
double fgetMix3();
int fgetMix4();
double fgetMix5();
int fgetMix6();
double fgetMix7();
int fgetMix8();
double fgetMix9();
int fgetMix10();

View File

@@ -184,6 +184,86 @@ function fget10(): float {
return farg10(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0);
}
function fargMix1(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): float {
return a;
}
function fgetMix1(): float {
return fargMix1(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fargMix2(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): int {
return b;
}
function fgetMix2(): int {
return fargMix2(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fargMix3(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): float {
return c;
}
function fgetMix3(): float {
return fargMix3(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fargMix4(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): int {
return d;
}
function fgetMix4(): int {
return fargMix4(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fargMix5(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): float {
return e;
}
function fgetMix5(): float {
return fargMix5(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fargMix6(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): int {
return f;
}
function fgetMix6(): int {
return fargMix6(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fargMix7(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): float {
return g;
}
function fgetMix7(): float {
return fargMix7(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fargMix8(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): int {
return h;
}
function fgetMix8(): int {
return fargMix8(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fargMix9(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): float {
return i;
}
function fgetMix9(): float {
return fargMix9(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fargMix10(a: float, b: int, c: float, d: int, e: float, f: int, g: float, h: int, i: float ,j: int): int {
return j;
}
function fgetMix10(): int {
return fargMix10(1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10);
}
function fadd(x: float, y: float): float {
return x + y;
}