implement test functions

This commit is contained in:
2020-03-07 01:22:38 +01:00
parent 08398e4064
commit 3b5dc43cfb

View File

@@ -415,4 +415,68 @@ function mixdiv(x: float, y: int): float {
return x / y;
}
struct testStruct {
a: int;
b: bool;
c: int;
}
struct testStructRec {
a: int;
b: testStructRec;
}
function getTestStruct(a: int, b: bool, c: int): testStruct {
return create testStruct(a, b, c);
}
function getTestStructRec(a: int, b: testStructRec): testStructRec {
return create testStructRec(a, b);
}
function getStructFieldA(t: testStruct): int {
return t.a;
}
function getStructFieldB(t: testStruct): bool {
return t.b;
}
function getStructFieldC(t: testStruct): int {
return t.c;
}
function setStructFieldA(t: testStruct, a: int): testStruct {
t.a = a;
return t;
}
function setStructFieldB(t: testStruct, b: bool): testStruct {
t.b = b;
return t;
}
function setStructFieldC(t: testStruct, c: int): testStruct {
t.c = c;
return t;
}
function getStructFieldRecA(t: testStructRec): int {
return t.a;
}
function getStructFieldRecB(t: testStructRec): testStructRec {
return t.b;
}
function setStructFieldRecA(t: testStructRec, a: int): testStructRec {
t.a = a;
return t;
}
function setStructFieldRecB(t: testStructRec, b: testStructRec): testStructRec {
t.b = b;
return t;
}
add(1, 1);