Skip to content

Commit

Permalink
Tests: some minor cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Nov 21, 2024
1 parent bf48363 commit af862ed
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 72 deletions.
44 changes: 22 additions & 22 deletions tests/api/sed/serialisetests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ TEST(SerialiseSedTest, localCellmlFileWithBasePath)
auto file = libOpenCOR::File::create(libOpenCOR::resourcePath(libOpenCOR::CELLML_2_FILE));
auto document = libOpenCOR::SedDocument::create(file);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml"));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml"));
}

TEST(SerialiseSedTest, localCellmlFileWithoutBasePath)
Expand All @@ -131,7 +131,7 @@ TEST(SerialiseSedTest, relativeLocalCellmlFileWithBasePath)
auto file = libOpenCOR::File::create(libOpenCOR::resourcePath(libOpenCOR::CELLML_2_FILE));
auto document = libOpenCOR::SedDocument::create(file);

EXPECT_EQ(document->serialise(std::string(libOpenCOR::LOCAL_BASE_PATH).append("/../..")), cvodeExpectedSerialisation("tests/res/cellml_2.cellml"));
EXPECT_EQ(document->serialise(std::string(libOpenCOR::RESOURCE_LOCATION).append("/../..")), cvodeExpectedSerialisation("tests/res/cellml_2.cellml"));
}

TEST(SerialiseSedTest, relativeLocalCellmlFileWithoutBasePath)
Expand Down Expand Up @@ -212,15 +212,15 @@ TEST(SerialiseSedTest, daeModel)
auto file = libOpenCOR::File::create(libOpenCOR::resourcePath("api/sed/dae.cellml"));
auto document = libOpenCOR::SedDocument::create(file);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), expectedSerialisation);
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), expectedSerialisation);
}

TEST(SerialiseSedTest, nlaModel)
{
auto file = libOpenCOR::File::create(libOpenCOR::resourcePath("api/sed/nla.cellml"));
auto document = libOpenCOR::SedDocument::create(file);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), kinsolExpectedSerialisation());
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), kinsolExpectedSerialisation());
}

TEST(SerialiseSedTest, algebraicModel)
Expand All @@ -242,7 +242,7 @@ TEST(SerialiseSedTest, algebraicModel)
auto file = libOpenCOR::File::create(libOpenCOR::resourcePath("api/sed/algebraic.cellml"));
auto document = libOpenCOR::SedDocument::create(file);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), expectedSerialisation);
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), expectedSerialisation);
}

TEST(SerialiseSedTest, fixedStepOdeSolver)
Expand Down Expand Up @@ -273,7 +273,7 @@ TEST(SerialiseSedTest, fixedStepOdeSolver)

simulation->setOdeSolver(libOpenCOR::SolverForwardEuler::create());

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), expectedSerialisation);
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), expectedSerialisation);
}

TEST(SerialiseSedTest, cvodeSolverWithAdamsMoultonInterationMethod)
Expand All @@ -285,7 +285,7 @@ TEST(SerialiseSedTest, cvodeSolverWithAdamsMoultonInterationMethod)

solver->setIntegrationMethod(libOpenCOR::SolverCvode::IntegrationMethod::ADAMS_MOULTON);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000475", "Adams-Moulton"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000475", "Adams-Moulton"}}));
}

TEST(SerialiseSedTest, cvodeSolverWithFunctionalIterationType)
Expand All @@ -297,7 +297,7 @@ TEST(SerialiseSedTest, cvodeSolverWithFunctionalIterationType)

solver->setIterationType(libOpenCOR::SolverCvode::IterationType::FUNCTIONAL);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000476", "Functional"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000476", "Functional"}}));
}

TEST(SerialiseSedTest, cvodeSolverWithBandedLinearSolver)
Expand All @@ -309,7 +309,7 @@ TEST(SerialiseSedTest, cvodeSolverWithBandedLinearSolver)

solver->setLinearSolver(libOpenCOR::SolverCvode::LinearSolver::BANDED);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "Banded"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "Banded"}}));
}

TEST(SerialiseSedTest, cvodeSolverWithDiagonalLinearSolver)
Expand All @@ -321,7 +321,7 @@ TEST(SerialiseSedTest, cvodeSolverWithDiagonalLinearSolver)

solver->setLinearSolver(libOpenCOR::SolverCvode::LinearSolver::DIAGONAL);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "Diagonal"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "Diagonal"}}));
}

TEST(SerialiseSedTest, cvodeSolverWithGmresLinearSolver)
Expand All @@ -333,7 +333,7 @@ TEST(SerialiseSedTest, cvodeSolverWithGmresLinearSolver)

solver->setLinearSolver(libOpenCOR::SolverCvode::LinearSolver::GMRES);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "GMRES"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "GMRES"}}));
}

TEST(SerialiseSedTest, cvodeSolverWithBicgstabLinearSolver)
Expand All @@ -345,7 +345,7 @@ TEST(SerialiseSedTest, cvodeSolverWithBicgstabLinearSolver)

