Skip to content

test: revive a non-redundant subset of DocumentManagerTest.cpp#234

Merged
webern merged 1 commit into
mainfrom
claude/issue-100-staleness-klnvlf
Jun 21, 2026
Merged

test: revive a non-redundant subset of DocumentManagerTest.cpp#234
webern merged 1 commit into
mainfrom
claude/issue-100-staleness-klnvlf

Conversation

@webern

@webern webern commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

The tests in mxtest/api/DocumentManagerTest.cpp had been disabled under #if 0 and were written against an older api where createFromScore returned a plain int and getData returned a plain ScoreData. They were updated to the current Result-based DocumentManager api and a focused subset was re-enabled.

Rather than reviving all of the original tests wholesale, this keeps only the coverage that nothing else provides and drops the parts that already overlap other suites:

Kept (33 tests):

  • DocumentManager handle lifecycle (destroyDocument then getDocument returns nullptr)
  • golden metadata extraction from the Dichterliebe reference file (title, composer, lyricist, copyright, scaling)
  • identification/encoding round-trips through the public stream api
  • <supports> round-trips, which no other unit test covers and which the corpus api-roundtrip baseline does not exercise (none of the corpus files using <supports> are in the pinned list)
  • page-margin both/odd/even coalescing

Dropped:

  • defaults layout round-trips (scaling, page margins, system layout) already covered by PageDataTest and the corpus api-roundtrip regression
  • the PageTextData credit round-trip already covered by CreditRoundTripTest
  • the pure-arithmetic tenthsPerMillimeter / tenthsPerInch accessor checks

Also fixed a bug the original carried: tenthsPerInch expected 160, which was computed from the wrong millimeters value (6.35 rather than ActorPrelude's 3.9956). The correct value is 254.27970767844627.

Testing

  • *DocumentManager*: 142 assertions in 33 test cases pass
  • make dev builds clean
  • make fmt applied

References

The tests in mxtest/api/DocumentManagerTest.cpp had been disabled under
#if 0 and were written against an older api where createFromScore returned
a plain int and getData returned a plain ScoreData. Update them to the
current Result-based DocumentManager api and re-enable a focused subset.

Kept the coverage that nothing else provides:
- DocumentManager handle lifecycle (destroy -> getDocument == nullptr)
- golden metadata extraction from the Dichterliebe reference file
- identification/encoding round-trips via the public stream api
- <supports> round-trips (no other unit test, and none of the corpus
  files using <supports> are in the api-roundtrip baseline)
- page-margin both/odd/even coalescing

Dropped the parts already covered by PageDataTest, CreditRoundTripTest,
and the corpus api-roundtrip regression (defaults layout sweeps and the
PageTextData credit round-trip), plus the pure-arithmetic tenthsPer*
accessor checks. Fixed the tenthsPerInch constant the original carried
(160 was computed from the wrong millimeters value).

Closes #100
@webern webern added testing non-breaking fixes or implementation that do not require breaking changes ai Issues opened by, or through, a coding agent. labels Jun 21, 2026 — with Claude
@github-actions

Copy link
Copy Markdown

gen-quality gen/

gen-quality: 84.5 / 100   (floor 84.5, +0.0)

  structure     86.5  x0.50   [fn 90.5 / file 82.6]
  cyclomatic    88.4  x0.25
  cognitive     76.6  x0.25

  409 functions across 31 files, 7702 lines (largest file 1044)
  max cc 56  max cognitive 44  max fn loc 152

Worst offenders (top 5 per axis; full lists in score.json):
  cyclomatic gen/xsd/analyze.py:311     report                             56
  cyclomatic gen/plates/build.py:956    _validate_config_against_ir        35
  cyclomatic gen/press/context.py:145   plate_context                      34
  cyclomatic gen/__main__.py:46         _ir                                23
  cyclomatic gen/tests/test_ir.py:102   _check_references                  20
  cognitive  gen/xsd/analyze.py:311     report                             44
  cognitive  gen/ir/resolve.py:119      flat_elements                      40
  cognitive  gen/tests/test_ir.py:102   _check_references                  38
  cognitive  gen/press/context.py:145   plate_context                      37
  cognitive  gen/xsd/analyze.py:207     _sccs                              37
  size       gen/xsd/analyze.py:311     report                             152
  size       gen/press/context.py:145   plate_context                      96
  size       gen/plates/build.py:533    _value_plate                       89
  size       gen/plates/build.py:956    _validate_config_against_ir        89
  size       gen/ir/resolve.py:119      flat_elements                      78

Commit f0e5a6164f1cb3a70afa911e2c67eaa40f1d574f.

@github-actions

Copy link
Copy Markdown

Coverage report

Core-dev coverage src/private/mx/core/

Metric Coverage Covered / Total
Lines 77.9% 28539 / 36624
Functions 74.4% 6360 / 8550
Branches 50.7% 22672 / 44725

API coverage src/private/mx/{api,impl,utility}/

Metric Coverage Covered / Total
Lines 78.0% 5860 / 7509
Functions 61.9% 1957 / 3159
Branches 47.3% 4931 / 10419

Core HTML report | API HTML report

Commit f0e5a6164f1cb3a70afa911e2c67eaa40f1d574f.

@webern webern merged commit c8def07 into main Jun 21, 2026
7 checks passed
@webern webern deleted the claude/issue-100-staleness-klnvlf branch June 21, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Issues opened by, or through, a coding agent. non-breaking fixes or implementation that do not require breaking changes testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revive DocumentManagerTest.cpp

1 participant