Fixed broken test, faster local tests

This commit is contained in:
Yair Morgenstern
2023-01-17 21:49:12 +02:00
parent be161d8839
commit 0ada7c476e
12 changed files with 13 additions and 14 deletions

View File

@ -404,8 +404,6 @@ class Ruleset {
}) })
} }
} }
debug("Loading ruleset - %sms", System.currentTimeMillis() - gameBasicsStartTime)
} }
/** Building costs are unique in that they are dependant on info in the technology part. /** Building costs are unique in that they are dependant on info in the technology part.

View File

@ -49,7 +49,7 @@ class CapitalConnectionsFinderTests {
@Before @Before
fun setup() { fun setup() {
RulesetCache.loadRulesets() RulesetCache.loadRulesets(noMods = true)
rules = RulesetCache.getVanillaRuleset() rules = RulesetCache.getVanillaRuleset()
// Setup the GameInfo mock // Setup the GameInfo mock
every { mockGameInfo.getCivilization(capture(slot)) } answers { civilizations.getValue(slot.captured) } every { mockGameInfo.getCivilization(capture(slot)) } answers { civilizations.getValue(slot.captured) }

View File

@ -24,7 +24,7 @@ class FreshWaterTests {
@Before @Before
fun initTheWorld() { fun initTheWorld() {
RulesetCache.loadRulesets() RulesetCache.loadRulesets(noMods = true)
ruleSet = RulesetCache.getVanillaRuleset() ruleSet = RulesetCache.getVanillaRuleset()
map = MapSaver.mapFromSavedString(testingMap) map = MapSaver.mapFromSavedString(testingMap)
map.setTransients(ruleSet, false) map.setTransients(ruleSet, false)

View File

@ -33,7 +33,7 @@ class TileImprovementConstructionTests {
@Before @Before
fun initTheWorld() { fun initTheWorld() {
RulesetCache.loadRulesets() RulesetCache.loadRulesets(noMods = true)
ruleSet = RulesetCache.getVanillaRuleset() ruleSet = RulesetCache.getVanillaRuleset()
civInfo.tech.researchedTechnologies.addAll(ruleSet.technologies.values) civInfo.tech.researchedTechnologies.addAll(ruleSet.technologies.values)
civInfo.tech.techsResearched.addAll(ruleSet.technologies.keys) civInfo.tech.techsResearched.addAll(ruleSet.technologies.keys)

View File

@ -21,7 +21,7 @@ class TileMapTests {
@Before @Before
fun initTheWorld() { fun initTheWorld() {
RulesetCache.loadRulesets() RulesetCache.loadRulesets(noMods = true)
ruleSet = RulesetCache.getVanillaRuleset() ruleSet = RulesetCache.getVanillaRuleset()
map = TileMap() map = TileMap()

View File

@ -25,7 +25,7 @@ class UnitMovementAlgorithmsTests {
@Before @Before
fun initTheWorld() { fun initTheWorld() {
RulesetCache.loadRulesets() RulesetCache.loadRulesets(noMods = true)
ruleSet = RulesetCache.getVanillaRuleset() ruleSet = RulesetCache.getVanillaRuleset()
tile.ruleset = ruleSet tile.ruleset = ruleSet
tile.baseTerrain = Constants.grassland tile.baseTerrain = Constants.grassland

View File

@ -22,7 +22,7 @@ class VisibilityTests {
@Before @Before
fun initTheWorld() { fun initTheWorld() {
RulesetCache.loadRulesets() RulesetCache.loadRulesets(noMods = true)
ruleSet = RulesetCache.getVanillaRuleset() ruleSet = RulesetCache.getVanillaRuleset()
civInfo.gameInfo = GameInfo() civInfo.gameInfo = GameInfo()
civInfo.gameInfo.ruleSet = ruleSet civInfo.gameInfo.ruleSet = ruleSet

View File

@ -17,6 +17,7 @@ import com.unciv.models.stats.Stat
import com.unciv.models.stats.Stats import com.unciv.models.stats.Stats
import com.unciv.models.translations.getPlaceholderParameters import com.unciv.models.translations.getPlaceholderParameters
import com.unciv.models.translations.getPlaceholderText import com.unciv.models.translations.getPlaceholderText
import com.unciv.utils.Log
import com.unciv.utils.debug import com.unciv.utils.debug
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
@ -31,7 +32,8 @@ class BasicTests {
var ruleset = Ruleset() var ruleset = Ruleset()
@Before @Before
fun loadTranslations() { fun loadTranslations() {
RulesetCache.loadRulesets() Log.shouldLog()
RulesetCache.loadRulesets(noMods = true)
ruleset = RulesetCache.getVanillaRuleset() ruleset = RulesetCache.getVanillaRuleset()
} }

View File

@ -29,7 +29,7 @@ class TranslationTests {
override fun write(b: Int) {} override fun write(b: Int) {}
})) }))
translations.readAllLanguagesTranslation() translations.readAllLanguagesTranslation()
RulesetCache.loadRulesets() RulesetCache.loadRulesets(noMods = true)
ruleset = RulesetCache.getVanillaRuleset() ruleset = RulesetCache.getVanillaRuleset()
System.setOut(outputChannel) System.setOut(outputChannel)
} }

View File

@ -45,7 +45,7 @@ class TestGame {
UncivGame.Current.settings = GameSettings() UncivGame.Current.settings = GameSettings()
// Create a new ruleset we can easily edit, and set the important variables of gameInfo // Create a new ruleset we can easily edit, and set the important variables of gameInfo
RulesetCache.loadRulesets() RulesetCache.loadRulesets(noMods = true)
ruleset = RulesetCache[BaseRuleset.Civ_V_GnK.fullName]!! ruleset = RulesetCache[BaseRuleset.Civ_V_GnK.fullName]!!
gameInfo.ruleSet = ruleset gameInfo.ruleSet = ruleset
gameInfo.difficultyObject = ruleset.difficulties["Prince"]!! gameInfo.difficultyObject = ruleset.difficulties["Prince"]!!

View File

@ -3,7 +3,6 @@ package com.unciv.uniques
import com.badlogic.gdx.math.Vector2 import com.badlogic.gdx.math.Vector2
import com.unciv.logic.battle.BattleDamage import com.unciv.logic.battle.BattleDamage
import com.unciv.logic.battle.MapUnitCombatant import com.unciv.logic.battle.MapUnitCombatant
import com.unciv.models.ruleset.unique.StateForConditionals
import com.unciv.models.ruleset.unique.UniqueType import com.unciv.models.ruleset.unique.UniqueType
import com.unciv.testing.GdxTestRunner import com.unciv.testing.GdxTestRunner
import org.junit.Assert import org.junit.Assert
@ -25,7 +24,7 @@ class TriggeredUniquesTests {
@Test @Test
fun testConditionalTimedUniqueIsTriggerable() { fun testConditionalTimedUniqueIsTriggerable() {
val unique = policy.getMatchingUniques(UniqueType.Strength, StateForConditionals.IgnoreConditionals).firstOrNull() val unique = policy.uniqueObjects.first{ it.type == UniqueType.Strength }
Assert.assertTrue("Unique with timed conditional must be triggerable", unique!!.isTriggerable) Assert.assertTrue("Unique with timed conditional must be triggerable", unique!!.isTriggerable)
} }

View File

@ -25,7 +25,7 @@ class UniqueErrorTests {
@Test @Test
fun testCodependantTechs() { fun testCodependantTechs() {
RulesetCache.loadRulesets() RulesetCache.loadRulesets(noMods = true)
val ruleset = RulesetCache.getVanillaRuleset() val ruleset = RulesetCache.getVanillaRuleset()
// Create a prerequisite loop // Create a prerequisite loop