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

Make it possible to interpret a model #1220

Open
wants to merge 218 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
99672cd
Interpreter: skeleton code.
agarny Apr 7, 2024
d6f5b87
Interpreter: added some (empty) methods to compute a model.
agarny Apr 8, 2024
b67ea7d
Interpreter: added methods to retrieve the VOI, states, rates, and va…
agarny Apr 8, 2024
7f97aa4
Interpreter: allocate the different arrays.
agarny Apr 8, 2024
412d8d4
Merge branch 'main' into issue1218.
agarny Apr 8, 2024
0488b1b
Interpreter tests: make sure that all our arrays are initialised with…
agarny Apr 9, 2024
c3690ea
Some minor cleaning up.
agarny Apr 9, 2024
3d6552b
Interpreter: added the skeleton of the InterpreterInstruction class.
agarny Apr 9, 2024
d93b7d8
Interpreter: added the skeleton of a GeneratorInterpreter class.
agarny Apr 9, 2024
907da52
Generator: extracted the code that generates the code to compute the …
agarny Apr 9, 2024
5412941
Tests: simplified the use of some arrays.
agarny Apr 10, 2024
d9e4258
Interpreter: simplified the construction of our arrays.
agarny Apr 10, 2024
a9914f6
Interpreter: can evaluate generateZeroInitialisationCode().
agarny Apr 11, 2024
d408b5f
Renamed interpreterinstruction[_p].[cpp|h] to interpreterstatement[_p…
agarny Apr 11, 2024
09fe513
Renamed the InterpreterInstruction class to InterpreterStatement.
agarny Apr 11, 2024
38b608a
Address coverage issues.
agarny Apr 11, 2024
4dbd96d
Interpreter: some minor cleaning up.
agarny Apr 11, 2024
ac65d8a
InterpreterStatement: reworked its create() methods.
agarny Apr 11, 2024
32eedd1
GeneratorInterpreter: merged generateDoubleOrConstantVariableNameCode…
agarny Apr 11, 2024
db0665f
GeneratorProfile: don't define the min() and max() functions for the …
agarny Apr 16, 2024
d959235
GeneratorProfile: use the M_E constant rather than exp(1.0).
agarny Apr 16, 2024
9a96766
Interpreter: can evaluate generateInitialisationCode().
agarny Apr 11, 2024
cab734a
Interpreter: can evaluate generateEquationCode().
agarny Apr 15, 2024
9341694
Debug: print an InterpreterStatement object as a tree.
agarny Apr 16, 2024
52219db
InterpreterStatement: keep track of calls to externalVariable().
agarny Apr 16, 2024
4a6c420
Generator/Interpreter: improved our tracking of rates.
agarny Apr 17, 2024
fb67039
Debug: some minor improvements to the printing of an AST / Interprete…
agarny Apr 16, 2024
743b33e
InterpreterStatement: temporarily disable some code to get full code …
agarny Apr 17, 2024
c0e0525
InterpreterStatement: re-enable some code.
agarny Apr 17, 2024
b38dc48
Debug: make it easier to check the name of CI elements when printing …
agarny Apr 17, 2024
f01ef9d
GeneratorInterpreter: have InterpreterStatement track piecewise state…
agarny Apr 17, 2024
07b99d2
AnalyserVariable: removed an unneeded class member.
agarny Apr 17, 2024
a08fec0
Debug: improved the printing of an AST as a tree.
agarny Apr 17, 2024
34ab752
CMake: give our utilities access to libxml2.
agarny Apr 17, 2024
c139ced
Windows: added a header file that is needed on Windows.
agarny Apr 17, 2024
2a9415e
Linux: prevent clashes with the TRUE and FALSE macros.
agarny Apr 17, 2024
c3c8c45
CMake: account for debug.cpp and debug.h in the format_code target.
agarny Apr 17, 2024
03607ef
Debug: refactoring of code.
agarny Apr 17, 2024
1204fb1
InterpreterStatement: temporarily disable some code to get full code …
agarny Apr 17, 2024
a97ac29
Coverage: removed unneeded tests.
agarny Apr 17, 2024
e0f1dbc
Coverage: make sure that we have full coverage in InterpreterStatement.
agarny Apr 17, 2024
9373065
InterpreterStatement: removed the DIFF type.
agarny Apr 18, 2024
0b31297
InterpreterStatement: re-enabled the evaluation of some types.
agarny Apr 18, 2024
7d48ea0
InterpreterStatement: added the evaluation of trigonometric functions.
agarny Apr 18, 2024
b6aa691
GeneratorProfile: simplified the definition of some trigonometric fun…
agarny Apr 18, 2024
9460678
Analyser: allow a `piecewise` element to have no children or only an …
agarny Apr 18, 2024
290beda
InterpreterStatement: don't need the `OTHERWISE` type.
agarny Apr 18, 2024
3f0be73
GeneratorInterpreter: the default profile doesn't have an `XOR` opera…
agarny Apr 18, 2024
3c3df21
InterpreterStatement: can now evaluate a piecewise statement.
agarny Apr 18, 2024
532efc1
Interpreter: allow the evaluation of computeComputedConstants().
agarny Apr 18, 2024
5cd4a41
Utils: moved areNearlyEqual() to src/commonutils.cpp.
agarny Apr 18, 2024
3126a0e
Linux: added a needed header file.
agarny Apr 18, 2024
f835aa5
Interpreter: added support for VOI.
agarny Apr 19, 2024
1148d08
InterpreterStatement: renamed/improved some types
agarny Apr 19, 2024
8077ffa
Analyser: improved code readability.
agarny Apr 19, 2024
6bbb036
Tests: updated the expected values from our InterpreterStatement class.
agarny Apr 18, 2024
a94e396
Interpreter: enable the computation of rates.
agarny Apr 19, 2024
6614251
Interpreter: enable the computation of variables.
agarny Apr 19, 2024
ce7570f
InterpreterStatement: cache a variable's index.
agarny Apr 19, 2024
62dd985
Linux: added the header file for memcpy().
agarny Apr 19, 2024
262608e
Tests: updated our bindings tests for the interpreter.
agarny Apr 19, 2024
53e262a
Linux: added a needed header file for math functions.
agarny Apr 19, 2024
dc51437
InterpreterStatement: use the ternary operator to evaluate a piecewis…
agarny Apr 21, 2024
63f8333
Interpreter: return the states, rates, and variables by reference.
agarny Apr 21, 2024
acb462b
Common utils: export areNearlyEqual().
agarny Apr 21, 2024
265759b
Tests: have a couple of models integrated using computed and interpre…
agarny Apr 21, 2024
208157f
Tests: updated the expected values for the generator tests.
agarny Apr 22, 2024
dcecc8d
GeneratorInterpreter: removed NLA system statements.
agarny Apr 22, 2024
5755083
InterpretStatement: renamed to InterpretAstStatement.
agarny Apr 22, 2024
76e743c
Debug: some minor cleaning up.
agarny Apr 22, 2024
fa196e4
Interpreter: added an RPN-based statement class.
agarny Apr 22, 2024
50a4923
Debug: added a way to print RPN statements.
agarny Apr 22, 2024
cf5da30
Interpreter: removed the RPN-based interpreter.
agarny Apr 23, 2024
03d6043
Interpreter: renamed InterpreterAstStatement to InterpreterStatement.
agarny Apr 23, 2024
960472a
Generator tests: don't compare the compiled and interpreted models.
agarny Apr 23, 2024
0e40acd
Coverage tests: check the values we get from the interpreter.
agarny Apr 23, 2024
91595e1
Clarified some comments and improved our API documentation.
agarny Apr 24, 2024
f2884bc
Some minor cleaning up and improvement to the code.
agarny Apr 24, 2024
d81efdf
GeneratorProfile: updated the version of our C and Python profiles.
agarny Apr 24, 2024
50ef61a
C++: removed some assert() calls.
agarny Apr 24, 2024
f87c44d
GeneratorInterpreter: addressed some coverage issues.
agarny Apr 24, 2024
9900f4e
InterpreterStatement: addressed some coverage issues.
agarny Apr 24, 2024
519faa2
Interpreter: directly use `double *`.
agarny Apr 25, 2024
107fb7b
SWIG: cleaned up the Interpreter interface.
agarny Apr 26, 2024
2bcc1ca
Interpreter: don't keep track of the VOI, states, rates, and variables.
agarny Apr 25, 2024
c922a79
Python bindings: added support for NumPy for Interpreter.
agarny Apr 26, 2024
8fe2e97
Interpreter: temporarily disabled bindings.
agarny Apr 26, 2024
987b3db
Make gcc happy.
agarny Apr 30, 2024
160d855
Merge branch 'main' into issue1218
hsorby May 11, 2024
584ebb5
Merge branch 'main' into issue1218
nickerso May 16, 2024
33a527a
Merge branch 'issue1240' into issue1218.
agarny Jul 3, 2024
83fe400
Updated a generator test as a result of commit 33a527a4.
agarny Jul 3, 2024
4966bad
Some minor cleaning up.
agarny Jul 3, 2024
d51df65
Merge branch 'main' into issue1218.
agarny Jul 3, 2024
fd05860
Python docstrings tests: don't test for CellmlElementType.
agarny Aug 5, 2024
0207ff9
Code generator: use different arrays for constants, computed constant…
agarny Jul 12, 2024
329b01f
Generator: use different arrays for constants, computed constants, an…
agarny Aug 7, 2024
56a8658
Generator: use different arrays for constants, computed constants, an…
agarny Aug 7, 2024
94515cc
Generator: use different arrays for constants, computed constants, an…
agarny Aug 7, 2024
8488c49
Generator: use different arrays for constants, computed constants, an…
agarny Aug 7, 2024
5287d5b
Generator: use computed_constants and not computedConstants in Python.
agarny Aug 7, 2024
82c104e
Generator profile: bumped the C and Python versions.
agarny Aug 7, 2024
0f8fbf3
Tests: automatically generate the expected file contents.
agarny Aug 8, 2024
c2504d7
Generator profile: added setters/getters for constants, computed cons…
agarny Aug 7, 2024
01bfdec
Analyser: track the constant, computed constant, and algebraic indexes.
agarny Aug 8, 2024
09fcc1f
Some minor cleaning up.
agarny Aug 8, 2024
a7c7774
Generator: added an external array.
agarny Aug 8, 2024
ef86447
Updated JavaScript tests.
agarny Aug 8, 2024
9d7174d
Analyser: keep track of computed constants and external variables for…
agarny Aug 8, 2024
60b26bc
Analyser: some minor cleaning up.
agarny Aug 8, 2024
05aa338
AnalyserModel: keep track of the constants, computed constants, and e…
agarny Aug 8, 2024
7c0d8a1
AnalyserEquation: keep track of states and constants.
agarny Aug 9, 2024
9f8bf25
Generator: generate the CONSTANT_INFO, COMPUTED_CONSTANT_INFO, ALGEBR…
agarny Aug 12, 2024
4bc05e8
Generator: don't need to mention the type of a variable in a XXX_INFO…
agarny Aug 14, 2024
330f6d6
GeneratorProfile: extracted generator profile_p.h.
agarny Aug 14, 2024
aaaeed3
Generator: updated the createXxxArray() methods.
agarny Aug 14, 2024
46e4e93
Generator: updated the signature of our initialiseVariables() method.
agarny Aug 15, 2024
fa807fb
GeneratorProfile: fixed a small issue with our Python profile.
agarny Aug 15, 2024
71ae73b
Generator: initialise things in initialiseVariables() in the order of…
agarny Aug 15, 2024
b1b7536
Generator: initialise all computed constants in computeComputedConsta…
agarny Aug 15, 2024
a46dbca
GeneratorProfile: added the external array string.
agarny Aug 16, 2024
0a05ef9
Generator: don't initialise our external variables in initialiseVaria…
agarny Aug 16, 2024
b514746
Analyser: a variable using an NLA should always be an algebraic varia…
agarny Aug 16, 2024
153b4b5
Analyser: some minor cleaning up.
agarny Aug 16, 2024
19126a8
Analyser: properly set the index of external variables.
agarny Aug 16, 2024
841c676
Analyser: put some struct/class definitions in a corresponding privat…
agarny Aug 16, 2024
8afeb5c
Analyser: simplified things.
agarny Aug 16, 2024
40d3fb4
Generator: make sure that constants are initialised when they are nee…
agarny Aug 17, 2024
b32d169
Generator: renamed the "external" array to "externals".
agarny Aug 19, 2024
8cba9cd
Generator: "initialise" computed constants in initialiseVariables().
agarny Aug 19, 2024
65e1d18
Generator: initialise things in initialiseVariables() in the order of…
agarny Aug 19, 2024
327225a
GeneratorProfile: pass the computedConstants array to initialiseVaria…
agarny Aug 19, 2024
d1020eb
GeneratorProfile: don't need to pass the VOI to initialiseVariables().
agarny Aug 19, 2024
f3bbce3
Tests: removed unneeded generated C/Python files.
agarny Aug 19, 2024
1f09630
Generator: make sure that constants are initialised when they are nee…
agarny Aug 19, 2024
b54f688
GeneratorProfile: use the constants, computed constants, and algebrai…
agarny Aug 19, 2024
d165208
GeneratorProfile: use the constants, computed constants, and algebrai…
agarny Aug 19, 2024
183d531
Tests: some minor cleaning up.
agarny Aug 20, 2024
54e6673
Some minor cleaning up.
agarny Aug 21, 2024
62dc092
GeneratorProfile: use the externals array to retrieve the value of ex…
agarny Aug 20, 2024
4bf1afc
Addressed various coverage issues as a result of our work on issue #1…
agarny Aug 20, 2024
68ad0fc
Some minor cleaning up.
agarny Aug 28, 2024
ff5a1a2
Analyser: improved unit scaling.
agarny Aug 27, 2024
c83f5c7
Some minor cleaning up.
agarny Sep 2, 2024
26ba852
Generator: make sure that NLA systems have access to external variables.
agarny Sep 3, 2024
68c9895
Generator: fixed a small issue with our Python profile.
agarny Sep 5, 2024
f0957e0
Tests: added a test to generate some code for the DAE version of the …
agarny Sep 5, 2024
49b3a4f
Tests: changed the external variable in algebraicEqnWithOneNonIsolate…
agarny Sep 6, 2024
6b74014
Python: improved the API documentation.
agarny Sep 10, 2024
dcbd038
Some minor cleaning up.
agarny Sep 10, 2024
3a25f12
Merge branch 'issue1243' into issue1218
agarny Sep 13, 2024
9af7d95
Various changes following the merge at commit 3a25f124.
agarny Sep 13, 2024
7936418
Interpreter: added support for external variables.
agarny Sep 18, 2024
707e211
Code spelling.
agarny Sep 18, 2024
e3ce0d1
Merge branch 'main' into issue1243.
agarny Oct 7, 2024
e96b48f
Merge branch 'main' into issue1218.
agarny Oct 7, 2024
bc97102
AnalyserEquationAst: don't include "libcellml/undefines.h" in the .cp…
agarny Oct 14, 2024
a581c7f
SWIG: make it work with Clang 19
agarny Oct 14, 2024
c07412b
API: simplifed/improved the API for external variables.
agarny Oct 15, 2024
5febd95
CI: added some "basic" GitHub Actions.
agarny Oct 15, 2024
cf90c3b
CI: added some "basic" GitHub Actions.
agarny Oct 16, 2024
96877a6
CI: added some "basic" GitHub Actions.
agarny Oct 16, 2024
b6d52b0
CI: added some "basic" GitHub Actions.
agarny Oct 16, 2024
1add1b6
CI: added some "basic" GitHub Actions.
agarny Oct 16, 2024
1dce201
CI: added some "basic" GitHub Actions.
agarny Oct 16, 2024
aefa695
CI: added some "basic" GitHub Actions.
agarny Oct 16, 2024
ffd073f
CMake: don't use hints to find llvm-cov and llvm-profdata.
agarny Oct 17, 2024
69aa6ca
CMake: let the user know where the coverage report can be found.
agarny Oct 17, 2024
b9492a5
Merge branch 'python' into issue1260.
agarny Oct 21, 2024
e917ba4
Merge branch 'issue1257' into issue1260.
agarny Oct 21, 2024
f1fa3ed
Merge branch 'issue1251' into issue1260.
agarny Oct 21, 2024
8175278
Merge branch 'issue1243' into issue1260
agarny Oct 21, 2024
c0eef39
Some minor cleaning up.
agarny Oct 21, 2024
e739d34
Merge branch 'issue1251' into issue1243
agarny Oct 21, 2024
8563e4b
Some minor cleaning up.
agarny Oct 21, 2024
dba1002
Merge branch 'issue1243' into issue1260.
agarny Oct 21, 2024
7cf4ed9
Merge branch 'main' into issue1253.
agarny Oct 21, 2024
c9c28d6
Merge branch 'main' into python.
agarny Oct 21, 2024
feffbea
Merge branch 'main' into issue1257.
agarny Oct 21, 2024
4a71e2f
Merge branch 'main' into issue1251.
agarny Oct 21, 2024
ddbb845
Merge branch 'main' into issue1243
agarny Oct 21, 2024
9c70e41
Merge branch 'issue1243' into issue1260.
agarny Oct 21, 2024
aeea86c
Some minor cleaning up.
agarny Oct 21, 2024
98bbe35
Merge branch 'issue1253' into python.
agarny Oct 21, 2024
e279a17
Merge branch 'python' into issue1257.
agarny Oct 21, 2024
925a288
Merge branch 'issue1257' into issue1251.
agarny Oct 21, 2024
e2d73da
Merge branch 'issue1251' into issue1243
agarny Oct 21, 2024
c7a98fa
Merge branch 'issue1243' into issue1260.
agarny Oct 21, 2024
c055c69
Make sure that we can find the version of llvm-cov that we installed.
agarny Oct 21, 2024
6c63b5c
CMake: use the PATH as a hint to find llvm-cov and llvm-profdata.
agarny Oct 21, 2024
62a5331
CMake: let the user know where the coverage report can be found.
agarny Oct 21, 2024
3e709db
Merge branch 'issue1253' into python.
agarny Oct 21, 2024
1c7c1c3
Merge branch 'python' into issue1251
agarny Oct 21, 2024
61f9b08
Merge branch 'issue1251' into issue1243.
agarny Oct 21, 2024
fe0fb28
Merge branch 'issue1243' into issue1260.
agarny Oct 21, 2024
4c4842f
Some minor cleaning up.
agarny Oct 22, 2024
228e25a
Merge branch 'issue1243' into issue1260.
agarny Oct 22, 2024
94bc5fd
Merge branch 'issue1260' into issue1218.
agarny Oct 22, 2024
5ea2a61
Some minor cleaning up.
agarny Oct 22, 2024
6642a9d
Some minor cleaning up.
agarny Oct 22, 2024
4e8b0a2
Some minor cleaning up.
agarny Oct 22, 2024
f4bab76
Merge branch 'issue1260' into issue1218
agarny Oct 22, 2024
ee1e561
Some minor cleaning up.
agarny Oct 22, 2024
7c13a04
Moved areNearlyEqual() from utilties to commonutils.
agarny Oct 22, 2024
c029d7e
Analyser: account for the case where a piecewise statement doesn't ha…
agarny Oct 22, 2024
6b4889f
Debug: improved printAstAsTree().
agarny Oct 22, 2024
b61141d
Have our debug.* files formatted.
agarny Oct 22, 2024
26182a4
Test utils: some minor cleaning up.
agarny Oct 22, 2024
8308d8e
Moved parts of our Generator class to our new GeneratorInterpreter cl…
agarny Oct 22, 2024
becf20e
GeneratorProfile: slight math-related improvements.
agarny Oct 22, 2024
a7e4f62
Tests utils: some minor cleaning up.
agarny Oct 22, 2024
a143845
Tests: various minor improvements.
agarny Oct 22, 2024
5a3a19e
Tests: improved our coverage.
agarny Oct 22, 2024
8925f71
Merge branch 'issue1260' into issue1218
agarny Oct 22, 2024
6ad4fe3
Some minor cleaning up.
agarny Oct 22, 2024
96134b6
Merge branch 'main' into issue1218
agarny Oct 23, 2024
df6b096
Merge branch 'main' into issue1218
agarny Oct 26, 2024
358a07c
Merge branch 'main' into issue1218
agarny Oct 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Coverage tests: check the values we get from the interpreter.
Very important to make sure that we do indeed get the results we expect for all aspects of the interpreter.
  • Loading branch information
agarny committed Apr 24, 2024
commit 0e40acd358bb27fdd3ad4695a4e3874b755ebe6e
2 changes: 1 addition & 1 deletion src/generatorinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ std::tuple<std::string, InterpreterStatementPtr> GeneratorInterpreter::Generator
code = leftCode + generatePiecewiseElseCode(mProfile->nanString());
} else {
statement = leftStatement;
code = mProfile->nanString();
code = leftCode;
}
} else {
statement = InterpreterStatement::create(InterpreterStatement::Type::NAN);
Expand Down
48 changes: 32 additions & 16 deletions tests/coverage/coverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ limitations under the License.

#include <libcellml>

#include "libcellml/undefines.h"

/*
* The tests in this file are here to catch any branches of code that
* are not picked up by the main tests testing the API of the library
Expand Down Expand Up @@ -516,8 +518,8 @@ TEST(Coverage, generator)
EXPECT_EQ("dae", libcellml::AnalyserModel::typeAsString(analyserModel->type()));

EXPECT_EQ(size_t(1), analyserModel->stateCount());
EXPECT_EQ(size_t(212), analyserModel->variableCount());
EXPECT_EQ(size_t(206), analyserModel->equationCount());
EXPECT_EQ(size_t(220), analyserModel->variableCount());
EXPECT_EQ(size_t(214), analyserModel->equationCount());

EXPECT_NE(nullptr, analyserModel->voi());
EXPECT_EQ(size_t(0), analyserModel->voi()->equationCount());
Expand All @@ -530,19 +532,19 @@ TEST(Coverage, generator)
EXPECT_EQ(nullptr, analyserModel->state(analyserModel->stateCount()));
EXPECT_NE(nullptr, analyserModel->variable(0));
EXPECT_EQ(nullptr, analyserModel->variable(analyserModel->variableCount()));
EXPECT_NE(nullptr, analyserModel->equation(202));
EXPECT_NE(size_t(0), analyserModel->equation(202)->dependencyCount());
EXPECT_NE(size_t(0), analyserModel->equation(202)->dependencies().size());
EXPECT_NE(nullptr, analyserModel->equation(202)->dependency(0));
EXPECT_EQ(nullptr, analyserModel->equation(202)->dependency(analyserModel->equation(202)->dependencyCount()));
EXPECT_EQ(size_t(1), analyserModel->equation(202)->nlaSiblingCount());
EXPECT_EQ(size_t(1), analyserModel->equation(202)->nlaSiblings().size());
EXPECT_NE(nullptr, analyserModel->equation(202)->nlaSibling(0));
EXPECT_EQ(nullptr, analyserModel->equation(202)->nlaSibling(analyserModel->equation(202)->nlaSiblingCount()));
EXPECT_NE(size_t(0), analyserModel->equation(202)->variableCount());
EXPECT_NE(size_t(0), analyserModel->equation(202)->variables().size());
EXPECT_NE(nullptr, analyserModel->equation(202)->variable(0));
EXPECT_EQ(nullptr, analyserModel->equation(202)->variable(analyserModel->equation(202)->variableCount()));
EXPECT_NE(nullptr, analyserModel->equation(210));
EXPECT_NE(size_t(0), analyserModel->equation(210)->dependencyCount());
EXPECT_NE(size_t(0), analyserModel->equation(210)->dependencies().size());
EXPECT_NE(nullptr, analyserModel->equation(210)->dependency(0));
EXPECT_EQ(nullptr, analyserModel->equation(210)->dependency(analyserModel->equation(210)->dependencyCount()));
EXPECT_EQ(size_t(1), analyserModel->equation(210)->nlaSiblingCount());
EXPECT_EQ(size_t(1), analyserModel->equation(210)->nlaSiblings().size());
EXPECT_NE(nullptr, analyserModel->equation(210)->nlaSibling(0));
EXPECT_EQ(nullptr, analyserModel->equation(210)->nlaSibling(analyserModel->equation(210)->nlaSiblingCount()));
EXPECT_NE(size_t(0), analyserModel->equation(210)->variableCount());
EXPECT_NE(size_t(0), analyserModel->equation(210)->variables().size());
EXPECT_NE(nullptr, analyserModel->equation(210)->variable(0));
EXPECT_EQ(nullptr, analyserModel->equation(210)->variable(analyserModel->equation(210)->variableCount()));
EXPECT_EQ(nullptr, analyserModel->equation(analyserModel->equationCount()));

for (const auto &equation : analyserModel->equations()) {
Expand All @@ -558,7 +560,7 @@ TEST(Coverage, generator)
}

for (size_t i = 0; i < analyserModel->variableCount(); ++i) {
if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 182) || (i == 183) || (i == 185) || (i == 208) || (i == 209)) {
if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 183) || (i == 184) || (i == 187) || (i == 216) || (i == 217)) {
EXPECT_TRUE(analyserModel->variable(i)->initialisingVariable() != nullptr);
}
}
Expand Down Expand Up @@ -861,11 +863,25 @@ TEST(Coverage, interpreter)

EXPECT_EQ(analyserModel, interpreter->model());

static const auto INF = std::numeric_limits<double>::infinity();
static const auto NAN = std::numeric_limits<double>::quiet_NaN();
static const auto NAN_x_1 = std::vector<double>(1, NAN);
static const auto NAN_x_220 = std::vector<double>(220, NAN);

EXPECT_EQ(0.0, interpreter->voi());
EXPECT_EQ_VALUES(NAN_x_1, interpreter->states());
EXPECT_EQ_VALUES(NAN_x_1, interpreter->rates());
EXPECT_EQ_VALUES(NAN_x_220, interpreter->variables());

interpreter->initialiseVariables();
interpreter->computeComputedConstants();
interpreter->computeRates();
interpreter->computeVariables();

EXPECT_EQ_VALUES(std::vector<double>({0.0}), interpreter->states());
EXPECT_EQ_VALUES(std::vector<double>({1.0}), interpreter->rates());
EXPECT_EQ_VALUES(std::vector<double>({0.0, 1.0, 2.0, 1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 3.0, 6.0, 1.0, 1.0, -1.0, 1.0, -6.0, -2.0, 3.0, 7.0, -1.0, -1.0, 2.0, 6.0, 0.0, 0.0, 0.0, -0.0, -0.0, 7.0, 3.0, -1.0, -3.0, 0.5000000000000, 1.0, 3.0, 1.0, -1.0, -1.0, 0.1428571428571, 0.3333333333333, -1.0, -0.3333333333333, 0.0833333333333, 1.3333333333333, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 3.0, 1.0, -1.0, -1.0, 2.0, 0.5000000000000, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.7182818284590, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 3.0, 1.0, 0.8414709848079, 0.5403023058681, 1.5574077246549, 1.8508157176809, 1.1883951057781, 0.6420926159343, 1.1752011936438, 1.5430806348152, 0.7615941559558, 0.6480542736639, 0.8509181282393, 1.3130352854993, 1.5707963267949, 0.0, 0.7853981633974, 0.0, 1.5707963267949, 0.7853981633974, 0.8813735870195, 0.0, 0.5493061443341, 0.0, 0.8813735870195, 0.5493061443341, NAN, NAN, 1.0, 1.0, 3.0, NAN, 5.0, 6.0, 1.0, 7.0, 7.0, NAN, 124.0, 123.0, 123.4567890000000, 122999999999999992825511813039543286439366983265988099874998185415242667014177361275155540361558884352.0, 123456788999999994484262021807589179008641698391664322400772966218228802243136080981312758589637525504.0, 1.0, 1.0, 0.0, 2.7182818284590, 3.1415926535898, INF, NAN, NAN, 9.0, NAN, 1.0, NAN, 20.0, NAN, 1.2500000000000, 0.0, 1.0, 1.0, 1.0, 1.0, NAN, -3.0, 1.0, 2.0, 1.0, 3.0}), interpreter->variables());

interpreter->setModel(nullptr);

EXPECT_EQ(nullptr, interpreter->model());
Expand Down
Loading