MusicXML
MusicXML copied to clipboard
Make LilyPond tests round-trip to test encoding
We currently only test that we can decode the LilyPond test suite without throwing errors. Now, let's up the ante by making the LilyPond tests perform the following maneuver:
- Decode MusicXML files from LilyPond test suite
- Encode the decoded
MusicXML
model - Re-decode the encoded MusicXML data
- Compare the originally decoded and re-decoded
MusicXML
model
I've tried a bit round-trip testing for custom examples, and I found that the current state of XMLCoder
does not support pretty printing - meaning the model -> xml conversion is never going to be the same as the original xml.
Neither we have any tools to trim all spaces between element tags reliably for xml, so we cannot compare the trimmed version of xml to the generated xml.
You can set XMLEncoder.outputFormatting = .prettyPrinted
.
That said, I don’t think we need to test the concrete encoded values directly. Instead, we should test the semantics of the decoded to the decoded-encoded-decoded values.