Tests: check that Regions are reachable (#1034)
* Tests: check that Regions are reachable try to prevent errors from unconnected/never reachable Regions * Test region access (#1039) * Tests: note oot's default unreachable regions * [SM] Fixed failing testAllStateCanReachEverything (#1087) * [SM] Fixed failing testAllStateCanReachEverything - by adding exclusion for Regions used only when corresponding Starting Location is used - by removing unnecessary VARIA Regions used only for EscapeRando (not supported in AP anyway) * Update worlds/sm/Regions.py Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Update worlds/sm/Rules.py Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Update worlds/sm/Regions.py Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Update test/general/TestReachability.py --------- Co-authored-by: espeon65536 <81029175+espeon65536@users.noreply.github.com> Co-authored-by: lordlou <87331798+lordlou@users.noreply.github.com> Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
This commit is contained in:
parent
fc2e555b4a
commit
ecd2675ea8
|
@ -9,10 +9,33 @@ from . import setup_solo_multiworld
|
||||||
class TestBase(unittest.TestCase):
|
class TestBase(unittest.TestCase):
|
||||||
gen_steps = ["generate_early", "create_regions", "create_items", "set_rules", "generate_basic", "pre_fill"]
|
gen_steps = ["generate_early", "create_regions", "create_items", "set_rules", "generate_basic", "pre_fill"]
|
||||||
|
|
||||||
|
default_settings_unreachable_regions = {
|
||||||
|
"A Link to the Past": {
|
||||||
|
"Chris Houlihan Room", # glitch room by definition
|
||||||
|
"Desert Northern Cliffs", # on top of mountain, only reachable via OWG
|
||||||
|
"Dark Death Mountain Bunny Descent Area" # OWG Mountain descent
|
||||||
|
},
|
||||||
|
"Ocarina of Time": {
|
||||||
|
"Prelude of Light Warp", # Prelude is not progression by default
|
||||||
|
"Serenade of Water Warp", # Serenade is not progression by default
|
||||||
|
"Lost Woods Mushroom Timeout", # trade quest starts after this item
|
||||||
|
"ZD Eyeball Frog Timeout", # trade quest starts after this item
|
||||||
|
"ZR Top of Waterfall", # dummy region used for entrance shuffle
|
||||||
|
},
|
||||||
|
# The following SM regions are only used when the corresponding StartLocation option is selected (so not with default settings).
|
||||||
|
# Also, those dont have any entrances as they serve as starting Region (that's why they have to be excluded for testAllStateCanReachEverything).
|
||||||
|
"Super Metroid": {
|
||||||
|
"Ceres",
|
||||||
|
"Gauntlet Top",
|
||||||
|
"Mama Turtle"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def testAllStateCanReachEverything(self):
|
def testAllStateCanReachEverything(self):
|
||||||
for game_name, world_type in AutoWorldRegister.world_types.items():
|
for game_name, world_type in AutoWorldRegister.world_types.items():
|
||||||
# Final Fantasy logic is controlled by finalfantasyrandomizer.com
|
# Final Fantasy logic is controlled by finalfantasyrandomizer.com
|
||||||
if game_name not in {"Ori and the Blind Forest"}: # TODO: fix Ori Logic
|
if game_name not in {"Ori and the Blind Forest"}: # TODO: fix Ori Logic
|
||||||
|
unreachable_regions = self.default_settings_unreachable_regions.get(game_name, set())
|
||||||
with self.subTest("Game", game=game_name):
|
with self.subTest("Game", game=game_name):
|
||||||
world = setup_solo_multiworld(world_type)
|
world = setup_solo_multiworld(world_type)
|
||||||
excluded = world.exclude_locations[1].value
|
excluded = world.exclude_locations[1].value
|
||||||
|
@ -22,6 +45,11 @@ class TestBase(unittest.TestCase):
|
||||||
with self.subTest("Location should be reached", location=location):
|
with self.subTest("Location should be reached", location=location):
|
||||||
self.assertTrue(location.can_reach(state), f"{location.name} unreachable")
|
self.assertTrue(location.can_reach(state), f"{location.name} unreachable")
|
||||||
|
|
||||||
|
for region in world.get_regions():
|
||||||
|
if region.name not in unreachable_regions:
|
||||||
|
with self.subTest("Region should be reached", region=region):
|
||||||
|
self.assertTrue(region.can_reach(state))
|
||||||
|
|
||||||
with self.subTest("Completion Condition"):
|
with self.subTest("Completion Condition"):
|
||||||
self.assertTrue(world.can_beat_game(state))
|
self.assertTrue(world.can_beat_game(state))
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,13 @@ def create_regions(self, world, player: int):
|
||||||
|
|
||||||
regions = []
|
regions = []
|
||||||
for accessPoint in Logic.accessPoints:
|
for accessPoint in Logic.accessPoints:
|
||||||
regions.append(create_region( self,
|
if not accessPoint.Escape:
|
||||||
world,
|
regions.append(create_region(self,
|
||||||
player,
|
world,
|
||||||
accessPoint.Name,
|
player,
|
||||||
None,
|
accessPoint.Name,
|
||||||
[accessPoint.Name + "->" + key for key in accessPoint.intraTransitions.keys()]))
|
None,
|
||||||
|
[accessPoint.Name + "->" + key for key in accessPoint.intraTransitions.keys()]))
|
||||||
|
|
||||||
world.regions += regions
|
world.regions += regions
|
||||||
|
|
||||||
|
|
|
@ -36,5 +36,6 @@ def set_rules(world, player):
|
||||||
add_postAvailable_rule(location, player, value.PostAvailable)
|
add_postAvailable_rule(location, player, value.PostAvailable)
|
||||||
|
|
||||||
for accessPoint in Logic.accessPoints:
|
for accessPoint in Logic.accessPoints:
|
||||||
for key, value1 in accessPoint.intraTransitions.items():
|
if not accessPoint.Escape:
|
||||||
set_entrance_rule(world.get_entrance(accessPoint.Name + "->" + key, player), player, value1)
|
for key, value1 in accessPoint.intraTransitions.items():
|
||||||
|
set_entrance_rule(world.get_entrance(accessPoint.Name + "->" + key, player), player, value1)
|
||||||
|
|
Loading…
Reference in New Issue