Skip to content

Commit

Permalink
Test 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 f4bab76 commit 26182a4
Showing 1 changed file with 16 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);
}

double roundValue(double value, int precision)
{
return std::round(value * std::pow(10.0, precision)) / std::pow(10.0, precision);
Expand All @@ -285,22 +301,6 @@ testing::AssertionResult areEqualValues(const char *evExpr, const char *vExpr, c
<< " Which is: " << values[i];
}

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);
}

void expectEqualValues(const std::vector<double> &expectedValues, double *values, size_t valueCount)
{
EXPECT_EQ(expectedValues.size(), valueCount);
Expand Down

0 comments on commit 26182a4

Please sign in to comment.