-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it explicit that tools can show the value of variables for asserts #3641
base: master
Are you sure you want to change the base?
Conversation
See: modelica/ModelicaStandardLibrary#4519 and modelica/ModelicaStandardLibrary#4399 The reason for "may" is: - To not require the value to be duplicated, for cases such as: modelica/ModelicaStandardLibrary#4399 - Support even smarter debugging. I thought it was sufficiently important to make it normative.
Co-authored-by: Henrik Tidefelt <[email protected]>
Co-authored-by: Henrik Tidefelt <[email protected]>
@@ -518,6 +519,11 @@ \subsection{assert}\label{assert} | |||
AssertionLevel.warning); | |||
assert(T > 200 and T < 500, "Medium model outside feasible region"); | |||
\end{lstlisting} | |||
|
|||
It is recommended that asserts have a simple message as above, formulated with the recommended tool behavior in mind. | |||
Tools are recommended to include the failed condition in the message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already stated above.
Tools are recommended to include the failed condition in the message. |
|
||
It is recommended that asserts have a simple message as above, formulated with the recommended tool behavior in mind. | ||
Tools are recommended to include the failed condition in the message. | ||
Tools are also (especially for literal strings) recommended to automatically include the values of relevant variables, as part of the log or interactively accessible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Essentially already stated above.
Tools are also (especially for literal strings) recommended to automatically include the values of relevant variables, as part of the log or interactively accessible. |
It is recommended that asserts have a simple message as above, formulated with the recommended tool behavior in mind. | ||
Tools are recommended to include the failed condition in the message. | ||
Tools are also (especially for literal strings) recommended to automatically include the values of relevant variables, as part of the log or interactively accessible. | ||
Writing \lstinline!assert(T<500, "Temperature = "+String(T)+" was above 500");! is thus not recommended, and is likely to lead to duplicated information -- although tools may have specific compatibility handling of such cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be sufficient to say likely; just let tools to their "clever" thing without mentioning it in the specification. Also remove punctuation at end of inline code:
Writing \lstinline!assert(T<500, "Temperature = "+String(T)+" was above 500");! is thus not recommended, and is likely to lead to duplicated information -- although tools may have specific compatibility handling of such cases. | |
Writing \lstinline!assert(T<500, "Temperature = "+String(T)+" was above 500")! is thus not recommended, and is likely to lead to duplicated information. |
See:
modelica/ModelicaStandardLibrary#4519 and modelica/ModelicaStandardLibrary#4399 for background.
The reason for "may" is:
I thought it was sufficiently important to make it normative.