1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-27 04:49:27 +00:00

Added tests for developing struct address-of

This commit is contained in:
Jesper Gravgaard 2019-06-11 21:52:21 +02:00
parent 253babb8ea
commit b014e0f732
3 changed files with 33 additions and 0 deletions

View File

@ -39,6 +39,17 @@ public class TestPrograms {
public void testTextbox() throws IOException, URISyntaxException {
compileAndCompare("textbox");
}
/*
@Test
public void testStructPtr12Ref() throws IOException, URISyntaxException {
compileAndCompare("struct-ptr-12-ref", log());
}
@Test
public void testStructPtr12() throws IOException, URISyntaxException {
compileAndCompare("struct-ptr-12");
}
*/
@Test
public void testStructPtr11() throws IOException, URISyntaxException {

View File

@ -0,0 +1,9 @@
// Reference file for Minimal struct - using address-of
void main() {
word p = { 2, 3 };
word *q = &p;
const byte* SCREEN = 0x0400;
SCREEN[0] = <*q;
SCREEN[1] = >*q;
}

View File

@ -0,0 +1,13 @@
// Minimal struct - using address-of
struct Point {
byte x;
byte y;
};
void main() {
struct Point p = { 2, 3 };
struct Point *q = &p;
const byte* SCREEN = 0x0400;
SCREEN[0] = q->x;
SCREEN[1] = q->y;
}