Skip REFPROP tests when not available during CI (#2710)

* Try loading REFPROP backend and only warn on failure
* Skip REFPROP related tests when not available using a single helper routine in CoolProp:: namespace
This commit is contained in:
Jeff Henning
2026-04-09 21:12:20 -04:00
committed by GitHub
parent 61351d449c
commit 775e1d49a6
6 changed files with 43 additions and 1 deletions

View File

@@ -675,7 +675,17 @@ bool add_fluids_as_JSON(const std::string& backend, const std::string& fluidstri
}
}
// Simple function to check if REFPROPMixtureBackend is supported in this environment, so that we can skip
// tests that require it in environments where it is not supported (e.g., CI builds on GitHub)
void Skip_if_No_REFPROP() {
#if defined(ENABLE_CATCH)
if (!CoolProp::REFPROPMixtureBackend::REFPROP_supported()) SKIP("Skipping: REFPROP not supported in this environment.");
#endif
// Otherwise, in non-testing environments, this is a no-op.
}
#if defined(ENABLE_CATCH)
TEST_CASE("Check inputs to PropsSI", "[PropsSI]") {
SECTION("Single state, single output") {
CHECK(ValidNumber(CoolProp::PropsSI("T", "P", 101325, "Q", 0, "Water")));
@@ -705,9 +715,11 @@ TEST_CASE("Check inputs to PropsSI", "[PropsSI]") {
CHECK(ValidNumber(CoolProp::PropsSI("T", "P", 101325, "Q", 0, "R410A.mix")));
};
SECTION("Single state, single output, predefined mixture from REFPROP") {
Skip_if_No_REFPROP();
CHECK(ValidNumber(CoolProp::PropsSI("T", "P", 101325, "Q", 0, "REFPROP::R410A.MIX")));
};
SECTION("Single state, single output, bad predefined mixture from REFPROP") {
Skip_if_No_REFPROP();
CHECK(!ValidNumber(CoolProp::PropsSI("T", "P", 101325, "Q", 0, "REFPROP::RRRRRR.mix")));
};
SECTION("Predefined mixture") {