Fixed value parsing from item definitions
This commit is contained in:
@@ -18,6 +18,8 @@ import rs09.game.system.config.ServerConfigParser
|
||||
import rs09.game.world.GameWorld
|
||||
import rs09.game.world.repository.Repository
|
||||
import rs09.game.world.update.UpdateSequence
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
import java.nio.ByteBuffer
|
||||
|
||||
object TestUtils {
|
||||
@@ -60,6 +62,10 @@ object TestUtils {
|
||||
}
|
||||
}
|
||||
|
||||
fun loadFile(path: String) : URI? {
|
||||
return this::class.java.getResource(path)?.toURI()
|
||||
}
|
||||
|
||||
fun advanceTicks(amount: Int, skipPulseUpdates: Boolean = true) {
|
||||
SystemLogger.logInfo(this::class.java, "Advancing ticks by $amount.")
|
||||
for(i in 0 until amount) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package core.cache
|
||||
|
||||
import TestUtils
|
||||
import api.itemDefinition
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.io.File
|
||||
|
||||
class ItemDefTests {
|
||||
val knownGood = HashMap<Int,Int>()
|
||||
init {
|
||||
TestUtils.preTestSetup()
|
||||
}
|
||||
|
||||
@Test fun itemDefsShouldHaveExpectedValues() {
|
||||
File(TestUtils.loadFile("530_cache_item_values_from_client.csv")).useLines { lines ->
|
||||
lines.forEach {
|
||||
val toks = it.split(",")
|
||||
knownGood[toks[0].toIntOrNull() ?: return@forEach] = toks[toks.size - 1].toInt()
|
||||
}
|
||||
}
|
||||
for ((id, expectedValue) in knownGood) {
|
||||
val def = itemDefinition(id)
|
||||
Assertions.assertEquals(expectedValue, def.value, "Value of ${def.name} (${def.isUnnoted}) does not match known good values!")
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user