Tests: Implement generic default options reachability test

Tests: remove duplicate TestDeathMountain.py
LttP: Move er_seeds out of Main
OriBF: Fix Mapstone typo
This commit is contained in:
Fabian Dill
2021-10-06 11:32:49 +02:00
parent 29a207b73e
commit 1217179f8a
10 changed files with 169 additions and 126 deletions

32
test/Reachability.py Normal file
View File

@@ -0,0 +1,32 @@
import unittest
from argparse import Namespace
from BaseClasses import MultiWorld
from worlds.AutoWorld import AutoWorldRegister, call_all
class TestBase(unittest.TestCase):
_state_cache = {}
gen_steps = ["generate_early", "create_regions", "create_items", "set_rules", "generate_basic", "pre_fill"]
def testAllStateCanReachEverything(self):
for game_name, world_type in AutoWorldRegister.world_types.items():
if game_name != "Ori and the Blind Forest": # TODO: fix Ori Logic
with self.subTest("Game", game=game_name):
world = MultiWorld(1)
world.game[1] = game_name
world.player_name = {1: "Tester"}
world.set_seed()
args = Namespace()
for name, option in world_type.options.items():
setattr(args, name, {1: option.from_any(option.default)})
world.set_options(args)
world.set_default_common_options()
for step in self.gen_steps:
call_all(world, step)
state = world.get_all_state(False)
for location in world.get_locations():
with self.subTest("Location should be reached", location=location):
if not location.can_reach(state):
print("Bla!")
self.assertTrue(location.can_reach(state))

View File

@@ -1,38 +0,0 @@
from test.vanilla.TestVanilla import TestVanilla
class TestDeathMountain(TestVanilla):
def testWestDeathMountain(self):
self.run_location_tests([
["Ether Tablet", False, []],
["Ether Tablet", False, [], ['Progressive Glove', 'Flute']],
["Ether Tablet", False, [], ['Lamp', 'Flute']],
["Ether Tablet", False, [], ['Magic Mirror', 'Hookshot']],
["Ether Tablet", False, [], ['Magic Mirror', 'Hammer']],
["Ether Tablet", False, ['Progressive Sword'], ['Progressive Sword']],
["Ether Tablet", False, [], ['Book of Mudora']],
["Ether Tablet", True, ['Flute', 'Magic Mirror', 'Book of Mudora', 'Progressive Sword', 'Progressive Sword']],
["Ether Tablet", True, ['Progressive Glove', 'Lamp', 'Magic Mirror', 'Book of Mudora', 'Progressive Sword', 'Progressive Sword']],
["Ether Tablet", True, ['Flute', 'Hammer', 'Hookshot', 'Book of Mudora', 'Progressive Sword', 'Progressive Sword']],
["Ether Tablet", True, ['Progressive Glove', 'Lamp', 'Hammer', 'Hookshot', 'Book of Mudora', 'Progressive Sword', 'Progressive Sword']],
["Old Man", False, []],
["Old Man", False, [], ['Progressive Glove', 'Flute']],
["Old Man", False, [], ['Lamp']],
["Old Man", True, ['Flute', 'Lamp']],
["Old Man", True, ['Progressive Glove', 'Lamp']],
["Spectacle Rock Cave", False, []],
["Spectacle Rock Cave", False, [], ['Progressive Glove', 'Flute']],
["Spectacle Rock Cave", False, [], ['Lamp', 'Flute']],
["Spectacle Rock Cave", True, ['Flute']],
["Spectacle Rock Cave", True, ['Progressive Glove', 'Lamp']],
["Spectacle Rock", False, []],
["Spectacle Rock", False, [], ['Progressive Glove', 'Flute']],
["Spectacle Rock", False, [], ['Lamp', 'Flute']],
["Spectacle Rock", False, [], ['Magic Mirror']],
["Spectacle Rock", True, ['Flute', 'Magic Mirror']],
["Spectacle Rock", True, ['Progressive Glove', 'Lamp', 'Magic Mirror']],
])