mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-27 19:50:10 +00:00
Added test illustrating problem with bitwise not and literal number type inference. #199
This commit is contained in:
parent
5b71c50a90
commit
fc3b7bd5c0
@ -575,11 +575,12 @@ public class TestPrograms {
|
||||
compileAndCompare("unused-irq");
|
||||
}
|
||||
|
||||
/** TODO: Fix error with number resolving
|
||||
@Test
|
||||
public void testNumberTernaryFail() throws IOException, URISyntaxException {
|
||||
compileAndCompare("number-ternary-fail");
|
||||
}
|
||||
/**
|
||||
* TODO: Fix error with number resolving
|
||||
*
|
||||
* @Test public void testNumberTernaryFail() throws IOException, URISyntaxException {
|
||||
* compileAndCompare("number-ternary-fail");
|
||||
* }
|
||||
*/
|
||||
|
||||
@Test
|
||||
@ -1457,7 +1458,7 @@ public class TestPrograms {
|
||||
|
||||
@Test
|
||||
public void testPointerPointer1() throws IOException, URISyntaxException {
|
||||
compileAndCompare("pointer-pointer-1" );
|
||||
compileAndCompare("pointer-pointer-1");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -1704,7 +1705,6 @@ public class TestPrograms {
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testInlineKasmRefout() throws IOException, URISyntaxException {
|
||||
compileAndCompare("inline-kasm-refout");
|
||||
@ -1975,6 +1975,14 @@ public class TestPrograms {
|
||||
compileAndCompare("min-fmul-16");
|
||||
}
|
||||
|
||||
// Fix literal number type conversion (also over the bitwise NOT operator). https://gitlab.com/camelot/kickc/issues/199
|
||||
/*
|
||||
@Test
|
||||
public void testBitwiseNot1() throws IOException, URISyntaxException {
|
||||
compileAndCompare("bitwise-not-1");
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testBitwiseNot() throws IOException, URISyntaxException {
|
||||
compileAndCompare("bitwise-not");
|
||||
@ -2082,7 +2090,7 @@ public class TestPrograms {
|
||||
|
||||
@Test
|
||||
public void testMultiplexer() throws IOException, URISyntaxException {
|
||||
compileAndCompare("examples/multiplexer/simple-multiplexer",10);
|
||||
compileAndCompare("examples/multiplexer/simple-multiplexer", 10);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -3092,7 +3100,7 @@ public class TestPrograms {
|
||||
private void testFile(String fileName, Integer upliftCombinations, CompileLog compileLog) throws IOException, URISyntaxException {
|
||||
System.out.println("Testing output for " + fileName);
|
||||
Compiler compiler = new Compiler();
|
||||
if(compileLog!=null) {
|
||||
if(compileLog != null) {
|
||||
compiler.setLog(compileLog);
|
||||
}
|
||||
compiler.addImportPath(stdlibPath);
|
||||
@ -3106,7 +3114,7 @@ public class TestPrograms {
|
||||
|
||||
boolean success = true;
|
||||
ReferenceHelper helper = new ReferenceHelperFolder(refPath);
|
||||
success &= helper.testOutput(fileName, ".asm", program.getAsm().toString(new AsmProgram.AsmPrintState(false, false, false, false),program ));
|
||||
success &= helper.testOutput(fileName, ".asm", program.getAsm().toString(new AsmProgram.AsmPrintState(false, false, false, false), program));
|
||||
success &= helper.testOutput(fileName, ".sym", program.getScope().toString(program, null));
|
||||
success &= helper.testOutput(fileName, ".cfg", program.getGraph().toString(program));
|
||||
success &= helper.testOutput(fileName, ".log", program.getLog().toString());
|
||||
@ -3118,7 +3126,7 @@ public class TestPrograms {
|
||||
}
|
||||
|
||||
private void compileAsm(String fileName, Program program) throws IOException {
|
||||
writeBinFile(fileName, ".asm", program.getAsm().toString(new AsmProgram.AsmPrintState(false), program ));
|
||||
writeBinFile(fileName, ".asm", program.getAsm().toString(new AsmProgram.AsmPrintState(false), program));
|
||||
for(Path asmResourceFile : program.getAsmResourceFiles()) {
|
||||
File asmFile = getBinFile(fileName, ".asm");
|
||||
String asmFolder = asmFile.getParent();
|
||||
|
7
src/test/kc/bitwise-not-1.kc
Normal file
7
src/test/kc/bitwise-not-1.kc
Normal file
@ -0,0 +1,7 @@
|
||||
// Test that bitwise NOT (~) is handled correctly
|
||||
|
||||
void main() {
|
||||
const char* screen = 0x0400;
|
||||
char b = ~0x10;
|
||||
*screen = b;
|
||||
}
|
Loading…
Reference in New Issue
Block a user