diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 47df5772..aa478931 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -4250,5 +4250,32 @@ class ToolReferenceListsEveryModule(unittest.TestCase): self.assertEqual(self._rows("Target scrapers"), modules) + +class ToolReferenceCountsMatchTheirArtifacts(unittest.TestCase): + """tools.md said 67 derivable entries for 79 and 1,113 identified + archives for 1,181: counts written by hand drift from the tools.""" + + def setUp(self): + self.text = (ROOT / "wiki" / "tools.md").read_text(encoding="utf-8") + + def test_recipe_store_counts(self): + store = json.loads((ROOT / "recipes" / "mame.json").read_text(encoding="utf-8")) + versions = {dat for entry in store["entries"] for dat in entry.get("dats") or [entry["dat"]]} + listed = sum(len(entry.get("dats") or [entry["dat"]]) for entry in store["entries"]) + match = re.search( + r"(\d+) MAME versions produce ([\d,]+) entries but only ([\d,]+)\s+distinct", + self.text, + ) + self.assertIsNotNone(match) + stated = [int(group.replace(",", "")) for group in match.groups()] + self.assertEqual(stated, [len(versions), listed, len(store["entries"])]) + + def test_derivable_count(self): + derivable = json.loads((ROOT / "derivable.json").read_text(encoding="utf-8")) + match = re.search(r"(\d+) entries on the current snapshots", self.text) + self.assertIsNotNone(match) + self.assertEqual(int(match.group(1)), len(derivable)) + + if __name__ == "__main__": unittest.main() diff --git a/wiki/tools.md b/wiki/tools.md index ae939e36..c89bea12 100644 --- a/wiki/tools.md +++ b/wiki/tools.md @@ -645,8 +645,9 @@ distinct recipes, since most sets do not change between releases. Each is kept once, `dats` listing every version that agrees and `dat` naming the earliest, so an identification reads as "unchanged since that version". -`--identify` answers what an archive on disk actually is: with 22 MAME versions -and the FBNeo DATs imported, 1,113 archives are reproduced byte for byte. `--missing` takes the container MD5s the platforms pin, keeps those the +`--identify` answers what an archive on disk actually is: the version whose +recipe reproduces it byte for byte. Step 1c of the pipeline prints how many +archives that is on the current collection. `--missing` takes the container MD5s the platforms pin, keeps those the collection does not have, and tries every recipe whose ROMs are present. Reconstruction only works when the pinned archive is itself TorrentZip. An @@ -716,7 +717,8 @@ marks a missing entry DERIVABLE when a held file produces its sha1 by halving, quartering, splitting into even and odd bytes or 16-bit words (byte-swapped or not), swapping bytes, mirroring, or joining two files of one directory. The Amiga Kickstart chip pairs and TOSEC's split C64 and VES ROMs are found -this way: 67 entries on the current snapshots. +this way: 79 entries on the current snapshots, recorded in `derivable.json` +by pipeline step 1b. | Catalog | Acquisition | Notes | |---------|------------|-------|