solver->setLinearSolver(libOpenCOR::SolverCvode::LinearSolver::BICGSTAB);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "BiCGStab"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "BiCGStab"}}));
}

TEST(SerialiseSedTest, cvodeSolverWithTfqmrLinearSolver)
Expand All @@ -357,7 +357,7 @@ TEST(SerialiseSedTest, cvodeSolverWithTfqmrLinearSolver)

solver->setLinearSolver(libOpenCOR::SolverCvode::LinearSolver::TFQMR);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "TFQMR"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000477", "TFQMR"}}));
}

TEST(SerialiseSedTest, cvodeSolverWithNoPreconditioner)
Expand All @@ -369,7 +369,7 @@ TEST(SerialiseSedTest, cvodeSolverWithNoPreconditioner)

solver->setPreconditioner(libOpenCOR::SolverCvode::Preconditioner::NO);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000478", "No"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000478", "No"}}));
}

TEST(SerialiseSedTest, cvodeSolverWithNoInterpolateSolution)
Expand All @@ -381,7 +381,7 @@ TEST(SerialiseSedTest, cvodeSolverWithNoInterpolateSolution)

solver->setInterpolateSolution(false);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000481", "false"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), cvodeExpectedSerialisation("cellml_2.cellml", {{"KISAO:0000481", "false"}}));
}

TEST(SerialiseSedTest, kinsolWithBandedLinearSolver)
Expand All @@ -393,7 +393,7 @@ TEST(SerialiseSedTest, kinsolWithBandedLinearSolver)

solver->setLinearSolver(libOpenCOR::SolverKinsol::LinearSolver::BANDED);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), kinsolExpectedSerialisation({{"KISAO:0000477", "Banded"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), kinsolExpectedSerialisation({{"KISAO:0000477", "Banded"}}));
}

TEST(SerialiseSedTest, kinsolWithGmresLinearSolver)
Expand All @@ -405,7 +405,7 @@ TEST(SerialiseSedTest, kinsolWithGmresLinearSolver)

solver->setLinearSolver(libOpenCOR::SolverKinsol::LinearSolver::GMRES);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), kinsolExpectedSerialisation({{"KISAO:0000477", "GMRES"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), kinsolExpectedSerialisation({{"KISAO:0000477", "GMRES"}}));
}

TEST(SerialiseSedTest, kinsolWithBicgstabLinearSolver)
Expand All @@ -417,7 +417,7 @@ TEST(SerialiseSedTest, kinsolWithBicgstabLinearSolver)

solver->setLinearSolver(libOpenCOR::SolverKinsol::LinearSolver::BICGSTAB);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), kinsolExpectedSerialisation({{"KISAO:0000477", "BiCGStab"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), kinsolExpectedSerialisation({{"KISAO:0000477", "BiCGStab"}}));
}

TEST(SerialiseSedTest, kinsolWithTfmqrLinearSolver)
Expand All @@ -429,7 +429,7 @@ TEST(SerialiseSedTest, kinsolWithTfmqrLinearSolver)

solver->setLinearSolver(libOpenCOR::SolverKinsol::LinearSolver::TFQMR);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), kinsolExpectedSerialisation({{"KISAO:0000477", "TFQMR"}}));
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), kinsolExpectedSerialisation({{"KISAO:0000477", "TFQMR"}}));
}

TEST(SerialiseSedTest, oneStepSimulation)
Expand Down Expand Up @@ -457,7 +457,7 @@ TEST(SerialiseSedTest, oneStepSimulation)

document->addSimulation(simulation);

EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), expectedSerialisation);
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), expectedSerialisation);
}

TEST(SerialiseSedTest, sedmlFile)
Expand Down Expand Up @@ -499,7 +499,7 @@ TEST(SerialiseSedTest, sedmlFile)
auto document = libOpenCOR::SedDocument::create(file);

EXPECT_EQ_ISSUES(document, expectedIssues);
EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), expectedSerialisation);
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), expectedSerialisation);
}

TEST(SerialiseSedTest, sedSimulation)
Expand Down Expand Up @@ -788,5 +788,5 @@ TEST(SerialiseSedTest, sedSimulation)
auto document = libOpenCOR::SedDocument::create(file);

