mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-26 12:49:21 +00:00
Added test demonstrating problem with NULL parameter. #706
This commit is contained in:
parent
39f79b668b
commit
93d19035ca
@ -99,6 +99,11 @@ public class TestProgramsFast extends TestPrograms {
|
||||
compileAndCompare("null-constant.c");
|
||||
}
|
||||
|
||||
//@Test
|
||||
//public void testNullConstant1() throws IOException {
|
||||
// compileAndCompare("null-constant-1.c");
|
||||
//}
|
||||
|
||||
@Test
|
||||
public void testBlockError2() throws IOException {
|
||||
compileAndCompare("block-error-2.c");
|
||||
|
17
src/test/kc/null-constant-1.c
Normal file
17
src/test/kc/null-constant-1.c
Normal file
@ -0,0 +1,17 @@
|
||||
// Test the NULL pointer
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void main() {
|
||||
char* SCREEN = (char*)0x0400;
|
||||
|
||||
SCREEN[1] = get(SCREEN);
|
||||
SCREEN[0] = get(NULL);
|
||||
|
||||
}
|
||||
|
||||
char get(char* ptr) {
|
||||
if(NULL==ptr)
|
||||
return 0;
|
||||
return *ptr;
|
||||
}
|
Loading…
Reference in New Issue
Block a user