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:
parent
253babb8ea
commit
b014e0f732
@ -39,6 +39,17 @@ public class TestPrograms {
|
|||||||
public void testTextbox() throws IOException, URISyntaxException {
|
public void testTextbox() throws IOException, URISyntaxException {
|
||||||
compileAndCompare("textbox");
|
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
|
@Test
|
||||||
public void testStructPtr11() throws IOException, URISyntaxException {
|
public void testStructPtr11() throws IOException, URISyntaxException {
|
||||||
|
9
src/test/kc/struct-ptr-12-ref.kc
Normal file
9
src/test/kc/struct-ptr-12-ref.kc
Normal 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;
|
||||||
|
}
|
13
src/test/kc/struct-ptr-12.kc
Normal file
13
src/test/kc/struct-ptr-12.kc
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user