本文整理汇总了Java中vk.core.api.JavaStringCompiler.compileAndRunTests方法的典型用法代码示例。如果您正苦于以下问题:Java JavaStringCompiler.compileAndRunTests方法的具体用法?Java JavaStringCompiler.compileAndRunTests怎么用?Java JavaStringCompiler.compileAndRunTests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vk.core.api.JavaStringCompiler
的用法示例。
在下文中一共展示了JavaStringCompiler.compileAndRunTests方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: acceptanceCheck
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
public String acceptanceCheck() {
acceptance = false;
CompilationUnit classToTest = new CompilationUnit(myClass, myCode, false);
CompilationUnit aTest = new CompilationUnit(acceptanceTestName, acceptanceTest, true);
JavaStringCompiler myCompileObject = CompilerFactory.getCompiler(classToTest, aTest);
myCompileObject.compileAndRunTests();
CompilerResult cpResult = myCompileObject.getCompilerResult();
String result = "";
if(cpResult.hasCompileErrors()) {
result = handleErrors(cpResult, aTest);
}
else if(testCode.contains("@Test")) {
result = handleAcceptanceTests(myCompileObject);
if(testSuccess && acceptance) acceptance = true;
else acceptance = false;
}
else result = "Please add a proper Acceptance Test!";
return result;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-stack-overflow,代码行数:23,代码来源:CompileHandler.java
示例2: compileCode
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
* Compiles the passed code and sets info to compile errors if there are any.
* @param code The code that is going to be compiled
* @param className The classname of the code
* @return True if the code is compilable. Otherwise false.
*/
public boolean compileCode(String code, String className) {
//String className = findClassName(code).trim();
CompilationUnit cu = new CompilationUnit(className, code, false);
JavaStringCompiler jsc = CompilerFactory.getCompiler(cu);
jsc.compileAndRunTests();
CompilerResult cr = jsc.getCompilerResult();
if (cr.hasCompileErrors()) {
info = formatCompileErrors(cr, cu);
return false;
}
return true;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nimmdochirgendeinennamen,代码行数:22,代码来源:TDDTCompiler.java
示例3: compileAndRunTests
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
* Compiles and runs the passed test and sets info to any error that may have occured.
* @param code Code of code to be compiled
* @param codeClassName Classname of the code
* @param test Code of tests to be compiled
* @param testClassName Classname of the test
* @return True if the test is compile- and runnable. Otherwise false.
*/
public boolean compileAndRunTests(String code, String codeClassName, String test, String testClassName) {
CompilationUnit cuCode = new CompilationUnit(codeClassName, code, false);
CompilationUnit cuTest = new CompilationUnit(testClassName, test, true);
JavaStringCompiler jsc = CompilerFactory.getCompiler(cuCode, cuTest);
jsc.compileAndRunTests();
CompilerResult cr = jsc.getCompilerResult();
if (cr.hasCompileErrors()) {
info = formatCompileErrors(cr, cuCode);
info += formatCompileErrors(cr, cuTest);
return false;
}
TestResult tr = jsc.getTestResult();
if (tr.getNumberOfFailedTests() != 0) {
info = formatFailingTests(tr);
return false;
}
return true;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nimmdochirgendeinennamen,代码行数:31,代码来源:TDDTCompiler.java
示例4: CompilerRun
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
public JavaStringCompiler CompilerRun(String className, String classContent, boolean isTest) {
CompilationUnit unit = new CompilationUnit(className, classContent, isTest);
JavaStringCompiler compiler = CompilerFactory.getCompiler(unit);
compiler.compileAndRunTests();
CompilerResult compilerResult = compiler.getCompilerResult();
Collection<CompileError> errs = compilerResult.getCompilerErrorsForCompilationUnit(unit);
for (CompileError e : errs) {
System.out.println(e.getMessage());
System.out.println(e.getCodeLineContainingTheError());
}
System.out.println("End of errors");
return compiler;
}
示例5: checkCompile
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
* pr�ft ob {@link testClass} und {@link sourceClass} compilierbar sind
* @return true / false
*/
public static boolean checkCompile() { // check ob es compiled // es muss eine loesung er damit es nicht 3fach gemacht wird
JavaStringCompiler compiler = CompilerFactory.getCompiler(testClass,sourceClass);
compiler.compileAndRunTests();
return compiler.getCompilerResult().getCompilerErrorsForCompilationUnit(sourceClass).isEmpty()
&& compiler.getCompilerResult().getCompilerErrorsForCompilationUnit(testClass).isEmpty();
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-immortalsgg,代码行数:12,代码来源:TDDCompiler.java
示例6: checkTests1Failed
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
* pr�ft ob {@link testClass} nur einen fehlschlagenden test beinhaltet
* @return true / false
*/
public static boolean checkTests1Failed() { // checkt ob nur 1 test failt
JavaStringCompiler compiler = CompilerFactory.getCompiler(testClass,sourceClass);
compiler.compileAndRunTests();
return compiler.getTestResult().getNumberOfFailedTests() == 1;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-immortalsgg,代码行数:11,代码来源:TDDCompiler.java
示例7: checkTestsAllSuccess
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
* pr�ft ob {@link testClass} alle tests bestanden werden
* @return true / false
*/
public static boolean checkTestsAllSuccess() { // checkt ob alle tests failen
JavaStringCompiler compiler = CompilerFactory.getCompiler(testClass,sourceClass);
compiler.compileAndRunTests();
return compiler.getTestResult().getNumberOfFailedTests() == 0;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-immortalsgg,代码行数:11,代码来源:TDDCompiler.java
示例8: getCompileErrors
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
* sammelt compiler errors in einem String
* gibt entweder f�r die {@link sourceClass} oder f�r die {@link testClass} die compiler errors zur�ck
* @param klasse 1 oder 2 entscheidet ob man die errors von der testclass oder von der sourceclass haben m�chte
* @return Compile Errors as String of sourceclass or testclass
*/
public static String getCompileErrors(int klasse) {
JavaStringCompiler compiler = CompilerFactory.getCompiler(testClass,sourceClass);
compiler.compileAndRunTests();
if(klasse == 1) return compiler.getCompilerResult().getCompilerErrorsForCompilationUnit(testClass).toString();
if(klasse == 2) return compiler.getCompilerResult().getCompilerErrorsForCompilationUnit(sourceClass).toString();
else return "";
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-immortalsgg,代码行数:15,代码来源:TDDCompiler.java
示例9: getTestFails
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
* sammelt alle fehlschlagende tests in einem String
* @return einen String welcher alle fehlschlagende testresultate beeinhaltet
*/
public static String getTestFails() { // gibt alle falschen tests an
JavaStringCompiler compiler = CompilerFactory.getCompiler(testClass,sourceClass);
compiler.compileAndRunTests();
compiler.getTestResult().getTestFailures().stream().forEach(e -> { fails = fails + e.getMessage() +"\n";});
return fails;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-immortalsgg,代码行数:12,代码来源:TDDCompiler.java
示例10: testSomething
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
@Test
public void testSomething() {
CompilationUnit sourceClass = new CompilationUnit("Bar" ,"public class Bar { \n"
+ " public static int fourtyTwo() { \n"
+ " return 41 + 1; \n"
+ " }\n"
+ "}" ,false);
CompilationUnit otherClass = new CompilationUnit("Foo","public class Foo {}",true);
JavaStringCompiler compiler = CompilerFactory.getCompiler(sourceClass);
compiler.compileAndRunTests();
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-immortalsgg,代码行数:12,代码来源:DefaultTest.java
示例11: executeCompiler
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
public String[] executeCompiler() {
//führt den Compiler aus. Unterscheidet zwischen Testklasse und Hauptklasse
testSuccess = false;
CompilationUnit classToTest = new CompilationUnit(myClass, myCode, false);
CompilationUnit theTest = new CompilationUnit(testClass, testCode, true);
JavaStringCompiler myCompileObject = CompilerFactory.getCompiler(classToTest, theTest);
myCompileObject.compileAndRunTests();
CompilerResult cpResult = myCompileObject.getCompilerResult();
String[] results = {"", "", "", ""};
if(cpResult.hasCompileErrors()) {
results[0] = handleErrors(cpResult, classToTest);
results[1] = handleErrors(cpResult, theTest);
}
else if(testCode.contains("@Test")) {
results[2] = handleTests(myCompileObject);
}
else results[2] = "Please add a proper Test!";
String acceptanceResults = "";
if(acceptanceTest != null) acceptanceResults = acceptanceCheck();
results[3] = acceptanceResults;
return results;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-stack-overflow,代码行数:29,代码来源:CompileHandler.java
示例12: getJSC
import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
* Erzeugt einen JavaStringcompiler
* aus einem Compilationunitarray und führt compileAndRunTests() aus (notwendig um Test/CompileResults zu nutzen)
*/
private static JavaStringCompiler getJSC(CompilationUnit[] comp_uns){ //erzeugt JSC und ruftcompileAndRunTests() auf
JavaStringCompiler comp = new InternalCompiler(comp_uns);
comp.compileAndRunTests();
return comp;
}