• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java JavaStringCompiler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中vk.core.api.JavaStringCompiler的典型用法代码示例。如果您正苦于以下问题:Java JavaStringCompiler类的具体用法?Java JavaStringCompiler怎么用?Java JavaStringCompiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JavaStringCompiler类属于vk.core.api包,在下文中一共展示了JavaStringCompiler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setTestResults

import vk.core.api.JavaStringCompiler; //导入依赖的package包/类
/**
 * Method: setTestResults
 * <p>
 * Task: Method that saves the errors/information from the internal compiler
 * into an ArrayList.
 *
 * @param compiler
 *            so that method can access the information
 *
 * @return void
 */

protected void setTestResults(JavaStringCompiler compiler) {
    CompilerResult compilerResult = compiler.getCompilerResult();
    testResults = new LinkedList<>();
    if (!compilerResult.hasCompileErrors()) {
        int failedTestsNumber = compiler.getTestResult().getNumberOfFailedTests();
        failedTests = Integer.toString(failedTestsNumber);
        int ignoredTestsNumber = compiler.getTestResult().getNumberOfIgnoredTests();
        ignoredTests = Integer.toString(ignoredTestsNumber);
        int successfulTestsNumber = compiler.getTestResult().getNumberOfSuccessfulTests();
        successfulTests = Integer.toString(successfulTestsNumber);

        testResults.add(successfulTests);
        testResults.add(ignoredTests);
        testResults.add(failedTests);

    } else {
        testResults.add("");
        testResults.add("");
        testResults.add("");
    }
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-zenamike,代码行数:34,代码来源:CompileResults.java


示例2: handleTests

import vk.core.api.JavaStringCompiler; //导入依赖的package包/类
private String handleTests(JavaStringCompiler myCompileObject) {
	String testResults = "";
	TestResult happyEndChecker = myCompileObject.getTestResult();
	if(happyEndChecker.getNumberOfFailedTests() == 0) {
		testResults += "All tests succeeded!\n";
		testSuccess = true;
	}
	else {
		testSuccess = false;
		testResults += "Successful Tests: " + happyEndChecker.getNumberOfSuccessfulTests() + "\n";
		testResults += "Failed Tests: " + happyEndChecker.getNumberOfFailedTests() + "\n\n";
		Collection<TestFailure> fails = happyEndChecker.getTestFailures();
		Iterator<TestFailure> fail = fails.iterator();
		while(fail.hasNext()) {
			TestFailure found = fail.next();
			testResults += "Class: " + found.getTestClassName() + "\n" 
			+ "Method: " + found.getMethodName() + "\n" 
			+ "Message: " + found.getMessage();
		}		
	}
	return testResults;
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-stack-overflow,代码行数:23,代码来源:CompileHandler.java


示例3: handleAcceptanceTests

import vk.core.api.JavaStringCompiler; //导入依赖的package包/类
private String handleAcceptanceTests(JavaStringCompiler myCompileObject) {
	String testResults = "";
	TestResult happyEndChecker = myCompileObject.getTestResult();
	
	if(happyEndChecker.getNumberOfFailedTests() == 0) {
		testResults += "All tests succeeded!";
		acceptance = true;
	}
	else {
		acceptance = false;
		testResults += "Acceptance Test Failed\n";
		testResults += "Successful Tests: " + happyEndChecker.getNumberOfSuccessfulTests() + "\n";
		testResults += "Failed Tests: " + happyEndChecker.getNumberOfFailedTests() + "\n\n";
		Collection<TestFailure> fails = happyEndChecker.getTestFailures();
		Iterator<TestFailure> fail = fails.iterator();
		while(fail.hasNext()) {
			TestFailure found = fail.next();
			testResults += "Class: " + found.getTestClassName() + "\n" 
			+ "Method: " + found.getMethodName() + "\n" 
			+ "Message: " + found.getMessage();
		}		
	}
	return testResults;
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-stack-overflow,代码行数:25,代码来源:CompileHandler.java


示例4: 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


示例5: test

import vk.core.api.JavaStringCompiler; //导入依赖的package包/类
/**
 * Gibt Testergebnisse auf die (programminterne) Konsole aus.
 * 
 * Wandelt übergebene Compilationunits mit {@link #getJSC(CompilationUnit[])} in JavaStringCompiler um,
 * bestimmt Anzahl der erfolgreichen und fehlgeschlagenen Tests und gibt dies, sowie genauere Fehlermendungen
 * auf der programminternen Konsole aus.
 */
public static void test(CompilationUnit[] comp_uns){ //gibt testergebnisse auf console aus
	JavaStringCompiler comp = getJSC(comp_uns);
	TestResult test_res = comp.getTestResult();
	int tests_ok = test_res.getNumberOfSuccessfulTests();
	int tests_fail = test_res.getNumberOfFailedTests();
	console.set_textln("Testresult:");
	Collection<TestFailure> fails = test_res.getTestFailures();
	console.set_textln("OK: "+tests_ok+" FAIL: "+tests_fail);
	for(TestFailure fail: fails){
		console.set_textln("Testname: "+fail.getTestClassName());
		console.set_textln("Methodname: "+fail.getMethodName());
		console.set_textln(fail.getMessage());
		console.set_textln("");
	}
	console.set_textln("");

}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:25,代码来源:Testing.java


示例6: 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


示例7: 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


示例8: 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;
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-two-finger-joe,代码行数:14,代码来源:Logic.java


示例9: TestFehlschlag

import vk.core.api.JavaStringCompiler; //导入依赖的package包/类
public boolean TestFehlschlag(String className, String classContent) {

		if(CompileErrors(className, classContent) == false){
		JavaStringCompiler compiler = CompilerRun(className, classContent, true);

		int result = compiler.getTestResult().getNumberOfFailedTests();
		System.out.println("Failed tests " + result);
		if (result != 0) {
			return true;
		}
		return false;

		} return false;

	}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-two-finger-joe,代码行数:16,代码来源:Logic.java


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: 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


示例15: 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


示例16: 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


示例17: compile

import vk.core.api.JavaStringCompiler; //导入依赖的package包/类
/**
 * Gibt Compilierfehler (wenn vorhanden) auf die (programminterne) Konsole aus
 * 
 * Wandelt übergebene Compilationunits mit {@link #getJSC(CompilationUnit[])} in JavaStringCompiler um,
 * und gibt Compilierfehler mit {@link #print_errors_to_console(Collection)} auf der programminternen Konsole aus.

 */
public static void compile(CompilationUnit[] comp_uns){ //gibt fehlermeldungen, wenn vorhanden auf die console aus
	JavaStringCompiler comp = getJSC(comp_uns);
	CompilerResult comp_res = comp.getCompilerResult();
	if(comp_res.hasCompileErrors()){
		for(CompilationUnit cu: comp_uns){
			Collection<CompileError> errors = comp_res.getCompilerErrorsForCompilationUnit(cu);
			print_errors_to_console(errors);
		}
	} else console.set_textln("No Compilation errors");
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:18,代码来源:Testing.java


示例18: hasCompileErrors

import vk.core.api.JavaStringCompiler; //导入依赖的package包/类
/**
 * Prüft ob Compilierfehler vorliegen.
 */
public static boolean hasCompileErrors(CompilationUnit[] comp_uns){ //fuer next-button
	JavaStringCompiler comp = getJSC(comp_uns);
	CompilerResult comp_res = comp.getCompilerResult();
	compile(comp_uns);
	return comp_res.hasCompileErrors();
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:10,代码来源:Testing.java


示例19: tests_passed

import vk.core.api.JavaStringCompiler; //导入依赖的package包/类
/**
 * Prüft ob alle Tests bestanden werden.
 * 
 * Prüft ob die Compilationunits fehlerlos compilieren und prüft anschließend ob alle enthaltenen Tests erfolgreich sind.
 */
public static boolean tests_passed(CompilationUnit[] comp_uns){ //fuer next-button
	if(!hasCompileErrors(comp_uns)){
		JavaStringCompiler comp = getJSC(comp_uns);
		TestResult test_res = comp.getTestResult();
		test(comp_uns);
		return(test_res.getNumberOfFailedTests() == 0);
	} else return false;
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:14,代码来源:Testing.java


示例20: GreenValidator

import vk.core.api.JavaStringCompiler; //导入依赖的package包/类
public GreenValidator(JavaStringCompiler compiler) {
    this.compiler = compiler;
    this.Tests=compiler.getTestResult();
    checkifReady();
    if (Compiled) {
        BadTest();
    }
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-halt-doch-einfach-mal-dein-maul,代码行数:9,代码来源:GreenValidator.java



注:本文中的vk.core.api.JavaStringCompiler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GibbsSampler类代码示例发布时间:2022-05-22
下一篇:
Java Fragment类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap