Skip to content

Commit

Permalink
Tests utils: some minor cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Oct 22, 2024
1 parent b7e9fd3 commit a3f72e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,22 @@ void expectEqualIssuesCellmlElementTypesLevelsReferenceRulesUrls(const std::vect
}
}

void expectEqualFileContents(const std::string &fileName, const std::string &fileContents)
{
// Uncomment the below when you want to generate the expected file contents.
// #define NEW_GENERATOR

#ifdef NEW_GENERATOR
std::ofstream file(resourcePath(fileName));

file << fileContents;

file.close();
#endif

EXPECT_EQ(::fileContents(fileName), fileContents);
}

libcellml::ModelPtr createModel(const std::string &name)
{
libcellml::ModelPtr model = libcellml::Model::create();
Expand Down Expand Up @@ -416,19 +432,3 @@ void compareReset(const libcellml::ResetPtr &r1, const libcellml::ResetPtr &r2)
EXPECT_EQ(r1->testValueId(), r2->testValueId());
EXPECT_EQ(r1->resetValueId(), r2->resetValueId());
}

void expectEqualFileContents(const std::string &fileName, const std::string &fileContents)
{
// Uncomment the below when you want to generate the expected file contents.
// #define NEW_GENERATOR

#ifdef NEW_GENERATOR
std::ofstream file(resourcePath(fileName));

file << fileContents;

file.close();
#endif

EXPECT_EQ(::fileContents(fileName), fileContents);
}
1 change: 1 addition & 0 deletions tests/test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ void TEST_EXPORT expectEqualIssuesCellmlElementTypesLevelsReferenceRulesUrls(con
const std::vector<libcellml::Issue::ReferenceRule> &referenceRules,
const std::vector<std::string> &urls,
const libcellml::LoggerPtr &logger);

void TEST_EXPORT expectEqualFileContents(const std::string &fileName, const std::string &fileContents);

libcellml::ModelPtr TEST_EXPORT createModel(const std::string &name = "");
Expand Down

0 comments on commit a3f72e6

Please sign in to comment.