Skip to content

Commit

Permalink
add tests for hk including extensive cloak testing
Browse files Browse the repository at this point in the history
  • Loading branch information
qwint committed Sep 20, 2024
1 parent 79942c0 commit 42ba6a8
Show file tree
Hide file tree
Showing 3 changed files with 686 additions and 0 deletions.
69 changes: 69 additions & 0 deletions worlds/hk/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from test.bases import WorldTestBase
import typing
from BaseClasses import CollectionState # , Item, MultiWorld
from .. import HKWorld


class HKTestBase(WorldTestBase):
game = "Hollow Knight"
world: HKWorld

def assertAccessIndependency(
self,
locations: typing.List[str],
possible_items: typing.Iterable[typing.Iterable[str]],
only_check_listed: bool = False) -> None:
"""Asserts that the provided locations can't be reached without
the listed items but can be reached with any
one of the provided combinations"""
all_items = [
item_name for
item_names in
possible_items for
item_name in
item_names
]

state = CollectionState(self.multiworld)

for item_names in possible_items:
items = self.get_items_by_name(item_names)
for item in items:
self.collect_all_but(item.name)
for location in locations:
self.assertTrue(state.can_reach(location, "Location", 1),
f"{location} not reachable with {item_names}")
for item in items:
state.remove(item)

def assertAccessWithout(
self,
locations: typing.List[str],
possible_items: typing.Iterable[typing.Iterable[str]]) -> None:
"""Asserts that the provided locations can't be reached without the
listed items but can be reached with any
one of the provided combinations"""
all_items = [
item_name for
item_names in
possible_items for
item_name in
item_names
]

state = CollectionState(self.multiworld)
self.collect_all_but(all_items, state)
for location in locations:
self.assertTrue(
state.can_reach(location, "Location", 1),
f"{location} is not reachable without {all_items}")


class selectSeedHK(WorldTestBase):
game = "Hollow Knight"
# player: typing.ClassVar[int] = 1
seed = 0
world: HKWorld

def world_setup(self, *args, **kwargs):
super().world_setup(self.seed)
235 changes: 235 additions & 0 deletions worlds/hk/test/test_Settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
from . import HKTestBase, selectSeedHK


class TestGoal_any(HKTestBase):
options = {
"Goal": "any",
}


class TestGoal_hollowknight(HKTestBase):
options = {
"Goal": "hollowknight",
}


class TestGoal_siblings(HKTestBase):
options = {
"Goal": "siblings",
}


class TestGoal_radiance(HKTestBase):
options = {
"Goal": "radiance",
}


class TestGoal_godhome(HKTestBase):
options = {
"Goal": "godhome",
}


class TestGoal_godhome_flower(HKTestBase):
options = {
"Goal": "godhome_flower",
}


class TestRandomize_All(HKTestBase):
options = {
"Goal": "any",

"RandomizeDreamers": True,
"RandomizeSkills": True,
"RandomizeFocus": True,
"RandomizeSwim": True,
"RandomizeCharms": True,
"RandomizeKeys": True,
"RandomizeMaskShards": True,
"RandomizeVesselFragments": True,
"RandomizeCharmNotches": True,
"RandomizePaleOre": True,
"RandomizeGeoChests": True,
"RandomizeJunkPitChests": True,
"RandomizeRancidEggs": True,
"RandomizeRelics": True,
"RandomizeWhisperingRoots": True,
"RandomizeBossEssence": True,
"RandomizeGrubs": True,
"RandomizeMimics": True,
"RandomizeMaps": True,
"RandomizeStags": True,
"RandomizeLifebloodCocoons": True,
"RandomizeGrimmkinFlames": True,
"RandomizeJournalEntries": True,
"RandomizeNail": True,
"RandomizeGeoRocks": True,
"RandomizeBossGeo": True,
"RandomizeSoulTotems": True,
"RandomizeLoreTablets": True,
"RandomizeElevatorPass": True,
}