// EXPECT_EQ_ISSUES(document, expectedIssues);
EXPECT_EQ(document->serialise(libOpenCOR::LOCAL_BASE_PATH), expectedSerialisation);
EXPECT_EQ(document->serialise(libOpenCOR::RESOURCE_LOCATION), expectedSerialisation);
}
44 changes: 22 additions & 22 deletions tests/bindings/javascript/sed.serialise.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe("Sed serialise tests", () => {

const document = new libopencor.SedDocument(file);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml"),
);

Expand Down Expand Up @@ -166,7 +166,7 @@ describe("Sed serialise tests", () => {

const document = new libopencor.SedDocument(file);

expect(document.serialise(utils.LOCAL_BASE_PATH + "/../..")).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION + "/../..")).toBe(
cvodeExpectedSerialisation("some/path/cellml_2.cellml"),
);

Expand Down Expand Up @@ -281,7 +281,7 @@ describe("Sed serialise tests", () => {

const document = new libopencor.SedDocument(file);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
expectedSerialisation,
);

Expand All @@ -296,7 +296,7 @@ describe("Sed serialise tests", () => {

const document = new libopencor.SedDocument(file);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
kinsolExpectedSerialisation(),
);

Expand Down Expand Up @@ -328,7 +328,7 @@ describe("Sed serialise tests", () => {

const document = new libopencor.SedDocument(file);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
expectedSerialisation,
);

Expand Down Expand Up @@ -366,7 +366,7 @@ describe("Sed serialise tests", () => {

simulation.setOdeSolver(new libopencor.SolverForwardEuler());

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
expectedSerialisation,
);

Expand All @@ -387,7 +387,7 @@ describe("Sed serialise tests", () => {
libopencor.SolverCvode.IntegrationMethod.ADAMS_MOULTON,
);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml", {
"KISAO:0000475": "Adams-Moulton",
}),
Expand All @@ -408,7 +408,7 @@ describe("Sed serialise tests", () => {

solver.setIterationType(libopencor.SolverCvode.IterationType.FUNCTIONAL);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml", {
"KISAO:0000476": "Functional",
}),
Expand All @@ -429,7 +429,7 @@ describe("Sed serialise tests", () => {

solver.setLinearSolver(libopencor.SolverCvode.LinearSolver.BANDED);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml", {
"KISAO:0000477": "Banded",
}),
Expand All @@ -450,7 +450,7 @@ describe("Sed serialise tests", () => {

solver.setLinearSolver(libopencor.SolverCvode.LinearSolver.DIAGONAL);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml", {
"KISAO:0000477": "Diagonal",
}),
Expand All @@ -471,7 +471,7 @@ describe("Sed serialise tests", () => {

solver.setLinearSolver(libopencor.SolverCvode.LinearSolver.GMRES);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml", {
"KISAO:0000477": "GMRES",
}),
Expand All @@ -492,7 +492,7 @@ describe("Sed serialise tests", () => {

solver.setLinearSolver(libopencor.SolverCvode.LinearSolver.BICGSTAB);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml", {
"KISAO:0000477": "BiCGStab",
}),
Expand All @@ -513,7 +513,7 @@ describe("Sed serialise tests", () => {

solver.setLinearSolver(libopencor.SolverCvode.LinearSolver.TFQMR);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml", {
"KISAO:0000477": "TFQMR",
}),
Expand All @@ -534,7 +534,7 @@ describe("Sed serialise tests", () => {

solver.setPreconditioner(libopencor.SolverCvode.Preconditioner.NO);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml", { "KISAO:0000478": "No" }),
);

Expand All @@ -553,7 +553,7 @@ describe("Sed serialise tests", () => {

solver.setInterpolateSolution(false);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
cvodeExpectedSerialisation("cellml_2.cellml", {
"KISAO:0000481": "false",
}),
Expand All @@ -574,7 +574,7 @@ describe("Sed serialise tests", () => {

solver.setLinearSolver(libopencor.SolverKinsol.LinearSolver.BANDED);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
kinsolExpectedSerialisation({ "KISAO:0000477": "Banded" }),
);

Expand All @@ -593,7 +593,7 @@ describe("Sed serialise tests", () => {

solver.setLinearSolver(libopencor.SolverKinsol.LinearSolver.GMRES);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
kinsolExpectedSerialisation({ "KISAO:0000477": "GMRES" }),
);

Expand All @@ -612,7 +612,7 @@ describe("Sed serialise tests", () => {

solver.setLinearSolver(libopencor.SolverKinsol.LinearSolver.BICGSTAB);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
kinsolExpectedSerialisation({ "KISAO:0000477": "BiCGStab" }),
);

Expand All @@ -631,7 +631,7 @@ describe("Sed serialise tests", () => {

solver.setLinearSolver(libopencor.SolverKinsol.LinearSolver.TFQMR);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
kinsolExpectedSerialisation({ "KISAO:0000477": "TFQMR" }),
);

Expand Down Expand Up @@ -666,7 +666,7 @@ describe("Sed serialise tests", () => {

document.addSimulation(simulation);

expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
expectedSerialisation,
);

Expand Down Expand Up @@ -718,7 +718,7 @@ describe("Sed serialise tests", () => {
"The model 'cellml_2.cellml' could not be found in the file manager. It has been automatically added to it.",
],
]);
expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
expectedSerialisation,
);

Expand Down Expand Up @@ -1136,7 +1136,7 @@ describe("Sed serialise tests", () => {
"The linear solver ('KISAO:0000477') cannot be equal to 'Unknown'. It must be equal to 'Dense', 'Banded', 'GMRES', 'BiCGStab', or 'TFQMR'. A Dense linear solver will be used instead.",
],
]);
expect(document.serialise(utils.LOCAL_BASE_PATH)).toBe(
expect(document.serialise(utils.RESOURCE_LOCATION)).toBe(
expectedSerialisation,
);

Expand Down
Loading

0 comments on commit af862ed

Please sign in to comment.