]> dreyeck.freedombox.rocks Git - topic-maps.git/blobdiff - scripts/check-cxtm.py
Support explicitly typed Topic Names with merge and CXTM evidence
[topic-maps.git] / scripts / check-cxtm.py
index 2eca6e96628f21986ef86d1fbb3317bfa1e438be..62acc2543feab30405e133d569716a8f77bc14b4 100644 (file)
@@ -8,17 +8,21 @@ root = pathlib.Path(__file__).resolve().parent.parent
 report = json.loads(pathlib.Path(sys.argv[1]).read_text())
 assert report['kind'] == 'cxtm-byte-equality' and report['failed'] == 0
 assert report['passed'] == len(report['checks']) == len(set(report['checks']))
-expected_count = {'--slice-5': 28, '--slice-6': 33, '--slice-7': 39, '--slice-8': 46, '--slice-9': 51, '--slice-10': 55}.get(sys.argv[2] if len(sys.argv) > 2 else '', 24)
+expected_count = {'--slice-12a': 58, '--slice-5': 28, '--slice-6': 33, '--slice-7': 39, '--slice-8': 46, '--slice-9': 51, '--slice-10': 55, '--slice-11': 56}.get(sys.argv[2] if len(sys.argv) > 2 else '', 24)
 assert len(report['cases']) == expected_count
 for case in report['cases']:
     actual = case['actualCXTM'].encode('utf-8')
     expected = (root / 'vendor/cxtm/ctm/baseline' / (pathlib.Path(case['id']).name + '.cxtm')).read_bytes()
     assert expected == case['expectedCXTM'].encode('utf-8')
-    discrepancy = expected_count == 55 and case['id'] == 'ctm/in/occurrence-datetime2.ctm'
+    discrepancy = expected_count >= 55 and (case['id'] == 'ctm/in/occurrence-datetime2.ctm' or expected_count >= 56 and case['id'] == 'ctm/in/occurrence-datetime-timezone2.ctm')
     if discrepancy:
         assert actual != expected and case['status'] == 'fail'
-        assert b'<value>1976-09-19T12:02:00</value>' in actual
-        assert b'<value>1976-09-19T12:01:60</value>' in expected
+        if case['id'].endswith('timezone2.ctm'):
+            assert b'<value>2010-12-31T22:00:00Z</value>' in actual
+            assert b'<value>2011-01-01T00:00:00+02:00</value>' in expected
+        else:
+            assert b'<value>1976-09-19T12:02:00</value>' in actual
+            assert b'<value>1976-09-19T12:01:60</value>' in expected
     else:
         assert actual == expected and case['status'] == 'pass', case['id']
     assert case['byteCount'] == len(actual)
@@ -44,4 +48,6 @@ for case in report['cases']:
     for ref in xml.iter():
         if 'topicref' in ref.attrib:
             assert 1 <= int(ref.attrib['topicref']) <= len(topics)
-print(f'CXTM-INDEPENDENT-PASS: {expected_count - int(expected_count == 55)} byte-exact unchanged baselines; {int(expected_count == 55)} explicit normative discrepancy; canonical XML and reference integrity')
+passes = sum(c['status'] == 'pass' for c in report['cases'])
+fails = sum(c['status'] == 'fail' for c in report['cases'])
+print(f'CXTM-INDEPENDENT-PASS: {passes} byte-exact unchanged baselines; {fails} explicit normative discrepancy; canonical XML and reference integrity')