From 916ba2ea4159474bc9869e1be12250573d72ca20 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 6 Oct 2021 02:12:05 +0200 Subject: [PATCH] Test: test against item/location ID overlap --- test/TestUniqueness.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/TestUniqueness.py diff --git a/test/TestUniqueness.py b/test/TestUniqueness.py new file mode 100644 index 00000000..baf3792c --- /dev/null +++ b/test/TestUniqueness.py @@ -0,0 +1,23 @@ +import unittest +from BaseClasses import MultiWorld +from worlds.AutoWorld import AutoWorldRegister + + +class TestBase(unittest.TestCase): + world: MultiWorld + _state_cache = {} + + def testUniqueItems(self): + known_item_ids = set() + for gamename, world_type in AutoWorldRegister.world_types.items(): + current = len(known_item_ids) + known_item_ids |= set(world_type.item_id_to_name) + self.assertEqual(len(known_item_ids) - len(world_type.item_id_to_name), current) + + def testUniqueLocations(self): + known_location_ids = set() + for gamename, world_type in AutoWorldRegister.world_types.items(): + current = len(known_location_ids) + known_location_ids |= set(world_type.location_id_to_name) + self.assertEqual(len(known_location_ids) - len(world_type.location_id_to_name), current) +