Draft
Conversation
I didn't understand why we would need dynamic creation of new units, except for when the FMU had invalid XML and we wanted to still be able to run without "errors" (if the model needs to be converted with respect to base units, the model is invalid though), so removed it. I can revert this if found too strict. fmil_test.c is not the best name for the test util, but I think I've already made this extraction (of a common test util) for 3.0, with this name. The input argument to the test function is now the 'parser_test_xmls' directory instead of the specific sub directory. This will require that some paths are duplicated in the test code, but it makes it easier to debug tests from e.g. Visual Studio, since you can always give the same path as argument then, and don't have to modify for each test.
We stored all displayUnitDefs in a separate vector, and used bsearch on it. The
problem is that unitDisplays are not globally unique with respect to name,
which means that we might return the wrong one, since they were stored in
jm_named_ptr.
The Unit/DisplayUnit API is being tested on a very high level (print if
possible) in fmi2_import_xml_test, but not asserted with expected
compared to actual. To verify my changes I therefore decided to add some
more thorough unit tests.
Spec. says "if displayUnit is defined, but not unit, then this is invalid", but it
says nothing if a variable inherits a type with a unit. Is it then valid for the
variable to have a displayUnit (assuming it matches inherited unit)?
Currently I don't have any tests for this.
Example:
Unit: "K"
DisplayUnit: "degC"
DisplayUnit: "degF"
Type: "type"
unit: "K"
displayUnit: "degC"
Variable: "var"
declaredType: "type"
displayUnit: "degF"
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.
Remaining work: FMI3 (not fixing for FMI1), and maybe more.
From Checker issue: modelica-tools/FMUComplianceChecker#19