Skip to content
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

Add test-case annotation. #2764

Merged
merged 3 commits into from Dec 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions chapters/annotations.tex
Expand Up @@ -23,7 +23,7 @@ \section{Vendor-Specific Annotations}\label{vendor-specific-annotations}
\begin{example}
\begin{lstlisting}[language=modelica]
annotation (
Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}),
Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}),<
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
graphics = {__NameOfVendor(Circle(center = {0, 0}, radius = 10))}));
\end{lstlisting}
This introduces a new graphical primitive \lstinline!Circle! using the
Expand Down Expand Up @@ -460,7 +460,9 @@ \section{Annotations for Code Generation}\label{annotations-for-code-generation}
\end{semantics}
\end{annotationdefinition}

\section{Annotations for Simulation Experiments}\label{annotations-for-simulation-experiments}
\section{Annotations for Simulations}\label{annotations-for-simulations}
These annotations define how models can be simulated.
henrikt-ma marked this conversation as resolved.
Show resolved Hide resolved
\subsection{Annotations for Simulation Experiments}\label{annotations-for-simulation-experiments}
\begin{lstlisting}[language=grammar]
experiment-annotation:
annotation "(" "experiment" [ "(" [experimentOption
Expand All @@ -475,6 +477,18 @@ \section{Annotations for Simulation Experiments}\label{annotations-for-simulatio

The \lstinline!experiment! annotation defines the default start time (\lstinline!StartTime!) in {[}s{]}, the default stop time (\lstinline!StopTime!) in {[}s{]}, the suitable time resolution for the result grid (\lstinline!Interval!) in {[}s{]}, and the default relative integration tolerance (\lstinline!Tolerance!) for simulation experiments to be carried out with the model or block at hand. If \lstinline!StartTime! is not specified it is assumed to be \lstinline!0.0!.

\subsection{Annotation for Test Cases}\label{annotation-for-test-cases}
\begin{lstlisting}[language=grammar]
henrikt-ma marked this conversation as resolved.
Show resolved Hide resolved
testcase-annotation:
annotation "(" "TestCase" "(" "shouldPass" "=" ( false | true ) ")" ")"
\end{lstlisting}
If \lstinline!shouldPass! is \lstinline!false! it indicates that the translation or the simulation of the model should fail.
If a tools checks a package where classes have \lstinline!shouldPass=false! they should not generate errors - and testing them may even be skipped; if a model with \lstinline!shouldPass=false! translates and simulates without error that should generate a diagnostics.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
Similarly as a class with obsolete-annotation a class with \lstinline!TestCase! annotation (regardless of the value of \lstinline!shouldPass!) shall not be used in other models, unless those models also have a \lstinline!TestCase! annotation.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
\begin{nonnormative}
The intent of the test-case can be included in the documentation of the class.
This annotation can both be used for models intended as test-cases for implementations, and for models explaining detectable errors.
\end{nonnormative}
\section{Annotation for single use of class}\label{annotation-for-single-use-of-class}

For state machines it is useful to have single instances of local
Expand Down