dn-m / MusicXML

Implementation of the musicXML specification in Swift
MIT License
70 stars 19 forks source link

[WIP] (Timewise|Partwise).Measure encoding #196

Closed jsbean closed 4 years ago

jsbean commented 4 years ago

Currently, PartwiseMeasureTests.testDecodingEmpty() (where I've thrown in a round-trip test) crashes with a:

preconditionFailure(
    """
        Attempt to push new unkeyed encoding container when already previously encoded \
        at this path.
    """
)

in XMLEncoderImplementation.unkeyedContainer()

jsbean commented 4 years ago

By removing the try musicData.encode(to: encoder), the encoding succeeds (but the resulting encoding is incomplete).

codecov-io commented 4 years ago

Codecov Report

Merging #196 into latest will decrease coverage by 26.51%. The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##           latest     #196       +/-   ##
===========================================
- Coverage   64.82%   38.31%   -26.52%     
===========================================
  Files         220      218        -2     
  Lines        4663     3675      -988     
===========================================
- Hits         3023     1408     -1615     
- Misses       1640     2267      +627
Impacted Files Coverage Δ
...cXML/Complex Types/Partwise/Partwise.Measure.swift 77.27% <0%> (-12.21%) :arrow_down:
...cXML/Complex Types/Timewise/Timewise.Measure.swift 59.09% <0%> (-21.87%) :arrow_down:
Sources/MusicXML/Complex Types/Accord.swift 0% <0%> (-100%) :arrow_down:
Sources/MusicXML/Complex Types/Pedal.swift 0% <0%> (-100%) :arrow_down:
Sources/MusicXML/Complex Types/Technical.swift 0% <0%> (-100%) :arrow_down:
Sources/MusicXML/Complex Types/PedalTuning.swift 0% <0%> (-100%) :arrow_down:
Sources/MusicXML/Complex Types/Tuplet.swift 0% <0%> (-100%) :arrow_down:
Sources/MusicXML/Complex Types/Tie.swift 0% <0%> (-100%) :arrow_down:
Sources/MusicXML/Complex Types/Dashes.swift 0% <0%> (-100%) :arrow_down:
Sources/MusicXML/Complex Types/Frame.swift 0% <0%> (-100%) :arrow_down:
... and 180 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a421997...cd1f025. Read the comment docs.

jsbean commented 4 years ago

@bwetherfield and @DJBen, do either of you want to pick this up? I am stumped.

Here, we need to encode all of the potential attributes then all of the potential music data...s in a row, as if they are a single array of things.

Any insights?

bwetherfield commented 4 years ago

I think this may be an upstream issue! Will look into it