save physics test result to file

This commit is contained in:
Bixilon 2022-11-12 21:07:05 +01:00
parent c6b328675d
commit bc097213c0
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package de.bixilon.pixlyzer.physics
import de.bixilon.pixlyzer.PixLyzer
import de.bixilon.pixlyzer.physics.tests.AbstractTest
import de.bixilon.pixlyzer.physics.tests.EmptyTest
import de.bixilon.pixlyzer.physics.tests.GravityTest
@ -31,6 +32,7 @@ object PhysicsExtractor {
@JvmStatic
fun start() {
val data: MutableMap<String, Any> = mutableMapOf()
for (tests in tests) {
val instance = tests.getConstructor().newInstance()
@ -39,13 +41,17 @@ object PhysicsExtractor {
if (!method.isAnnotationPresent(PhysicsTest::class.java)) {
continue
}
val id = method.getAnnotation(PhysicsTest::class.java).id
try {
run(method, instance)
data.put(id, instance.result)?.let { throw IllegalStateException("Duplicated test: $id") }
} catch (error: Throwable) {
error.printStackTrace()
}
}
}
PixLyzer.writData("${PixLyzer.outputDirectory.absolutePath}/physics/physics", data)
exitProcess(0)
}
}

View File

@ -46,7 +46,7 @@ class GravityTest : AbstractTest() {
storeBasic()
}
@PhysicsTest("forwards_falling_2")
@PhysicsTest("forwards_falling_3")
fun forwardFalling3() {
player.teleport(45.00, 178.0, 13.00)
player.setKeys(forwards = true)
@ -78,7 +78,7 @@ class GravityTest : AbstractTest() {
storeBasic()
}
@PhysicsTest("backwards_falling_2")
@PhysicsTest("backwards_falling_3")
fun backwardsFalling3() {
player.teleport(45.00, 178.0, 13.00)
player.setKeys(backwards = true)