Files
horizon-airdef/tests/test_parity.py
T
Ludovic Marie 34f4722e42 Show audited Java parity in the README and correct stale status
Score fourteen subsystems against the code (55% overall) and test that the
README percentage matches the table. Fluids, redstone, crop growth and the
Nether already run in the client; the native-client status still described
the old test-generator terrain without mobs or containers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 11:21:53 +02:00

21 lines
878 B
Python

import re
import unittest
from pathlib import Path
README = Path(__file__).resolve().parents[1] / 'README.md'
class ParityTests(unittest.TestCase):
def test_readme_percentage_matches_table(self):
text = README.read_text()
heading = re.search(r'^### Java parity: (\d+)%$', text, re.MULTILINE)
self.assertIsNotNone(heading, 'README parity heading is missing')
table = text[heading.end():].split('| Subsystem | Score | Main gaps |', 1)[1].split('\n\n', 1)[0]
scores = [float(score) for score in re.findall(r'^\| [^|]+ \| (0|0\.25|0\.5|0\.75|1) \| [^|]+ \|$', table, re.MULTILINE)]
self.assertEqual(len(scores), table.count('\n|') - 1, 'Every row needs a score of 0, 0.25, 0.5, 0.75 or 1')
self.assertEqual(int(heading.group(1)), round(sum(scores) * 100 / len(scores)))
if __name__ == '__main__':
unittest.main()