mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-17 10:30:43 +00:00
Added another test for literal number type detection in ternaries. #199
This commit is contained in:
parent
22139da54e
commit
08da28e976
@ -715,6 +715,9 @@ public class TestPrograms {
|
||||
/**
|
||||
* TODO: Fix error with number resolving
|
||||
*
|
||||
* @Test public void testNumberTernaryFail2() throws IOException, URISyntaxException {
|
||||
* compileAndCompare("number-ternary-fail-2");
|
||||
* }
|
||||
* @Test public void testNumberTernaryFail() throws IOException, URISyntaxException {
|
||||
* compileAndCompare("number-ternary-fail");
|
||||
* }
|
||||
|
36
src/test/kc/number-ternary-fail-2.kc
Normal file
36
src/test/kc/number-ternary-fail-2.kc
Normal file
@ -0,0 +1,36 @@
|
||||
// Failing number type resolving in ternary operator
|
||||
// Currently fails in the ternary operator with number-issues if integer literal is not specified!
|
||||
|
||||
import "stdlib"
|
||||
|
||||
void SolveMaze(char *maze, word width, word height) {
|
||||
|
||||
word count=0;
|
||||
word x=3, y=2;
|
||||
word forward=0;
|
||||
|
||||
while(x != (width - 2) || y != (height - 2)) {
|
||||
|
||||
maze[y * width + x] = forward ? 2 : 3;
|
||||
if ( 1 == 1 ) {
|
||||
forward = 1; // <- HERE
|
||||
} else {
|
||||
forward = 0;
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
word width=18 * 2 + 3;
|
||||
word height=6 * 2 + 3;
|
||||
char *maze;
|
||||
maze = malloc(width * height);
|
||||
|
||||
SolveMaze(maze, width, height);
|
||||
|
||||
free(maze);
|
||||
asm {loop: jmp loop }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user