class TestRandomize_None(HKTestBase):
options = {
"Goal": "any",

"RandomizeDreamers": False,
"RandomizeSkills": False,
"RandomizeFocus": False,
"RandomizeSwim": False,
"RandomizeCharms": False,
"RandomizeKeys": False,
"RandomizeMaskShards": False,
"RandomizeVesselFragments": False,
"RandomizeCharmNotches": False,
"RandomizePaleOre": False,
"RandomizeGeoChests": False,
"RandomizeJunkPitChests": False,
"RandomizeRancidEggs": False,
"RandomizeRelics": False,
"RandomizeWhisperingRoots": False,
"RandomizeBossEssence": False,
"RandomizeGrubs": False,
"RandomizeMimics": False,
"RandomizeMaps": False,
"RandomizeStags": False,
"RandomizeLifebloodCocoons": False,
"RandomizeGrimmkinFlames": False,
"RandomizeJournalEntries": False,
"RandomizeNail": False,
"RandomizeGeoRocks": False,
"RandomizeBossGeo": False,
"RandomizeSoulTotems": False,
"RandomizeLoreTablets": False,
"RandomizeElevatorPass": False,
}


class TestSplit_All(HKTestBase):
options = {
"Goal": "any",

"SplitCrystalHeart": True,
"SplitMothwingCloak": True,
"SplitMantisClaw": True,
}


class TestCosts_All(HKTestBase):
options = {
"Goal": "any",

"EggShopSlots": 9,
"SlyShopSlots": 9,
"SlyKeyShopSlots": 9,
"IseldaShopSlots": 9,
"SalubraShopSlots": 9,
"SalubraCharmShopSlots": 9,
"LegEaterShopSlots": 9,
"GrubfatherRewardSlots": 9,
"SeerRewardSlots": 9,
"ExtraShopSlots": 9,
"CostSanity": True,
"CostSanityHybridChance": 1,
"CostSanityEggWeight": 1,
"CostSanityGrubWeight": 1,
"CostSanityEssenceWeight": 1,
"CostSanityCharmWeight": 1,
"CostSanityGeoWeight": 1,
}

# RandomizeDreamers,
# RandomizeSkills,
# RandomizeFocus,
# RandomizeSwim,
# RandomizeCharms,
# RandomizeKeys,
# RandomizeMaskShards,
# RandomizeVesselFragments,
# RandomizeCharmNotches,
# RandomizePaleOre,
# RandomizeGeoChests,
# RandomizeJunkPitChests,
# RandomizeRancidEggs,
# RandomizeRelics,
# RandomizeWhisperingRoots,
# RandomizeBossEssence,
# RandomizeGrubs,
# RandomizeMimics,
# RandomizeMaps,
# RandomizeStags,
# RandomizeLifebloodCocoons,
# RandomizeGrimmkinFlames,
# RandomizeJournalEntries,
# RandomizeNail,
# RandomizeGeoRocks,
# RandomizeBossGeo,
# RandomizeSoulTotems,
# RandomizeLoreTablets,
# RandomizeElevatorPass,
# StartLocation,
# Goal,
# WhitePalace,
# SplitCrystalHeart,
# SplitMothwingCloak,
# SplitMantisClaw,
# AddUnshuffledLocations,


# # not useful without more asserts
# PreciseMovement,
# ProficientCombat,
# BackgroundObjectPogos,
# EnemyPogos,
# ObscureSkips,
# ShadeSkips,
# InfectionSkips,
# FireballSkips,
# SpikeTunnels,
# AcidSkips,
# DamageBoosts,
# DangerousSkips,
# DarkRooms,
# ComplexSkips,
# DifficultSkips,
# RemoveSpellUpgrades,
# MinimumGeoPrice,
# MaximumGeoPrice,
# MinimumGrubPrice,
# MaximumGrubPrice,
# MinimumEssencePrice,
# MaximumEssencePrice,
# MinimumCharmPrice,
# MaximumCharmPrice,
# RandomCharmCosts,
# PlandoCharmCosts,
# MinimumEggPrice,
# MaximumEggPrice,
# EggShopSlots,
# SlyShopSlots,
# SlyKeyShopSlots,
# IseldaShopSlots,
# SalubraShopSlots,
# SalubraCharmShopSlots,
# LegEaterShopSlots,
# GrubfatherRewardSlots,
# SeerRewardSlots,
# ExtraShopSlots,
# CostSanity,
# CostSanityHybridChance,
# CostSanityEggWeight,
# CostSanityGrubWeight,
# CostSanityEssenceWeight,
# CostSanityCharmWeight,
# CostSanityGeoWeight,

# # should be ok not testing
# StartingGeo,
# DeathLink,
# DeathLinkShade,
# DeathLinkBreaksFragileCharms,
# ExtraPlatforms,
Loading

0 comments on commit 42ba6a8

Please sign in to comment.