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

Upgraded to OpenJDK 14, Junit 5, Surefire 3.0, JaCoCo 0.8.5.

This commit is contained in:
jespergravgaard 2020-08-24 21:00:16 +02:00
parent 0a5d2d7956
commit a9373ff3c9
27 changed files with 190 additions and 107 deletions

View File

@ -1,4 +1,4 @@
image: maven:3-jdk-8
image: maven:3-jdk-14
release:
stage: build

2
.idea/compiler.xml generated
View File

@ -24,7 +24,7 @@
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="kickc" target="1.8" />
<module name="kickc" target="14" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: junit:junit:4.12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apiguardian:apiguardian-api:1.1.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.6.2/junit-jupiter-api-5.6.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.6.2/junit-jupiter-api-5.6.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.6.2/junit-jupiter-api-5.6.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.6.2/junit-jupiter-engine-5.6.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.6.2/junit-jupiter-engine-5.6.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.6.2/junit-jupiter-engine-5.6.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.platform:junit-platform-commons:1.6.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.6.2/junit-platform-commons-1.6.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.6.2/junit-platform-commons-1.6.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.6.2/junit-platform-commons-1.6.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.junit.platform:junit-platform-engine:1.6.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.6.2/junit-platform-engine-1.6.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.6.2/junit-platform-engine-1.6.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.6.2/junit-platform-engine-1.6.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.opentest4j:opentest4j:1.2.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0-sources.jar!/" />
</SOURCES>
</library>
</component>

12
.idea/misc.xml generated
View File

@ -23,6 +23,16 @@
<option name="language" value="" />
<option name="generateVisitor" value="true" />
</PerGrammarGenerationSettings>
<PerGrammarGenerationSettings>
<option name="fileName" value="$PROJECT_DIR$/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4" />
<option name="autoGen" value="true" />
<option name="outputDir" value="$PROJECT_DIR$/src/test/java" />
<option name="libDir" value="" />
<option name="encoding" value="" />
<option name="pkg" value="" />
<option name="language" value="" />
<option name="generateVisitor" value="true" />
</PerGrammarGenerationSettings>
</list>
</option>
</component>
@ -33,7 +43,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="false" project-jdk-name="14" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_14">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
@ -16,8 +16,12 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: org.abego.treelayout:org.abego.treelayout.core:1.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.ibm.icu:icu4j:61.1" level="project" />
<orderEntry type="library" name="Maven: org.antlr:antlr4-runtime:4.8-1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.2" level="project" />
<orderEntry type="library" name="Maven: cml.kickass:kickassembler:5.16-65ce02.h" level="project" />
<orderEntry type="library" name="Maven: info.picocli:picocli:4.2.0" level="project" />
<orderEntry type="library" name="Maven: javax.json:javax.json-api:1.1.4" level="project" />

14
pom.xml
View File

@ -5,8 +5,8 @@
<modelVersion>4.0.0</modelVersion>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<argLine>-Xmx2048m</argLine>
</properties>
@ -36,9 +36,9 @@
<version>4.8-1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
@ -93,7 +93,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<version>3.0.0-M5</version>
<configuration>
<excludes>
<exclude>**/TestFragments.java</exclude>
@ -107,7 +107,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<version>0.8.5</version>
<executions>
<execution>
<id>pre-unit-test</id>

View File

