Unit tests - #10
Merged
Merged
Conversation
The three module directories sat beside opendspx/ rather than inside it, so a package installing into a shared prefix -- which is where vcpkg puts this one -- took four of the top-level names there instead of one. They are subdirectories of opendspx/ now, the way llvm/ holds ADT/ and Support/, and an include reads <opendspx/serializer/serializer.h>. Three changes to what the serializer does travel with it, because they live in the files that moved: - A workspace maps a key to an object rather than to any value, which is what the format says it holds. An entry that is not one is now turned down instead of carried through. - A rejected document answers with a code, a byte offset and a line and column, following the same change in stdcorelib. Matching on the wording was the only way to act on the failure before, and pointing at the place meant counting newlines. - The key of a map entry joins the error path, so a bad workspace entry reads $.content.workspace.loop rather than naming only the workspace it was in. The entries used to be values nothing could reject, so the path never showed.
The guards said MODEL for headers that sit in no such directory, and the ones under serializer/private/ said SERIALIZATION for two of the three and SERIALIZER for the other. Each is now the path with the separators replaced, so a new header needs no decision and a moved one has one obvious answer. PRIVATE is left out of the three private ones, since the _p already says it.
MidiFile::load returns a bool, and the caller was reading it as the whole verdict. It is not: a file that stops in the middle of a field reaches the stream reader as a failure and comes out as std::ios_base::failure, past a signature that promised an Error out parameter and nothing else. An editor opening a half-written file got a crash where it had asked for InvalidMidiData.
What was there ran one document through the serializer and printed the bytes, so it said a crash had not happened and nothing else. This is eighty-four cases over the four modules, in one binary, laid out the way stdcorelib's is: a directory per module, and a module's cases come in only when that module was built. Nothing that the compiler already guarantees is covered. What is: - serializer: a round trip over a model with both clip kinds, both singer kinds and both curve kinds; that writing what was read gives the same bytes; that a number keeps the form it was written in; that text which is not UTF-8 is replaced rather than fatal; the zstd frame and its detection; and each way a document can be turned down, with the position it was turned down at. - jsonconverterv1: the mapping machinery on its own -- the shape of an error path through arrays and objects, every data type mismatch, the bounds a range error carries, both enum kinds, polymorphic dispatch and its four failures, and that writing checks what reading checks. - interpolator: that a curve meets its nodes, that a straight run of anchors stays straight, and that a run which turns around does not bulge past the anchor it turns at. - converter: every rule in isValid on its own, and a model out through a MIDI file and back. The libraries come before Boost in target_link_libraries on purpose. Boost.Test usually comes out of a vcpkg tree, that tree is one include directory for everything in it, and the one here carries an older copy of a dependency this project also builds against.
Member
|
@copilot 请你概括此pr中,除了单纯的重命名外的其他改动 |
除去重命名/目录调整,主要还有这些改动:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.