mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Tests: now autoload tests from /worlds/*/test (#1318)
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
This commit is contained in:
22
worlds/soe/test/TestAccess.py
Normal file
22
worlds/soe/test/TestAccess.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import typing
|
||||
from . import SoETestBase
|
||||
|
||||
|
||||
class AccessTest(SoETestBase):
|
||||
@staticmethod
|
||||
def _resolveGourds(gourds: typing.Dict[str, typing.Iterable[int]]):
|
||||
return [f"{name} #{number}" for name, numbers in gourds.items() for number in numbers]
|
||||
|
||||
def testBronzeAxe(self):
|
||||
gourds = {
|
||||
"Pyramid bottom": (118, 121, 122, 123, 124, 125),
|
||||
"Pyramid top": (140,)
|
||||
}
|
||||
locations = ["Rimsala"] + self._resolveGourds(gourds)
|
||||
items = [["Bronze Axe"]]
|
||||
self.assertAccessDependency(locations, items)
|
||||
|
||||
def testBronzeSpearPlus(self):
|
||||
locations = ["Megataur"]
|
||||
items = [["Bronze Spear"], ["Lance (Weapon)"], ["Laser Lance"]]
|
||||
self.assertAccessDependency(locations, items)
|
53
worlds/soe/test/TestGoal.py
Normal file
53
worlds/soe/test/TestGoal.py
Normal file
@@ -0,0 +1,53 @@
|
||||
from . import SoETestBase
|
||||
|
||||
|
||||
class TestFragmentGoal(SoETestBase):
|
||||
options = {
|
||||
"energy_core": "fragments",
|
||||
"available_fragments": 21,
|
||||
"required_fragments": 20,
|
||||
}
|
||||
|
||||
def testFragments(self):
|
||||
self.collect_by_name(["Gladiator Sword", "Diamond Eye", "Wheel", "Gauge"])
|
||||
self.assertBeatable(False) # 0 fragments
|
||||
fragments = self.get_items_by_name("Energy Core Fragment")
|
||||
victory = self.get_item_by_name("Victory")
|
||||
self.collect(fragments[:-2]) # 1 too few
|
||||
self.assertEqual(self.count("Energy Core Fragment"), 19)
|
||||
self.assertBeatable(False)
|
||||
self.collect(fragments[-2:-1]) # exact
|
||||
self.assertEqual(self.count("Energy Core Fragment"), 20)
|
||||
self.assertBeatable(True)
|
||||
self.remove([victory]) # reset
|
||||
self.collect(fragments[-1:]) # 1 extra
|
||||
self.assertEqual(self.count("Energy Core Fragment"), 21)
|
||||
self.assertBeatable(True)
|
||||
|
||||
def testNoWeapon(self):
|
||||
self.collect_by_name(["Diamond Eye", "Wheel", "Gauge", "Energy Core Fragment"])
|
||||
self.assertBeatable(False)
|
||||
|
||||
def testNoRocket(self):
|
||||
self.collect_by_name(["Gladiator Sword", "Diamond Eye", "Wheel", "Energy Core Fragment"])
|
||||
self.assertBeatable(False)
|
||||
|
||||
|
||||
class TestShuffleGoal(SoETestBase):
|
||||
options = {
|
||||
"energy_core": "shuffle",
|
||||
}
|
||||
|
||||
def testCore(self):
|
||||
self.collect_by_name(["Gladiator Sword", "Diamond Eye", "Wheel", "Gauge"])
|
||||
self.assertBeatable(False)
|
||||
self.collect_by_name(["Energy Core"])
|
||||
self.assertBeatable(True)
|
||||
|
||||
def testNoWeapon(self):
|
||||
self.collect_by_name(["Diamond Eye", "Wheel", "Gauge", "Energy Core"])
|
||||
self.assertBeatable(False)
|
||||
|
||||
def testNoRocket(self):
|
||||
self.collect_by_name(["Gladiator Sword", "Diamond Eye", "Wheel", "Energy Core"])
|
||||
self.assertBeatable(False)
|
5
worlds/soe/test/__init__.py
Normal file
5
worlds/soe/test/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from test.TestBase import WorldTestBase
|
||||
|
||||
|
||||
class SoETestBase(WorldTestBase):
|
||||
game = "Secret of Evermore"
|
Reference in New Issue
Block a user