Skip to content

Commit

Permalink
assertIsClose no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
jwallwork23 committed Dec 11, 2024
1 parent 00f1a5e commit 28b2453
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions core/test/XiosReadWrite_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* @file XiosReadWrite_test.cpp
* @author Joe Wallwork <jw2423@cam.ac.uk>
* @date 10 Dec 2024
* @date 11 Dec 2024
* @brief Tests for XIOS write method
* @details
* This test is designed to test the read and write methods of the C++
Expand Down Expand Up @@ -163,17 +163,6 @@ void readFile(Xios* xios_handler, HField& field_A, const std::string fieldId)
}
}

/*!
* Utility for checking that two double values are approximately equal.
*
* Without this (i.e., if it's inlined below) the first test passes but the second one fails. The
* same is true with any REQUIRE call.
*
* @param val1 the first double
* @param val2 the second double
*/
void assertIsClose(double val1, double val2) { REQUIRE(val1 == doctest::Approx(val2)); }

/*!
* TestXiosRead_2D
*
Expand All @@ -194,7 +183,7 @@ MPI_TEST_CASE("TestXiosRead_2D", 2)
const size_t ny = xios_handler.getDomainLocalYSize("xy_domain");
for (size_t j = 0; j < ny; ++j) {
for (size_t i = 0; i < nx; ++i) {
assertIsClose(field_2D(i, j), i + nx * j);
REQUIRE(field_2D(i, j) == doctest::Approx(i + nx * j));
}
}
xios_handler.context_finalize();
Expand Down Expand Up @@ -222,7 +211,7 @@ MPI_TEST_CASE("TestXiosRead_3D", 2)
for (size_t k = 0; k < nz; ++k) {
for (size_t j = 0; j < ny; ++j) {
for (size_t i = 0; i < nx; ++i) {
assertIsClose(field_3D(i, j, k), i + nx * (j + ny * k));
REQUIRE(field_3D(i, j, k) == doctest::Approx(i + nx * (j + ny * k)));
}
}
}
Expand Down

0 comments on commit 28b2453

Please sign in to comment.