@ -34,7 +34,7 @@ import java.util.stream.Collectors;
descriptionHeading = "%nDescription:%n%n",
parameterListHeading = "%nParameters:%n",
optionListHeading = "%nOptions:%n",
version = "KickC 0.8.2 BETA"
version = "KickC 0.8.3 BETA"
)
public class KickC implements Callable<Integer> {

View File

@ -3,12 +3,11 @@ package dk.camelot64.cpufamily6502;
import dk.camelot64.cpufamily6502.cpus.*;
import kickass._65xx._65xxArgType;
import kickass._65xx.cpus.*;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import java.util.*;
import static junit.framework.TestCase.*;
public class TestCpuFamilyKickAssCompatibility {
@ -45,9 +44,9 @@ public class TestCpuFamilyKickAssCompatibility {
// Test that each KickC opcode has a matching KickAss opcode
for(CpuOpcode kcOpcode : kcAllOpcodes) {
final int[] kaOpcodes = kaAllMnemonics.get(kcOpcode.getMnemonic());
assertNotNull("KickAss CPU " + kaCpu.name + " does not know the KickC CPU " + kcCpu.getName() + " mnemonic", kcOpcode.getMnemonic());
assertNotNull(kcOpcode.getMnemonic(), "KickAss CPU " + kaCpu.name + " does not know the KickC CPU " + kcCpu.getName() + " mnemonic");
final List<_65xxArgType> kaArgTypes = kaAddressingModeMap.get(kcOpcode.getAddressingMode());
assertNotNull("KickAss addressing mode not found " + kcOpcode.getAddressingMode().getName(), kaArgTypes);
assertNotNull(kaArgTypes, "KickAss addressing mode not found " + kcOpcode.getAddressingMode().getName());
// Try each argtype to find the one that works
boolean found = false;
for(_65xxArgType kaArgType : kaArgTypes) {
@ -57,14 +56,14 @@ public class TestCpuFamilyKickAssCompatibility {
if(kaOpcodeRaw >= 0) {
found = true;
int[] kaOpcode = getKAOpcode(kaOpcodeRaw, kaArgType, kcOpcode.getMnemonic());
Assert.assertArrayEquals("KickAss opcode not matching for mnemonic " + kcOpcode.toString(), kcOpcode.getOpcode(), kaOpcode);
assertArrayEquals(kcOpcode.getOpcode(), kaOpcode, "KickAss opcode not matching for mnemonic " + kcOpcode.toString());
int kaByteSize = kaOpcode.length + kaArgType.getByteSize();
assertEquals("KickAss opcode byte size not matching KickC byte size "+kcOpcode.toString(), kcOpcode.getBytes(), kaByteSize);
assertEquals(kcOpcode.getBytes(), kaByteSize, "KickAss opcode byte size not matching KickC byte size "+kcOpcode.toString());
}
}
}
assertTrue("KickAss opcode not found for mnemonic " + kcOpcode.toString(), found);
assertTrue(found, "KickAss opcode not found for mnemonic " + kcOpcode.toString());
}
// Test that each KickAss opcode has a matching KickC opcode

View File

@ -1,11 +1,13 @@
package dk.camelot64.kickc.parsing;
import dk.camelot64.kickc.parser.*;
import junit.framework.TestCase;
import org.junit.jupiter.api.Test;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CodePointCharStream;
import org.antlr.v4.runtime.tree.TerminalNode;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestExprParser {
@ -28,7 +30,7 @@ public class TestExprParser {
KickCParser.ExprContext exprContext = ExprParser.parseExpression(kickCLexer);
final KickCParserBaseVisitor<String> exprVisitor = new ExprPrinter();
final String exprOut = exprVisitor.visit(exprContext);
TestCase.assertEquals("Expression output does not match ", expected, exprOut);
assertEquals(expected, exprOut, "Expression output does not match ");
}
/** Prints the expression. */

View File

@ -6,11 +6,9 @@ import dk.camelot64.kickc.parser.KickCParser;
import dk.camelot64.kickc.parser.KickCParserBaseVisitor;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CodePointCharStream;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static junit.framework.TestCase.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
/**
* Test the C preprocessor
@ -204,10 +202,10 @@ public class TestPreprocessor {
} catch(CompileError e) {
System.out.println("Got error: " + e.getMessage());
// expecting error!
assertTrue("Error message expected '" + expectError + "' - was:" + e.getMessage(), e.getMessage().contains(expectError));
assertTrue(e.getMessage().contains(expectError), "Error message expected '" + expectError + "' - was:" + e.getMessage());
if(expectLineNumber) {
// expecting line number!
assertTrue("Error message expected line number - was:" + e.getMessage(), e.getMessage().contains("Line"));
assertTrue(e.getMessage().contains("Line"), "Error message expected line number - was:" + e.getMessage());
}
return;
}

View File

@ -2,13 +2,12 @@ package dk.camelot64.kickc.parsing.typedef;
import dk.camelot64.kickc.model.CompileError;
import org.antlr.v4.runtime.*;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestTypedefParser {

View File

@ -1,4 +1,4 @@
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.7
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.8
package dk.camelot64.kickc.parsing.typedef;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.7
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.8
package dk.camelot64.kickc.parsing.typedef;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.7
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.8
package dk.camelot64.kickc.parsing.typedef;
import java.util.ArrayList;
@ -15,7 +15,7 @@ import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class TypedefLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); }
static { RuntimeMetaData.checkVersion("4.8", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
@ -31,18 +31,27 @@ public class TypedefLexer extends Lexer {
"DEFAULT_MODE"
};
public static final String[] ruleNames = {
"T__0", "T__1", "T__2", "T__3", "T__4", "SIMPLETYPE", "IDENTIFIER", "TYPEIDENTIFIER",
"WHITESPACE"
};
private static String[] makeRuleNames() {
return new String[] {
"T__0", "T__1", "T__2", "T__3", "T__4", "SIMPLETYPE", "IDENTIFIER", "TYPEIDENTIFIER",
"WHITESPACE"
};
}
public static final String[] ruleNames = makeRuleNames();
private static final String[] _LITERAL_NAMES = {
null, "'typedef'", "';'", "'('", "')'", "'&'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, "SIMPLETYPE", "IDENTIFIER", "TYPEIDENTIFIER",
"WHITESPACE"
};
private static String[] makeLiteralNames() {
return new String[] {
null, "'typedef'", "';'", "'('", "')'", "'&'"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, null, null, null, null, null, "SIMPLETYPE", "IDENTIFIER", "TYPEIDENTIFIER",
"WHITESPACE"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**

View File

@ -1,4 +1,4 @@
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.7
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.8
package dk.camelot64.kickc.parsing.typedef;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.7
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.8
package dk.camelot64.kickc.parsing.typedef;
import java.util.ArrayList;
@ -15,7 +15,7 @@ import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class TypedefParser extends Parser {
static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); }
static { RuntimeMetaData.checkVersion("4.8", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
@ -25,17 +25,26 @@ public class TypedefParser extends Parser {
WHITESPACE=9;
public static final int
RULE_stmtSeq = 0, RULE_stmt = 1, RULE_expr = 2, RULE_typeName = 3;
public static final String[] ruleNames = {
"stmtSeq", "stmt", "expr", "typeName"
};
private static String[] makeRuleNames() {
return new String[] {
"stmtSeq", "stmt", "expr", "typeName"
};
}
public static final String[] ruleNames = makeRuleNames();
private static final String[] _LITERAL_NAMES = {
null, "'typedef'", "';'", "'('", "')'", "'&'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, "SIMPLETYPE", "IDENTIFIER", "TYPEIDENTIFIER",
"WHITESPACE"
};
private static String[] makeLiteralNames() {
return new String[] {
null, "'typedef'", "';'", "'('", "')'", "'&'"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, null, null, null, null, null, "SIMPLETYPE", "IDENTIFIER", "TYPEIDENTIFIER",
"WHITESPACE"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
@ -94,6 +103,7 @@ public class TypedefParser extends Parser {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class StmtSeqContext extends ParserRuleContext {
public List<StmtContext> stmt() {
return getRuleContexts(StmtContext.class);

View File

@ -1,4 +1,4 @@
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.7
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.8
package dk.camelot64.kickc.parsing.typedef;
import java.util.ArrayList;

View File

@ -6,28 +6,28 @@ import dk.camelot64.kickc.fragment.AsmFragmentTemplateSynthesizer;
import dk.camelot64.kickc.fragment.AsmFragmentTemplateUsages;
import dk.camelot64.kickc.model.TargetCpu;
import dk.camelot64.kickc.model.operators.Operators;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
import java.util.*;
import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
/** Test the ASM fragment sub-system by loading/synthesizing a lot of different fragments and comparing with reference fragments. */
public class TestFragments {
private static AsmFragmentTemplateSynthesizer asmFragmentTemplateSynthesizer;
@BeforeClass
@BeforeAll
public static void setUp() {
asmFragmentTemplateSynthesizer = new AsmFragmentTemplateSynthesizer(TargetCpu.MOS6502X, new File("src/main/fragment/").toPath(), false, new CompileLog());
}
@AfterClass
@AfterAll
public static void tearDown() {
CompileLog log = new CompileLog();
log.setSysOut(true);
@ -205,7 +205,7 @@ public class TestFragments {
}
log.append("");
}
assertTrue("Fragment cannot be synthesized " + signature, templates.size() > 0);
assertTrue(templates.size() > 0, "Fragment cannot be synthesized " + signature);
}

View File

@ -2,7 +2,7 @@ package dk.camelot64.kickc.test;
import kickass.KickAssembler65CE02;
import kickass.nonasm.c64.CharToPetsciiConverter;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.*;
import java.net.URI;

View File

@ -10,9 +10,9 @@ import dk.camelot64.kickc.model.TargetPlatform;
import dk.camelot64.kickc.parser.CTargetPlatformParser;
import kickass.KickAssembler65CE02;
import kickass.nonasm.c64.CharToPetsciiConverter;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.io.*;
import java.lang.management.GarbageCollectorMXBean;
@ -25,8 +25,8 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import static junit.framework.TestCase.fail;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
/**
* Compile a number of source files and compare the resulting assembler with expected output
@ -4554,11 +4554,11 @@ public class TestPrograms {
compileAndCompare("condition-type-mismatch.c");
}
@BeforeClass
@BeforeAll
public static void setUp() {
}
@AfterClass
@AfterAll
public static void tearDown() {
//AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false);
//printGCStats();
@ -4614,10 +4614,10 @@ public class TestPrograms {
} catch(CompileError e) {
System.out.println("Got error: " + e.getMessage());
// expecting error!
assertTrue("Error message expected '" + expectError + "' - was:" + e.getMessage(), e.getMessage().contains(expectError));
assertTrue(e.getMessage().contains(expectError), "Error message expected '" + expectError + "' - was:" + e.getMessage());
if(expectLineNumber) {
// expecting line number!
assertTrue("Error message expected line number - was:" + e.getMessage(), e.getMessage().contains("Line"));
assertTrue(e.getMessage().contains("Line"), "Error message expected line number - was:" + e.getMessage());
}
return;
}