1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-07 23:07:29 +00:00

add test case

This commit is contained in:
Travis Fisher 2020-12-05 21:23:38 -05:00
parent 4aec255c95
commit 33764d4466
2 changed files with 27 additions and 2 deletions

View File

@ -4855,6 +4855,11 @@ public class TestPrograms {
compileAndCompare("condition-type-mismatch.c"); compileAndCompare("condition-type-mismatch.c");
} }
@Test
public void testIssue594() throws IOException, URISyntaxException {
compileAndCompare("issue-594-case.c");
}
@BeforeAll @BeforeAll
public static void setUp() { public static void setUp() {
TmpDirManager.init(new File("").toPath()); TmpDirManager.init(new File("").toPath());
@ -4993,8 +4998,8 @@ public class TestPrograms {
success &= helper.testOutput(baseFileName, ".cfg", program.getGraph().toString(program)); success &= helper.testOutput(baseFileName, ".cfg", program.getGraph().toString(program));
success &= helper.testOutput(baseFileName, ".log", program.getLog().toString()); success &= helper.testOutput(baseFileName, ".log", program.getLog().toString());
if(!success) { if(!success) {
//System.out.println("\nCOMPILE LOG"); System.out.println("\nCOMPILE LOG");
//System.out.println(program.getLog().toString()); System.out.println(program.getLog().toString());
fail("Output does not match reference!"); fail("Output does not match reference!");
} }
// Save the ASM fragment caches (if there are any changes) // Save the ASM fragment caches (if there are any changes)

View File

@ -0,0 +1,20 @@
enum _substate_hosts {
HOSTS,
DEVICES,
DONE
};
typedef enum _substate_hosts SubState;
#define ORIGIN_HOST_SLOTS 2
#define ORIGIN_DEVICE_SLOTS 13
const char * OUT = 0x8000;
void main() {
SubState substate = HOSTS;
SubState *ss = &substate;
char x = (*ss == DEVICES ? ORIGIN_DEVICE_SLOTS : ORIGIN_HOST_SLOTS);
*OUT = x;
}