fix: read the database size of a declared hash

A platform declaration that names only an md5 left the size check
undecided, and an undecided same-named match overrode a profile's
system:. The size the database holds for that md5 now refutes it: clk's
Oric basic10.rom no longer joins Batocera's BK list.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 11:44:40 +01:00
1 parent a434c1a8a0
commit f69bd7cbd5
2 files changed
+34 -5

No files matched your search

+20
View File
@@ -454,6 +454,26 @@ class TheModelIsAFunctionOfItsInputs(unittest.TestCase):
)
class DatabaseSizeRefutesASameNamedDeclaration(unittest.TestCase):
"""Batocera's BK system declares BASIC10.ROM by md5 alone. clk's Oric
basic10.rom, 16 KB with its own system:, was filed under the BK and
added to its list: the 24576 bytes the database holds for that md5
were never compared."""
def test_the_size_behind_a_declared_hash_counts(self):
bk_md5, oric_md5 = "3" * 32, "e" * 32
db = {"files": {"1" * 40: {"sha1": "1" * 40, "md5": bk_md5, "size": 24576}},
"indexes": {"by_md5": {bk_md5: "1" * 40}}}
profiles = {"clk": {"emulator": "clk", "type": "libretro", "systems": ["oric"],
"files": [{"name": "basic10.rom", "path": "Oric/basic10.rom",
"system": "oric", "size": 16384, "md5": oric_md5}]}}
config = {"cores": ["clk"], "systems": {"elektronika-bk": {"files": [
{"name": "BASIC10.ROM", "md5": bk_md5}]}}}
truth = generate_platform_truth("p", config, {}, profiles, db=db)
self.assertNotIn("basic10.rom", {
f["name"] for f in truth["systems"].get("elektronika-bk", {}).get("files", [])})
class RegionFollowsEveryReader(unittest.TestCase):
"""The first core to tag a file set its region in the truth: the ST-V
BIOS kept beetle_saturn's Americas and lost mednafen_stv's Korea, and