1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-10-21 02:24:34 +00:00

Added test demonstrating problem with passing struct in array as parameter #224

This commit is contained in:
Jesper Gravgaard 2019-07-16 22:39:36 +02:00
parent bef7663023
commit cb5dc6550e
2 changed files with 31 additions and 0 deletions

View File

@ -35,6 +35,13 @@ public class TestPrograms {
public TestPrograms() { public TestPrograms() {
} }
/*
@Test
public void testProblemArrayStructParam() throws IOException, URISyntaxException {
compileAndCompare("problem-array-struct-param");
}
*/
/* /*
@Test @Test
public void testProblemArrayStructInit() throws IOException, URISyntaxException { public void testProblemArrayStructInit() throws IOException, URISyntaxException {

View File

@ -0,0 +1,24 @@
// Demonstrates problem with passing struct array element as parameter to call
const char* SCREEN = 0x0400;
char idx = 0;
struct Point {
char x;
char y;
};
struct Point[2] points;
void main() {
points[0] = { 1, 2 };
points[1] = { 3, 4 };
for ( char i: 0..1) {
print(points[i]);
}
}
void print(struct Point p) {
SCREEN[idx++] = p.x;
SCREEN[idx++] = p.y;
}