diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py
index 54befa0120..0c6e4ec6c4 100644
--- a/tests/bindings/python/test_generator_profile.py
+++ b/tests/bindings/python/test_generator_profile.py
@@ -162,7 +162,7 @@ def test_acoth_function_string(self):
g = GeneratorProfile()
self.assertEqual(
- 'double acoth(double x)\n{\n double oneOverX = 1.0/x;\n\n return 0.5*log((1.0+oneOverX)/(1.0-oneOverX));\n}\n',
+ 'double acoth(double x)\n{\n return atanh(1.0/x);\n}\n',
g.acothFunctionString())
g.setAcothFunctionString(GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.acothFunctionString())
@@ -200,7 +200,7 @@ def test_acsch_function_string(self):
g = GeneratorProfile()
self.assertEqual(
- 'double acsch(double x)\n{\n double oneOverX = 1.0/x;\n\n return log(oneOverX+sqrt(oneOverX*oneOverX+1.0));\n}\n',
+ 'double acsch(double x)\n{\n return asinh(1.0/x);\n}\n',
g.acschFunctionString())
g.setAcschFunctionString(GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.acschFunctionString())
@@ -265,7 +265,7 @@ def test_asech_function_string(self):
g = GeneratorProfile()
self.assertEqual(
- 'double asech(double x)\n{\n double oneOverX = 1.0/x;\n\n return log(oneOverX+sqrt(oneOverX*oneOverX-1.0));\n}\n',
+ 'double asech(double x)\n{\n return acosh(1.0/x);\n}\n',
g.asechFunctionString())
g.setAsechFunctionString(GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.asechFunctionString())
@@ -1285,7 +1285,7 @@ def test_max_function_string(self):
g = GeneratorProfile()
- self.assertEqual('double max(double x, double y)\n{\n return (x > y)?x:y;\n}\n', g.maxFunctionString())
+ self.assertEqual('', g.maxFunctionString())
g.setMaxFunctionString(GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.maxFunctionString())
@@ -1294,7 +1294,7 @@ def test_max_string(self):
g = GeneratorProfile()
- self.assertEqual('max', g.maxString())
+ self.assertEqual('fmax', g.maxString())
g.setMaxString(GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.maxString())
@@ -1303,7 +1303,7 @@ def test_min_function_string(self):
g = GeneratorProfile()
- self.assertEqual('double min(double x, double y)\n{\n return (x < y)?x:y;\n}\n', g.minFunctionString())
+ self.assertEqual('', g.minFunctionString())
g.setMinFunctionString(GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.minFunctionString())
@@ -1312,7 +1312,7 @@ def test_min_string(self):
g = GeneratorProfile()
- self.assertEqual('min', g.minString())
+ self.assertEqual('fmin', g.minString())
g.setMinString(GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.minString())
diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp
index 4e71511c89..9cbbd6fe8d 100644
--- a/tests/coverage/coverage.cpp
+++ b/tests/coverage/coverage.cpp
@@ -597,10 +597,10 @@ TEST(Coverage, generator)
EXPECT_EQ(size_t(1), analyserModel->stateCount());
EXPECT_EQ(size_t(7), analyserModel->constantCount());
- EXPECT_EQ(size_t(199), analyserModel->computedConstantCount());
- EXPECT_EQ(size_t(2), analyserModel->algebraicCount());
+ EXPECT_EQ(size_t(207), analyserModel->computedConstantCount());
+ EXPECT_EQ(size_t(5), analyserModel->algebraicCount());
EXPECT_EQ(size_t(1), analyserModel->externalCount());
- EXPECT_EQ(size_t(203), analyserModel->equationCount());
+ EXPECT_EQ(size_t(214), analyserModel->equationCount());
EXPECT_NE(nullptr, analyserModel->voi());
EXPECT_EQ(size_t(0), analyserModel->voi()->equationCount());
@@ -627,6 +627,7 @@ TEST(Coverage, generator)
EXPECT_EQ(size_t(1), analyserModel->equation(0)->states().size());
EXPECT_NE(nullptr, analyserModel->equation(0)->state(0));
EXPECT_EQ(nullptr, analyserModel->equation(0)->state(analyserModel->equation(0)->stateCount()));
+ /*---GRY--- STILL NEEDED?
EXPECT_NE(nullptr, analyserModel->equation(199));
EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencyCount());
EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencies().size());
@@ -649,6 +650,7 @@ TEST(Coverage, generator)
EXPECT_EQ(nullptr, analyserModel->equation(199)->external(0));
EXPECT_EQ(nullptr, analyserModel->equation(199)->external(analyserModel->equation(199)->externalCount()));
EXPECT_EQ(nullptr, analyserModel->equation(analyserModel->equationCount()));
+ */
for (const auto &equation : analyserModel->equations()) {
checkAstTypeAsString(equation->ast());
@@ -666,9 +668,11 @@ TEST(Coverage, generator)
EXPECT_NE(nullptr, analyserModel->constant(i)->initialisingVariable());
}
+ /*---GRY--- STILL NEEDED?
for (size_t i = 0; i < analyserModel->algebraicCount(); ++i) {
EXPECT_NE(nullptr, analyserModel->algebraic(i)->initialisingVariable());
}
+ */
EXPECT_EQ(nullptr, generator->model());
EXPECT_EQ(EMPTY_STRING, generator->interfaceCode());
@@ -682,20 +686,14 @@ TEST(Coverage, generator)
auto profile = generator->profile();
- profile->setInterfaceCreateStatesArrayMethodString("double * createStatesVector();\n");
- profile->setImplementationCreateStatesArrayMethodString("double * createStatesVector()\n"
- "{\n"
- " double *res = (double *) malloc(STATE_COUNT*sizeof(double));\n"
- "\n"
- " for (size_t i = 0; i < STATE_COUNT; ++i) {\n"
- " res[i] = NAN;\n"
- " }\n"
- "\n"
- " return res;\n"
- "}\n");
-
- EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.modified.profile.h", generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.modified.profile.c", generator->implementationCode());
+ profile->setXorString("XOR");
+ profile->setXorFunctionString("double XOR(double x, double y)\n"
+ "{\n"
+ " return (x != 0.0) ^ (y != 0.0);\n"
+ "}\n");
+
+ EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.xor.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.xor.c", generator->implementationCode());
profile = libcellml::GeneratorProfile::create();
@@ -847,12 +845,13 @@ TEST(Coverage, generator)
EXPECT_EQ(EMPTY_STRING, generator->interfaceCode());
EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.py", generator->implementationCode());
- profile->setImplementationCreateStatesArrayMethodString("\n"
- "def create_states_vector():\n"
- " return [nan]*STATE_COUNT\n");
+ profile->setXorString("XOR_FUNC");
+ profile->setXorFunctionString("\n"
+ "def XOR_FUNC(x, y):\n"
+ " return 1.0 if bool(x) ^ bool(y) else 0.0\n");
EXPECT_EQ(EMPTY_STRING, generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.modified.profile.py", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.xor.py", generator->implementationCode());
// Coverage for the case where mProfile is equal to nullptr in Generator.
diff --git a/tests/generator/generator.cpp b/tests/generator/generator.cpp
index d84acefb86..fbf3c7b684 100644
--- a/tests/generator/generator.cpp
+++ b/tests/generator/generator.cpp
@@ -1203,7 +1203,7 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952)
TEST(Generator, hodgkinHuxleySquidAxonModel1952UnknownVarsOnRhs)
{
auto parser = libcellml::Parser::create();
- auto model = parser->parseModel(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model_unknown_vars_on_rhs.cellml"));
+ auto model = parser->parseModel(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.unknown.vars.on.rhs.cellml"));
EXPECT_EQ(size_t(0), parser->issueCount());
@@ -1253,16 +1253,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariableAsExternalVariab
auto profile = generator->profile();
- profile->setInterfaceFileNameString("model.state.h");
+ profile->setInterfaceFileNameString("model.state.external.h");
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.h", generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.c", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.c", generator->implementationCode());
profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON);
generator->setProfile(profile);
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.py", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.py", generator->implementationCode());
}
TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariablesAsExternalVariablesIncludingOneDependingOnTheOther)
@@ -1297,16 +1297,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariablesAsExternalVaria
auto profile = generator->profile();
- profile->setInterfaceFileNameString("model.dependent.state.h");
+ profile->setInterfaceFileNameString("model.dependent.state.external.h");
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h", generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.c", generator->implementationCode());
profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON);
generator->setProfile(profile);
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.py", generator->implementationCode());
}
TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantAsExternalVariable)
@@ -1334,16 +1334,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantAsExternalVariable)
auto profile = generator->profile();
- profile->setInterfaceFileNameString("model.constant.h");
+ profile->setInterfaceFileNameString("model.constant.external.h");
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h", generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.c", generator->implementationCode());
profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON);
generator->setProfile(profile);
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.py", generator->implementationCode());
}
TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantsAsExternalVariablesIncludingOneDependingOnTheOther)
@@ -1377,16 +1377,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantsAsExternalVariablesI
auto profile = generator->profile();
- profile->setInterfaceFileNameString("model.dependent.constant.h");
+ profile->setInterfaceFileNameString("model.dependent.constant.external.h");
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h", generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.c", generator->implementationCode());
profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON);
generator->setProfile(profile);
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.py", generator->implementationCode());
}
TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantAsExternalVariable)
@@ -1414,16 +1414,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantAsExternalVar
auto profile = generator->profile();
- profile->setInterfaceFileNameString("model.computed.constant.h");
+ profile->setInterfaceFileNameString("model.computed.constant.external.h");
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h", generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.c", generator->implementationCode());
profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON);
generator->setProfile(profile);
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.py", generator->implementationCode());
}
TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantsAsExternalVariablesIncludingOneDependingOnTheOther)
@@ -1457,16 +1457,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantsAsExternalVa
auto profile = generator->profile();
- profile->setInterfaceFileNameString("model.dependent.computed.constant.h");
+ profile->setInterfaceFileNameString("model.dependent.computed.constant.external.h");
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h", generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.c", generator->implementationCode());
profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON);
generator->setProfile(profile);
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.py", generator->implementationCode());
}
TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariableAsExternalVariable)
@@ -1494,16 +1494,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariableAsExternalVa
auto profile = generator->profile();
- profile->setInterfaceFileNameString("model.algebraic.h");
+ profile->setInterfaceFileNameString("model.algebraic.external.h");
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h", generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.c", generator->implementationCode());
profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON);
generator->setProfile(profile);
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.py", generator->implementationCode());
}
TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariablesAsExternalVariablesIncludingOneDependingOnTheOther)
@@ -1537,16 +1537,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariablesAsExternalV
auto profile = generator->profile();
- profile->setInterfaceFileNameString("model.dependent.algebraic.h");
+ profile->setInterfaceFileNameString("model.dependent.algebraic.external.h");
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h", generator->interfaceCode());
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.c", generator->implementationCode());
profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON);
generator->setProfile(profile);
- EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py", generator->implementationCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.py", generator->implementationCode());
}
TEST(Generator, hodgkinHuxleySquidAxonModel1952WithVariousExternalVariables)
@@ -1972,6 +1972,9 @@ TEST(Generator, modelWithComplexUnitsOutOfScope)
generator->setModel(analyserModel);
+ EXPECT_EQ_FILE_CONTENTS("generator/cellml_slc_example/model.h", generator->interfaceCode());
+ EXPECT_EQ_FILE_CONTENTS("generator/cellml_slc_example/model.c", generator->implementationCode());
+
auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON);
generator->setProfile(profile);
diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp
index 1b8071fbf8..4339294f9e 100644
--- a/tests/generator/generatorprofile.cpp
+++ b/tests/generator/generatorprofile.cpp
@@ -88,8 +88,8 @@ TEST(GeneratorProfile, defaultArithmeticOperatorValues)
EXPECT_EQ("log10", generatorProfile->commonLogarithmString());
EXPECT_EQ("ceil", generatorProfile->ceilingString());
EXPECT_EQ("floor", generatorProfile->floorString());
- EXPECT_EQ("min", generatorProfile->minString());
- EXPECT_EQ("max", generatorProfile->maxString());
+ EXPECT_EQ("fmin", generatorProfile->minString());
+ EXPECT_EQ("fmax", generatorProfile->maxString());
EXPECT_EQ("fmod", generatorProfile->remString());
EXPECT_EQ(false, generatorProfile->hasPowerOperator());
@@ -167,16 +167,8 @@ TEST(GeneratorProfile, defaultArithmeticFunctionValues)
"}\n",
generatorProfile->xorFunctionString());
EXPECT_EQ("", generatorProfile->notFunctionString());
- EXPECT_EQ("double min(double x, double y)\n"
- "{\n"
- " return (x < y)?x:y;\n"
- "}\n",
- generatorProfile->minFunctionString());
- EXPECT_EQ("double max(double x, double y)\n"
- "{\n"
- " return (x > y)?x:y;\n"
- "}\n",
- generatorProfile->maxFunctionString());
+ EXPECT_EQ("", generatorProfile->minFunctionString());
+ EXPECT_EQ("", generatorProfile->maxFunctionString());
}
TEST(GeneratorProfile, defaultTrigonometricFunctionValues)
@@ -230,23 +222,17 @@ TEST(GeneratorProfile, defaultTrigonometricFunctionValues)
generatorProfile->acotFunctionString());
EXPECT_EQ("double asech(double x)\n"
"{\n"
- " double oneOverX = 1.0/x;\n"
- "\n"
- " return log(oneOverX+sqrt(oneOverX*oneOverX-1.0));\n"
+ " return acosh(1.0/x);\n"
"}\n",
generatorProfile->asechFunctionString());
EXPECT_EQ("double acsch(double x)\n"
"{\n"
- " double oneOverX = 1.0/x;\n"
- "\n"
- " return log(oneOverX+sqrt(oneOverX*oneOverX+1.0));\n"
+ " return asinh(1.0/x);\n"
"}\n",
generatorProfile->acschFunctionString());
EXPECT_EQ("double acoth(double x)\n"
"{\n"
- " double oneOverX = 1.0/x;\n"
- "\n"
- " return 0.5*log((1.0+oneOverX)/(1.0-oneOverX));\n"
+ " return atanh(1.0/x);\n"
"}\n",
generatorProfile->acothFunctionString());
}
diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c
index b168f71788..dfefa277a5 100644
--- a/tests/resources/coverage/generator/model.c
+++ b/tests/resources/coverage/generator/model.c
@@ -10,8 +10,8 @@ const char LIBCELLML_VERSION[] = "0.6.0";
const size_t STATE_COUNT = 1;
const size_t CONSTANT_COUNT = 7;
-const size_t COMPUTED_CONSTANT_COUNT = 199;
-const size_t ALGEBRAIC_COUNT = 2;
+const size_t COMPUTED_CONSTANT_COUNT = 207;
+const size_t ALGEBRAIC_COUNT = 5;
const size_t EXTERNAL_COUNT = 1;
const VariableInfo VOI_INFO = {"t", "second", "my_component"};
@@ -59,8 +59,6 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = {
{"eqnAndParenthesesRightPower", "dimensionless", "my_component"},
{"eqnAndParenthesesRightRoot", "dimensionless", "my_component"},
{"eqnAndCoverageParentheses", "dimensionless", "my_component"},
- {"eqnOr", "dimensionless", "my_component"},
- {"eqnOrMultiple", "dimensionless", "my_component"},
{"eqnOrParentheses", "dimensionless", "my_component"},
{"eqnOrParenthesesLeftPlusWith", "dimensionless", "my_component"},
{"eqnOrParenthesesLeftPlusWithout", "dimensionless", "my_component"},
@@ -90,7 +88,6 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = {
{"eqnXorParenthesesRightMinusWithout", "dimensionless", "my_component"},
{"eqnXorParenthesesRightPower", "dimensionless", "my_component"},
{"eqnXorParenthesesRightRoot", "dimensionless", "my_component"},
- {"eqnXorCoverageParentheses", "dimensionless", "my_component"},
{"eqnNot", "dimensionless", "my_component"},
{"eqnPlusMultiple", "dimensionless", "my_component"},
{"eqnPlusParentheses", "dimensionless", "my_component"},
@@ -147,6 +144,7 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = {
{"eqnPowerParenthesesRightRoot", "dimensionless", "my_component"},
{"eqnRootSqrt", "dimensionless", "my_component"},
{"eqnRootSqrtOther", "dimensionless", "my_component"},
+ {"eqnRootSqr", "dimensionless", "my_component"},
{"eqnRootCube", "dimensionless", "my_component"},
{"eqnRootCi", "dimensionless", "my_component"},
{"eqnRootParentheses", "dimensionless", "my_component"},
@@ -202,11 +200,16 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = {
{"eqnArcsech", "dimensionless", "my_component"},
{"eqnArccsch", "dimensionless", "my_component"},
{"eqnArccoth", "dimensionless", "my_component"},
+ {"eqnPiecewise", "dimensionless", "my_component"},
{"eqnPiecewisePiece", "dimensionless", "my_component"},
+ {"eqnPiecewisePiece2", "dimensionless", "my_component"},
+ {"eqnPiecewiseOtherwise", "dimensionless", "my_component"},
{"eqnPiecewisePieceOtherwise", "dimensionless", "my_component"},
{"eqnPiecewisePiecePiecePiece", "dimensionless", "my_component"},
+ {"eqnPiecewisePiecePiecePiece2", "dimensionless", "my_component"},
{"eqnPiecewisePiecePiecePieceOtherwise", "dimensionless", "my_component"},
{"eqnWithPiecewise", "dimensionless", "my_component"},
+ {"eqnWithPiecewise2", "dimensionless", "my_component"},
{"eqnCnInteger", "dimensionless", "my_component"},
{"eqnCnDouble", "dimensionless", "my_component"},
{"eqnCnIntegerWithExponent", "dimensionless", "my_component"},
@@ -219,20 +222,28 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = {
{"eqnInfinity", "dimensionless", "my_component"},
{"eqnNotanumber", "dimensionless", "my_component"},
{"eqnCoverageForPlusOperator", "dimensionless", "my_component"},
+ {"eqnCoverageForPlusOperator2", "dimensionless", "my_component"},
{"eqnCoverageForMinusOperator", "dimensionless", "my_component"},
+ {"eqnCoverageForMinusOperator2", "dimensionless", "my_component"},
{"eqnCoverageForTimesOperator", "dimensionless", "my_component"},
+ {"eqnCoverageForTimesOperator2", "dimensionless", "my_component"},
{"eqnCoverageForDivideOperator", "dimensionless", "my_component"},
+ {"eqnCoverageForDivideOperator2", "dimensionless", "my_component"},
{"eqnCoverageForAndOperator", "dimensionless", "my_component"},
{"eqnCoverageForOrOperator", "dimensionless", "my_component"},
{"eqnCoverageForXorOperator", "dimensionless", "my_component"},
{"eqnCoverageForPowerOperator", "dimensionless", "my_component"},
{"eqnCoverageForRootOperator", "dimensionless", "my_component"},
{"eqnCoverageForMinusUnary", "dimensionless", "my_component"},
+ {"eqnCoverageForMinusUnary2", "dimensionless", "my_component"},
{"eqnComputedConstant1", "dimensionless", "my_component"},
{"eqnComputedConstant2", "dimensionless", "my_component"}
};
const VariableInfo ALGEBRAIC_INFO[] = {
+ {"eqnOr", "dimensionless", "my_component"},
+ {"eqnOrMultiple", "dimensionless", "my_component"},
+ {"eqnXorCoverageParentheses", "dimensionless", "my_component"},
{"eqnNlaVariable1", "dimensionless", "my_component"},
{"eqnNlaVariable2", "dimensionless", "my_component"}
};
@@ -246,16 +257,6 @@ double xor(double x, double y)
return (x != 0.0) ^ (y != 0.0);
}
-double min(double x, double y)
-{
- return (x < y)?x:y;
-}
-
-double max(double x, double y)
-{
- return (x > y)?x:y;
-}
-
double sec(double x)
{
return 1.0/cos(x);
@@ -303,23 +304,17 @@ double acot(double x)
double asech(double x)
{
- double oneOverX = 1.0/x;
-
- return log(oneOverX+sqrt(oneOverX*oneOverX-1.0));
+ return acosh(1.0/x);
}
double acsch(double x)
{
- double oneOverX = 1.0/x;
-
- return log(oneOverX+sqrt(oneOverX*oneOverX+1.0));
+ return asinh(1.0/x);
}
double acoth(double x)
{
- double oneOverX = 1.0/x;
-
- return 0.5*log((1.0+oneOverX)/(1.0-oneOverX));
+ return atanh(1.0/x);
}
double * createStatesArray()
@@ -405,11 +400,11 @@ void objectiveFunction0(double *u, double *f, void *data)
double *algebraic = ((RootFindingInfo *) data)->algebraic;
double *externals = ((RootFindingInfo *) data)->externals;
- algebraic[0] = u[0];
- algebraic[1] = u[1];
+ algebraic[3] = u[0];
+ algebraic[4] = u[1];
- f[0] = algebraic[0]+algebraic[1]+states[0]-0.0;
- f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]);
+ f[0] = algebraic[3]+algebraic[4]+states[0]-0.0;
+ f[1] = algebraic[3]-algebraic[4]-(computedConstants[205]+computedConstants[206]);
}
void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals)
@@ -417,13 +412,13 @@ void findRoot0(double voi, double *states, double *rates, double *constants, dou
RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals };
double u[2];
- u[0] = algebraic[0];
- u[1] = algebraic[1];
+ u[0] = algebraic[3];
+ u[1] = algebraic[4];
nlaSolve(objectiveFunction0, u, 2, &rfi);
- algebraic[0] = u[0];
- algebraic[1] = u[1];
+ algebraic[3] = u[0];
+ algebraic[4] = u[1];
}
void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)
@@ -436,20 +431,21 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl
constants[4] = 5.0;
constants[5] = 6.0;
constants[6] = 7.0;
- computedConstants[176] = 123.0;
- computedConstants[177] = 123.456789;
- computedConstants[178] = 123.0e99;
- computedConstants[179] = 123.456789e99;
- computedConstants[181] = 1.0;
- computedConstants[182] = 0.0;
- computedConstants[183] = 2.71828182845905;
- computedConstants[184] = 3.14159265358979;
- computedConstants[185] = INFINITY;
- computedConstants[186] = NAN;
- computedConstants[197] = 1.0;
- computedConstants[198] = 3.0;
- algebraic[0] = 1.0;
- algebraic[1] = 2.0;
+ computedConstants[169] = NAN;
+ computedConstants[179] = 123.0;
+ computedConstants[180] = 123.456789;
+ computedConstants[181] = 123.0e99;
+ computedConstants[182] = 123.456789e99;
+ computedConstants[184] = 1.0;
+ computedConstants[185] = 0.0;
+ computedConstants[186] = 2.71828182845905;
+ computedConstants[187] = 3.14159265358979;
+ computedConstants[188] = INFINITY;
+ computedConstants[189] = NAN;
+ computedConstants[205] = 1.0;
+ computedConstants[206] = 3.0;
+ algebraic[3] = 1.0;
+ algebraic[4] = 2.0;
}
void computeComputedConstants(double *constants, double *computedConstants)
@@ -463,9 +459,9 @@ void computeComputedConstants(double *constants, double *computedConstants)
computedConstants[6] = constants[0] <= constants[1];
computedConstants[7] = constants[0]/(constants[1] <= constants[2]);
computedConstants[8] = constants[0] > constants[1];
- computedConstants[9] = constants[0]/(constants[1] > constants[2]);
+ computedConstants[9] = constants[0]/(constants[2] > constants[1]);
computedConstants[10] = constants[0] >= constants[1];
- computedConstants[11] = constants[0]/(constants[1] >= constants[2]);
+ computedConstants[11] = constants[0]/(constants[2] >= constants[1]);
computedConstants[12] = constants[0] && constants[1];
computedConstants[13] = constants[0] && constants[1] && constants[2];
computedConstants[14] = (constants[0] < constants[1]) && (constants[2] > constants[3]);
@@ -482,165 +478,172 @@ void computeComputedConstants(double *constants, double *computedConstants)
computedConstants[25] = (constants[0] < constants[1]) && pow(constants[2], constants[3]);
computedConstants[26] = (constants[0] < constants[1]) && pow(constants[2], 1.0/constants[3]);
computedConstants[27] = constants[0]/(constants[1] && constants[2]);
- computedConstants[28] = constants[0] || constants[1];
- computedConstants[29] = constants[0] || constants[1] || constants[2];
- computedConstants[30] = (constants[0] < constants[1]) || (constants[2] > constants[3]);
- computedConstants[31] = (constants[0]+constants[1]) || (constants[2] > constants[3]);
- computedConstants[32] = constants[0] || (constants[1] > constants[2]);
- computedConstants[33] = (constants[0]-constants[1]) || (constants[2] > constants[3]);
- computedConstants[34] = -constants[0] || (constants[1] > constants[2]);
- computedConstants[35] = pow(constants[0], constants[1]) || (constants[2] > constants[3]);
- computedConstants[36] = pow(constants[0], 1.0/constants[1]) || (constants[2] > constants[3]);
- computedConstants[37] = (constants[0] < constants[1]) || (constants[2]+constants[3]);
- computedConstants[38] = (constants[0] < constants[1]) || constants[2];
- computedConstants[39] = (constants[0] < constants[1]) || (constants[2]-constants[3]);
- computedConstants[40] = (constants[0] < constants[1]) || -constants[2];
- computedConstants[41] = (constants[0] < constants[1]) || pow(constants[2], constants[3]);
- computedConstants[42] = (constants[0] < constants[1]) || pow(constants[2], 1.0/constants[3]);
- computedConstants[43] = constants[0]/(constants[1] || constants[2]);
- computedConstants[44] = xor(constants[0], constants[1]);
- computedConstants[45] = xor(constants[0], xor(constants[1], constants[2]));
- computedConstants[46] = xor(constants[0] < constants[1], constants[2] > constants[3]);
- computedConstants[47] = xor(constants[0]+constants[1], constants[2] > constants[3]);
- computedConstants[48] = xor(constants[0], constants[1] > constants[2]);
- computedConstants[49] = xor(constants[0]-constants[1], constants[2] > constants[3]);
- computedConstants[50] = xor(-constants[0], constants[1] > constants[2]);
- computedConstants[51] = xor(pow(constants[0], constants[1]), constants[2] > constants[3]);
- computedConstants[52] = xor(pow(constants[0], 1.0/constants[1]), constants[2] > constants[3]);
- computedConstants[53] = xor(constants[0] < constants[1], constants[2]+constants[3]);
- computedConstants[54] = xor(constants[0] < constants[1], constants[2]);
- computedConstants[55] = xor(constants[0] < constants[1], constants[2]-constants[3]);
- computedConstants[56] = xor(constants[0] < constants[1], -constants[2]);
- computedConstants[57] = xor(constants[0] < constants[1], pow(constants[2], constants[3]));
- computedConstants[58] = xor(constants[0] < constants[1], pow(constants[2], 1.0/constants[3]));
- computedConstants[59] = constants[0]/xor(constants[1], constants[2]);
- computedConstants[60] = !constants[0];
- computedConstants[61] = constants[0]+constants[1]+constants[2];
- computedConstants[62] = (constants[0] < constants[1])+(constants[2] > constants[3]);
- computedConstants[63] = constants[0];
- computedConstants[64] = constants[0]-constants[1];
- computedConstants[65] = (constants[0] < constants[1])-(constants[2] > constants[3]);
- computedConstants[66] = (constants[0] < constants[1])-(constants[2]+constants[3]);
- computedConstants[67] = (constants[0] < constants[1])-constants[2];
- computedConstants[68] = constants[0]-(-constants[1]);
- computedConstants[69] = constants[0]-(-constants[1]*constants[2]);
- computedConstants[70] = -constants[0];
- computedConstants[71] = -(constants[0] < constants[1]);
- computedConstants[72] = constants[0]*constants[1];
- computedConstants[73] = constants[0]*constants[1]*constants[2];
- computedConstants[74] = (constants[0] < constants[1])*(constants[2] > constants[3]);
- computedConstants[75] = (constants[0]+constants[1])*(constants[2] > constants[3]);
- computedConstants[76] = constants[0]*(constants[1] > constants[2]);
- computedConstants[77] = (constants[0]-constants[1])*(constants[2] > constants[3]);
- computedConstants[78] = -constants[0]*(constants[1] > constants[2]);
- computedConstants[79] = (constants[0] < constants[1])*(constants[2]+constants[3]);
- computedConstants[80] = (constants[0] < constants[1])*constants[2];
- computedConstants[81] = (constants[0] < constants[1])*(constants[2]-constants[3]);
- computedConstants[82] = (constants[0] < constants[1])*-constants[2];
- computedConstants[83] = constants[0]/constants[1];
- computedConstants[84] = (constants[0] < constants[1])/(constants[3] > constants[2]);
- computedConstants[85] = (constants[0]+constants[1])/(constants[3] > constants[2]);
- computedConstants[86] = constants[0]/(constants[2] > constants[1]);
- computedConstants[87] = (constants[0]-constants[1])/(constants[3] > constants[2]);
- computedConstants[88] = -constants[0]/(constants[2] > constants[1]);
- computedConstants[89] = (constants[0] < constants[1])/(constants[2]+constants[3]);
- computedConstants[90] = (constants[0] < constants[1])/constants[2];
- computedConstants[91] = (constants[0] < constants[1])/(constants[2]-constants[3]);
- computedConstants[92] = (constants[0] < constants[1])/-constants[2];
- computedConstants[93] = (constants[0] < constants[1])/(constants[2]*constants[3]);
- computedConstants[94] = (constants[0] < constants[1])/(constants[2]/constants[3]);
- computedConstants[95] = sqrt(constants[0]);
- computedConstants[96] = pow(constants[0], 2.0);
- computedConstants[97] = pow(constants[0], 3.0);
- computedConstants[98] = pow(constants[0], constants[1]);
- computedConstants[99] = pow(constants[0] <= constants[1], constants[2] >= constants[3]);
- computedConstants[100] = pow(constants[0]+constants[1], constants[2] >= constants[3]);
- computedConstants[101] = pow(constants[0], constants[1] >= constants[2]);
- computedConstants[102] = pow(constants[0]-constants[1], constants[2] >= constants[3]);
- computedConstants[103] = pow(-constants[0], constants[1] >= constants[2]);
- computedConstants[104] = pow(constants[0]*constants[1], constants[2] >= constants[3]);
- computedConstants[105] = pow(constants[0]/constants[1], constants[2] >= constants[3]);
- computedConstants[106] = pow(constants[0] <= constants[1], constants[2]+constants[3]);
- computedConstants[107] = pow(constants[0] <= constants[1], constants[2]);
- computedConstants[108] = pow(constants[0] <= constants[1], constants[2]-constants[3]);
- computedConstants[109] = pow(constants[0] <= constants[1], -constants[2]);
- computedConstants[110] = pow(constants[0] <= constants[1], constants[2]*constants[3]);
- computedConstants[111] = pow(constants[0] <= constants[1], constants[2]/constants[3]);
- computedConstants[112] = pow(constants[0] <= constants[1], pow(constants[2], constants[3]));
- computedConstants[113] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3]));
- computedConstants[114] = sqrt(constants[0]);
- computedConstants[115] = sqrt(constants[0]);
- computedConstants[116] = pow(constants[0], 1.0/3.0);
- computedConstants[117] = pow(constants[0], 1.0/constants[1]);
- computedConstants[118] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2]));
- computedConstants[119] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2]));
- computedConstants[120] = pow(constants[0], 1.0/(constants[2] > constants[1]));
- computedConstants[121] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2]));
- computedConstants[122] = pow(-constants[0], 1.0/(constants[2] > constants[1]));
- computedConstants[123] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2]));
- computedConstants[124] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2]));
- computedConstants[125] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3]));
- computedConstants[126] = pow(constants[0] < constants[1], 1.0/constants[2]);
- computedConstants[127] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3]));
- computedConstants[128] = pow(constants[0] < constants[1], 1.0/-constants[2]);
- computedConstants[129] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3]));
- computedConstants[130] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3]));
- computedConstants[131] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3]));
- computedConstants[132] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3]));
- computedConstants[133] = fabs(constants[0]);
- computedConstants[134] = exp(constants[0]);
- computedConstants[135] = log(constants[0]);
+ computedConstants[28] = (constants[0] < constants[1]) || (constants[2] > constants[3]);
+ computedConstants[29] = (constants[0]+constants[1]) || (constants[2] > constants[3]);
+ computedConstants[30] = constants[0] || (constants[1] > constants[2]);
+ computedConstants[31] = (constants[0]-constants[1]) || (constants[2] > constants[3]);
+ computedConstants[32] = -constants[0] || (constants[1] > constants[2]);
+ computedConstants[33] = pow(constants[0], constants[1]) || (constants[2] > constants[3]);
+ computedConstants[34] = pow(constants[0], 1.0/constants[1]) || (constants[2] > constants[3]);
+ computedConstants[35] = (constants[0] < constants[1]) || (constants[2]+constants[3]);
+ computedConstants[36] = (constants[0] < constants[1]) || constants[2];
+ computedConstants[37] = (constants[0] < constants[1]) || (constants[2]-constants[3]);
+ computedConstants[38] = (constants[0] < constants[1]) || -constants[2];
+ computedConstants[39] = (constants[0] < constants[1]) || pow(constants[2], constants[3]);
+ computedConstants[40] = (constants[0] < constants[1]) || pow(constants[2], 1.0/constants[3]);
+ computedConstants[41] = constants[0]/(constants[1] || constants[2]);
+ computedConstants[42] = xor(constants[0], constants[1]);
+ computedConstants[43] = xor(constants[0], xor(constants[1], constants[2]));
+ computedConstants[44] = xor(constants[0] < constants[1], constants[2] > constants[3]);
+ computedConstants[45] = xor(constants[0]+constants[1], constants[2] > constants[3]);
+ computedConstants[46] = xor(constants[0], constants[1] > constants[2]);
+ computedConstants[47] = xor(constants[0]-constants[1], constants[2] > constants[3]);
+ computedConstants[48] = xor(-constants[0], constants[1] > constants[2]);
+ computedConstants[49] = xor(pow(constants[0], constants[1]), constants[2] > constants[3]);
+ computedConstants[50] = xor(pow(constants[0], 1.0/constants[1]), constants[2] > constants[3]);
+ computedConstants[51] = xor(constants[0] < constants[1], constants[2]+constants[3]);
+ computedConstants[52] = xor(constants[0] < constants[1], constants[2]);
+ computedConstants[53] = xor(constants[0] < constants[1], constants[2]-constants[3]);
+ computedConstants[54] = xor(constants[0] < constants[1], -constants[2]);
+ computedConstants[55] = xor(constants[0] < constants[1], pow(constants[2], constants[3]));
+ computedConstants[56] = xor(constants[0] < constants[1], pow(constants[2], 1.0/constants[3]));
+ computedConstants[57] = !constants[0];
+ computedConstants[58] = constants[0]+constants[1]+constants[2];
+ computedConstants[59] = (constants[0] < constants[1])+(constants[2] > constants[3]);
+ computedConstants[60] = constants[0];
+ computedConstants[61] = constants[0]-constants[1];
+ computedConstants[62] = (constants[0] < constants[1])-(constants[2] > constants[3]);
+ computedConstants[63] = (constants[0] < constants[1])-(constants[2]+constants[3]);
+ computedConstants[64] = (constants[0] < constants[1])-constants[2];
+ computedConstants[65] = constants[0]-(-constants[1]);
+ computedConstants[66] = constants[0]-(-constants[1]*constants[2]);
+ computedConstants[67] = -constants[0];
+ computedConstants[68] = -(constants[0] < constants[1]);
+ computedConstants[69] = constants[0]*constants[1];
+ computedConstants[70] = constants[0]*constants[1]*constants[2];
+ computedConstants[71] = (constants[0] < constants[1])*(constants[2] > constants[3]);
+ computedConstants[72] = (constants[0]+constants[1])*(constants[2] > constants[3]);
+ computedConstants[73] = constants[0]*(constants[1] > constants[2]);
+ computedConstants[74] = (constants[0]-constants[1])*(constants[2] > constants[3]);
+ computedConstants[75] = -constants[0]*(constants[1] > constants[2]);
+ computedConstants[76] = (constants[0] < constants[1])*(constants[2]+constants[3]);
+ computedConstants[77] = (constants[0] < constants[1])*constants[2];
+ computedConstants[78] = (constants[0] < constants[1])*(constants[2]-constants[3]);
+ computedConstants[79] = (constants[0] < constants[1])*-constants[2];
+ computedConstants[80] = constants[0]/constants[1];
+ computedConstants[81] = (constants[0] < constants[1])/(constants[3] > constants[2]);
+ computedConstants[82] = (constants[0]+constants[1])/(constants[3] > constants[2]);
+ computedConstants[83] = constants[0]/(constants[2] > constants[1]);
+ computedConstants[84] = (constants[0]-constants[1])/(constants[3] > constants[2]);
+ computedConstants[85] = -constants[0]/(constants[2] > constants[1]);
+ computedConstants[86] = (constants[0] < constants[1])/(constants[2]+constants[3]);
+ computedConstants[87] = (constants[0] < constants[1])/constants[2];
+ computedConstants[88] = (constants[0] < constants[1])/(constants[2]-constants[3]);
+ computedConstants[89] = (constants[0] < constants[1])/-constants[2];
+ computedConstants[90] = (constants[0] < constants[1])/(constants[2]*constants[3]);
+ computedConstants[91] = (constants[0] < constants[1])/(constants[2]/constants[3]);
+ computedConstants[92] = sqrt(constants[0]);
+ computedConstants[93] = pow(constants[0], 2.0);
+ computedConstants[94] = pow(constants[0], 3.0);
+ computedConstants[95] = pow(constants[0], constants[1]);
+ computedConstants[96] = pow(constants[0] <= constants[1], constants[2] >= constants[3]);
+ computedConstants[97] = pow(constants[0]+constants[1], constants[2] >= constants[3]);
+ computedConstants[98] = pow(constants[0], constants[1] >= constants[2]);
+ computedConstants[99] = pow(constants[0]-constants[1], constants[2] >= constants[3]);
+ computedConstants[100] = pow(-constants[0], constants[1] >= constants[2]);
+ computedConstants[101] = pow(constants[0]*constants[1], constants[2] >= constants[3]);
+ computedConstants[102] = pow(constants[0]/constants[1], constants[2] >= constants[3]);
+ computedConstants[103] = pow(constants[0] <= constants[1], constants[2]+constants[3]);
+ computedConstants[104] = pow(constants[0] <= constants[1], constants[2]);
+ computedConstants[105] = pow(constants[0] <= constants[1], constants[2]-constants[3]);
+ computedConstants[106] = pow(constants[0] <= constants[1], -constants[2]);
+ computedConstants[107] = pow(constants[0] <= constants[1], constants[2]*constants[3]);
+ computedConstants[108] = pow(constants[0] <= constants[1], constants[2]/constants[3]);
+ computedConstants[109] = pow(constants[0] <= constants[1], pow(constants[2], constants[3]));
+ computedConstants[110] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3]));
+ computedConstants[111] = sqrt(constants[0]);
+ computedConstants[112] = sqrt(constants[0]);
+ computedConstants[113] = pow(constants[0], 1.0/0.5);
+ computedConstants[114] = pow(constants[0], 1.0/3.0);
+ computedConstants[115] = pow(constants[0], 1.0/constants[1]);
+ computedConstants[116] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2]));
+ computedConstants[117] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2]));
+ computedConstants[118] = pow(constants[0], 1.0/(constants[2] > constants[1]));
+ computedConstants[119] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2]));
+ computedConstants[120] = pow(-constants[0], 1.0/(constants[2] > constants[1]));
+ computedConstants[121] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2]));
+ computedConstants[122] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2]));
+ computedConstants[123] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3]));
+ computedConstants[124] = pow(constants[0] < constants[1], 1.0/constants[2]);
+ computedConstants[125] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3]));
+ computedConstants[126] = pow(constants[0] < constants[1], 1.0/-constants[2]);
+ computedConstants[127] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3]));
+ computedConstants[128] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3]));
+ computedConstants[129] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3]));
+ computedConstants[130] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3]));
+ computedConstants[131] = fabs(constants[0]);
+ computedConstants[132] = exp(constants[0]);
+ computedConstants[133] = log(constants[0]);
+ computedConstants[134] = log10(constants[0]);
+ computedConstants[135] = log(constants[0])/log(2.0);
computedConstants[136] = log10(constants[0]);
- computedConstants[137] = log(constants[0])/log(2.0);
- computedConstants[138] = log10(constants[0]);
- computedConstants[139] = log(constants[0])/log(constants[1]);
- computedConstants[140] = ceil(constants[0]);
- computedConstants[141] = floor(constants[0]);
- computedConstants[142] = min(constants[0], constants[1]);
- computedConstants[143] = min(constants[0], min(constants[1], constants[2]));
- computedConstants[144] = max(constants[0], constants[1]);
- computedConstants[145] = max(constants[0], max(constants[1], constants[2]));
- computedConstants[146] = fmod(constants[0], constants[1]);
- computedConstants[147] = sin(constants[0]);
- computedConstants[148] = cos(constants[0]);
- computedConstants[149] = tan(constants[0]);
- computedConstants[150] = sec(constants[0]);
- computedConstants[151] = csc(constants[0]);
- computedConstants[152] = cot(constants[0]);
- computedConstants[153] = sinh(constants[0]);
- computedConstants[154] = cosh(constants[0]);
- computedConstants[155] = tanh(constants[0]);
- computedConstants[156] = sech(constants[0]);
- computedConstants[157] = csch(constants[0]);
- computedConstants[158] = coth(constants[0]);
- computedConstants[159] = asin(constants[0]);
- computedConstants[160] = acos(constants[0]);
- computedConstants[161] = atan(constants[0]);
- computedConstants[162] = asec(constants[0]);
- computedConstants[163] = acsc(constants[0]);
- computedConstants[164] = acot(constants[0]);
- computedConstants[165] = asinh(constants[0]);
- computedConstants[166] = acosh(constants[0]);
- computedConstants[167] = atanh(constants[0]/2.0);
- computedConstants[168] = asech(constants[0]);
- computedConstants[169] = acsch(constants[0]);
- computedConstants[170] = acoth(2.0*constants[0]);
- computedConstants[171] = (constants[0] > constants[1])?constants[0]:NAN;
- computedConstants[172] = (constants[0] > constants[1])?constants[0]:constants[2];
- computedConstants[173] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN;
- computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6];
- computedConstants[175] = 123.0+((constants[0] > constants[1])?constants[0]:NAN);
- computedConstants[180] = constants[0];
- computedConstants[187] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]);
- computedConstants[188] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]);
- computedConstants[189] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]);
- computedConstants[190] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN)));
- computedConstants[191] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]);
- computedConstants[192] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]);
- computedConstants[193] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1]))));
- computedConstants[194] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1])));
- computedConstants[195] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1]));
- computedConstants[196] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN);
+ computedConstants[137] = log(constants[0])/log(constants[1]);
+ computedConstants[138] = ceil(constants[0]);
+ computedConstants[139] = floor(constants[0]);
+ computedConstants[140] = fmin(constants[0], constants[1]);
+ computedConstants[141] = fmin(constants[0], fmin(constants[1], constants[2]));
+ computedConstants[142] = fmax(constants[0], constants[1]);
+ computedConstants[143] = fmax(constants[0], fmax(constants[1], constants[2]));
+ computedConstants[144] = fmod(constants[0], constants[1]);
+ computedConstants[145] = sin(constants[0]);
+ computedConstants[146] = cos(constants[0]);
+ computedConstants[147] = tan(constants[0]);
+ computedConstants[148] = sec(constants[0]);
+ computedConstants[149] = csc(constants[0]);
+ computedConstants[150] = cot(constants[0]);
+ computedConstants[151] = sinh(constants[0]);
+ computedConstants[152] = cosh(constants[0]);
+ computedConstants[153] = tanh(constants[0]);
+ computedConstants[154] = sech(constants[0]);
+ computedConstants[155] = csch(constants[0]);
+ computedConstants[156] = coth(constants[0]);
+ computedConstants[157] = asin(constants[0]);
+ computedConstants[158] = acos(constants[0]);
+ computedConstants[159] = atan(constants[0]);
+ computedConstants[160] = asec(constants[0]);
+ computedConstants[161] = acsc(constants[0]);
+ computedConstants[162] = acot(constants[0]);
+ computedConstants[163] = asinh(constants[0]);
+ computedConstants[164] = acosh(constants[0]);
+ computedConstants[165] = atanh(constants[0]/2.0);
+ computedConstants[166] = asech(constants[0]);
+ computedConstants[167] = acsch(constants[0]);
+ computedConstants[168] = acoth(2.0*constants[0]);
+ computedConstants[170] = (constants[0] > constants[1])?constants[0]:NAN;
+ computedConstants[171] = (constants[0] < constants[1])?constants[0]:NAN;
+ computedConstants[172] = constants[0];
+ computedConstants[173] = (constants[0] > constants[1])?constants[0]:constants[2];
+ computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN;
+ computedConstants[175] = (constants[0] < constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN;
+ computedConstants[176] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6];
+ computedConstants[177] = 123.0+((constants[0] > constants[1])?constants[0]:NAN);
+ computedConstants[178] = 123.0+((constants[0] < constants[1])?constants[0]:NAN);
+ computedConstants[183] = constants[0];
+ computedConstants[190] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]);
+ computedConstants[191] = (constants[0] && constants[1])+((constants[2] < constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]);
+ computedConstants[192] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]);
+ computedConstants[193] = (constants[0] && constants[1])-(((constants[2] < constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] < constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]);
+ computedConstants[194] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]);
+ computedConstants[195] = (constants[0] && constants[1])*((constants[2] < constants[3])?constants[1]:NAN)*constants[4]*((constants[2] < constants[3])?constants[1]:NAN)*(constants[5] && constants[6]);
+ computedConstants[196] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN)));
+ computedConstants[197] = (constants[0] && constants[1])/(((constants[2] < constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] < constants[3])?constants[1]:NAN)));
+ computedConstants[198] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]);
+ computedConstants[199] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]);
+ computedConstants[200] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1]))));
+ computedConstants[201] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1])));
+ computedConstants[202] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1]));
+ computedConstants[203] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN);
+ computedConstants[204] = -(constants[0] && constants[1])+-((constants[2] < constants[3])?constants[1]:NAN);
}
void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)
@@ -650,6 +653,9 @@ void computeRates(double voi, double *states, double *rates, double *constants,
void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)
{
+ algebraic[0] = states[0] || states[0];
+ algebraic[1] = states[0] || states[0] || constants[0];
+ algebraic[2] = constants[0]/xor(constants[1], states[0]);
externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0);
findRoot0(voi, states, rates, constants, computedConstants, algebraic, externals);
}
diff --git a/tests/resources/coverage/generator/model.cellml b/tests/resources/coverage/generator/model.cellml
index 6a2574eed1..9ea2a4e296 100644
--- a/tests/resources/coverage/generator/model.cellml
+++ b/tests/resources/coverage/generator/model.cellml
@@ -129,6 +129,7 @@
+
@@ -184,11 +185,16 @@
+
+
+
+
+
@@ -201,15 +207,20 @@
+
+
+
+
+
@@ -349,8 +360,8 @@
m
- n
o
+ n
@@ -373,8 +384,8 @@
m
- n
o
+ n
@@ -640,8 +651,8 @@
eqnOr
- m
- n
+ x
+ x
@@ -649,9 +660,9 @@
eqnOrMultiple
+ x
+ x
m
- n
- o
@@ -1139,7 +1150,7 @@
n
- o
+ x
@@ -1984,6 +1995,17 @@
m
+
+
+ eqnRootSqr
+
+
+
+ 0.5
+
+ m
+
+
eqnRootCube
@@ -2685,6 +2707,11 @@