Add option for testing

This commit is contained in:
austin 2022-06-08 16:24:15 -04:00
parent 597c60b035
commit 69b8f86647
4 changed files with 61 additions and 0 deletions

8
.vscode/launch.json vendored
View File

@ -17,6 +17,14 @@
"mainClass": "electrosphere.main.Main",
"projectName": "Renderer"
},
{
"type": "java",
"name": "Launch Main (macos)",
"request": "launch",
"mainClass": "electrosphere.main.Main",
"projectName": "Renderer",
"vmArgs": "-XstartOnFirstThread"
},
{
"type": "java",
"name": "Launch Main (Headless)",

View File

@ -152,6 +152,12 @@
<version>3.36.0.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
@ -175,6 +181,7 @@
</os>
</activation>
<properties>
<!-- <maven.compiler.target>17</maven.compiler.target> -->
<lwjgl.natives>natives-macos</lwjgl.natives>
</properties>
</profile>

View File

@ -0,0 +1,33 @@
import electrosphere.controls.ControlHandler;
import electrosphere.game.config.UserSettings;
import electrosphere.logger.LoggerInterface;
import electrosphere.main.Globals;
import junit.framework.TestCase;
public class LoadingTest extends TestCase {
// @BeforeClass
public void testABC(){
//initialize logging interfaces
LoggerInterface.initLoggers();
//load user settings
UserSettings.loadUserSettings();
//controls
if(Globals.RUN_CLIENT){
initControlHandler();
}
//init global variables
Globals.initGlobals();
}
public static void initControlHandler(){
LoggerInterface.loggerStartup.INFO("Initialize control handler");
Globals.controlHandler = ControlHandler.generateExampleControlsMap();
Globals.controlHandler.setCallbacks();
// Globals.controlHandler = FileLoadingUtils.loadModelObjectFromBakedJsonFile("/Config/keybinds.json",ControlHandler.class);
}
}

View File

@ -0,0 +1,13 @@
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
public class TestRunner {
public static void main(String[] args){
Result result = JUnitCore.runClasses(LoadingTest.class);
for(Failure failure : result.getFailures()){
System.out.println(failure);
}
System.out.println("Testing was successful: " + result.wasSuccessful());
}
}